[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: parallel makes ?



On Sat, Dec 11, 1999 at 08:54:45PM +0100, Thierry Deval wrote:
> Hello Marc,
> 
> In your last bsd.port.mk patch proposal, you are talking about parallel makes.
> It's not the first time I'm hearing of these, but I wonder what these are and
> how to use it.

You've got at least two of these available though: 
OpenBSD native make, and gnu-make.

There are some detailed explanations of the process in the source tree under
usr.bin/make/PSD.doc

The idea is simple: a Makefile describes dependencies.  If the set of 
dependencies is complete, there is no reason you can't run several rules
in parallel, .e.g, if
a: b c d

and b and c are out-of-date, you can start building b and c at the same time,
and a only when b and c are both built.

The `usual' mode of operation of make is to build b, then to build c.
This isn't what the above dependency describes. To achieve sequential builds
in parallel make mode, you would have to specify
c: b 
separately.

Parallel make (and Makefile) are the rule on SMP machines... that's not us
yet. They also can be used over networks.

Curiously enough, they can be of use on fast UP machines, provided you've got
enough memory, and reasonably concurrent disks (at least dma, most often
scsi): having two or three compiles running in parallel may be slightly
faster, because one of these compiles might be locked out waiting for IO to
finish, during which time the other compiles will be able to process.

As far as bsd.port.mk goes, this means that the resulting bsd.port.mk has
saner rules which reflect reality, instead of kind-of working by accident,
or by side-effect.

As far as OpenBSD make goes, parallel mode is largely unused, thoroughly
untested, and has a few very specific quirks which make it a bit harder to
write Makefiles that work under both rules.
Specifically, instead of just starting several parallel jobs, it also
aggregates a set of command into one single shell script.

So stuff such as 
	cd dir && do_something
	do_something_else

will have a different meaning under both modes of operations, as 
do_something_else will be run into a different directory.
-- 
	Marc Espie		
|anime, sf, juggling, unicycle, acrobatics, comics...
|AmigaOS, OpenBSD, C++, perl, Icon, PostScript...
| `real programmers don't die, they just get out of beta'