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 -N1option 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 -jswitch, 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:

Example Procedure 1 — Go through the directories serially and have the make procedure within each directory be parallel. (Modified makefile: Makefile_type1).

Example Procedure 2 — Go through the directories in parallel and have the make procedure within each directory be serial (Modified makefile: Makefile_type2).

Example Procedure 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

srcdir = .

HYPRE_DIRS =\ utilities\ struct_matrix_vector\ struct_linear_solvers\ test

all:

@ \

for i in ${HYPRE_DIRS}; \ do \

if [ -d $$i ]; \ then \

echo "Making $$i ..."; \ (cd $$i; make); \

echo ""; \ fi; \

done

clean:

94 Advanced Topics