HP XC System 2.x Software User Manual
Page 51

single compilation line, so it is common to talk about concurrent compilations, though GNU
make
is more general.
On non-cluster platforms or command nodes, matching concurrency to the number of processors
often works well. It also often works well to specify 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 compilations, and there are a variety of ways to make this happen.
One way is to prefix 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 have multiple
srun
commands instead of
multiple
cc
commands. 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 more information about GNU parallel
make
, refer to the
make
manpage. For additional
sources of GNU information, refer to the references provided in About This Document.
In this section, three different ways to parallelize a make procedure are illustrated. 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 GNU
make -j
switch, which specifies the number of
jobs to run simultaneously. 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 parallel and have the make procedure
within each directory be serial (Modified makefile:
Makefile_type2
).
•
Section 3.9.1.3 — Go through the directories in parallel 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