single compilation line, so it is common to talk about concu rrent compilations, though GNU
make is more general.
On non-cluster platforms or comm a nd nodes, matching concurrency to t he number of processors
oftenworkswell.Italsooftenworkswelltospecify a few more jobs than processors so that one
job can proceed while another is waiting for I/O. On an HP XC system, there is the potential to
use compute nodes to do co mp ilations, and there are a variety of ways to make this happen.
One way is to p ref ix the actual compilation line in the rule with an srun command. So, instead
of executing cc foo.c -o foo.o it would execute srun cc foo.c -o foo.o.
With concurrency, multiple command nodes would h ave multiple srun commands instead of
multiple cc comm ands. For projects that recursively run make on subdirectories, the recursive
make can be run on the compute nodes. For example:
$ cd subdir; srun $(MAKE)...
Further, if the recursive make is run remotely, it can be told to use concurrency on the remote
node. For example:
$ cd subdir; srun -n1 -N1 $(MAKE) -j4...
This can cause multiple makes to run concurrently, each building their targets concurrently.
The -N1 option is used to reserve the entire node, because it is intended to be used for multiple
compilations. The following examples illustrate these ideas. In GNU make,a$(VARIABLE)
that is unspecified is replaced with nothing. Therefore, not specifying PREFIX keeps the
original makefile’s behavior, but specifying PREFIX to appropriate srun command prefixes
will cause concurrency within the build.
For m ore information about GNU parallel make, refer to the make manpage. For additional
sources of GNU information, refer to the references provided in A bout This Docum ent.
In this section, t hree different w a ys to par a ll elize a make pro cedur e are il lustrated. The smg98
package is used to illustrate these three procedures. The smg98 package is available at the
following URL:
http://www.llnl.gov/asci/applications/SMG98README.html
These procedures take advantage of the GN U make -j switch, which specifies the number o f
jobs to run sim ultaneo usly. Refer to the make manpage for more information about this switch.
The following parallel make approaches are described:
• Section 3.9.1.1 — Go through the directories serially and have the make procedure within
each directory be parallel. (Modified makefile: Makefile_type1).
• Section 3.9.1.2 — Go through the directories in p arallel and have the make procedure
within each directory be s erial (Modified makefile: Makefile_type2).
• Section 3.9.1.3 — Go through the directories in p arallel and have the make procedure
within each directory be parallel (Modified makefile: Makefile_type3).
The original makefile is shown below:
#BHEADER***********************************************************
# (c) 1998 The Regents of the University of California
#
# See the file COPYRIGHT_and_DISCLAIMER for a complete copyright
# notice, contact person, and disclaimer.
#
# $Revision: 1.1 $
#EHEADER***********************************************************
SHELL = /bin/sh
Developing Applications 3-11
Commentaires sur ces manuels