[comp.unix.questions] Want info on parallel makes

friedl@mtndew.UUCP (Stephen J. Friedl) (07/10/90)

Hi folks,

     In my Allegely Portable Software Package, my focus has turned
onto makefiles.  Some machines support a parallel make facility, and
I would rather this it than not use it, but I don't know how common
the syntax is.  Sequent uses the notation:

	target : & file1.o file2.o file3.o
		commands

where the & marks the start of the dependencies that can be
parallelized (BSD make only, not in the Sys V make).

     What other notations are out there?  I already have a
front-end to make that can take care of some of this syntax
difference by sticking macros on the command line, but I
gotta know where to start.

     Steve

-- 
Stephen J. Friedl, KA8CMY / Software Consultant / Tustin, CA / 3B2-kind-of-guy
+1 714 544 6561  / friedl@mtndew.Tustin.CA.US  / {uunet,attmail}!mtndew!friedl

Berkeley UNIX is for people who don't have real work to do

prc@erbe.se (Robert Claeson) (07/11/90)

In article <464@mtndew.UUCP>, friedl@mtndew.UUCP (Stephen J. Friedl) writes:

>      In my Allegely Portable Software Package, my focus has turned
> onto makefiles.  Some machines support a parallel make facility, and
> I would rather this it than not use it, but I don't know how common
> the syntax is.  Sequent uses the notation:

> 	target : & file1.o file2.o file3.o
> 		commands

I'm "quite" familiar (read: use it daily) with the parallel make that
Encore Computer Corp. ships with their o/s'es (BSD 4.3, SysV R3.2, Mach)
for the Multimax computers. The sequential make is named "make" and the
parallel one has the name "pmake" (I believe that there's a PD parallel
make that's also named "pmake"). Pmake doesn't require any modifications
to a well-written makefile. It recognizes when compiles aren't depending
on each other and runs them in parallel. The number of compiles that can
be performed simultaneously is determined by the environment variable
"PARALLEL", or via a command-line switch. If not given, a default of 3
is used.

Just make sure that all dependencies are explicitly defined in the
makefile. Don't rely on that a sequential make will run them in the
right order, it might not work with a parallel make, which can otherwise
start to link a program before all source files that belongs to it are
compiled.

-- 
Robert Claeson                  |Reasonable mailers: rclaeson@erbe.se
ERBE DATA AB                    |      Dumb mailers: rclaeson%erbe.se@sunet.se
                                |  Perverse mailers: rclaeson%erbe.se@encore.com
These opinions reflect my personal views and not those of my employer (ask him).

bob@MorningStar.Com (Bob Sutterfield) (07/12/90)

GNU Make, when invoked with the -j<number> option, will do up to
<number> tasks in parallel.  Rather than requiring a novel Makefile
syntax, it deduces independent tasks from a well-written but otherwise
normal Makefile.  Once forked by the Makefile, tasks are subject to
the operating system's normal process scheduler.  It can perform some
tasks in parallel, then a few in serial, then some more in parallel,
if the dependencies are appropriate.

For example, `gmake -j7 libXt.a' is about right for a Sun-4/60 with
16Mb, plenty of swap space, and nothing else to do.  If your CC is gcc
and your CFLAGS include -pipe, you may want to back down to -j4 or so.