Question about Ports system and SMP

Hi all,

Just a quick question that someone should hopefully be able to answer for me pretty easily.

With the Ports system, assuming you have an SMP kernel, does the compiler use all cores for compiling the ports you install, or is there a configuration file pertaining to the ports system that a flag (e.g. -j3) needs to be added to?

Just want to squeeze every drop of power I can out of my dual Opteron system I've installed FreeBSD 7.2 on ;)

Thanks!
 
Usually, while compiling, the bottleneck is I/O. Not so much the processor. But yes, adding the -j flag would be the flag. You can either add it on the command line or add it to /etc/make.conf.
 
If a port supports parallel build, -j with a number equal to the core number will be passed to the port Makefile.
This can be controlled and tuned. For example, look in /usr/ports/bsd.port.mk and search for MAKE_JOBS_SAFE.
 
Thank you SirDice.

Is it like the make.conf in gentoo linux where you add something along the lines of MAKE_OPTS="-j3"?

Just having trouble finding information on how to do this (perhaps I'm not searching for the right terms?)

SirDice said:
Usually, while compiling, the bottleneck is I/O. Not so much the processor. But yes, adding the -j flag would be the flag. You can either add it on the command line or add it to /etc/make.conf.
 
dkrypt said:
Is it like the make.conf in gentoo linux where you add something along the lines of MAKE_OPTS="-j3"?
I don't know Gentoo but it looks similar. Have a look at the examples in /usr/share/examples/etc/make.conf and the man page make.conf(5).
 
Unfortunately I've already gone through them and can't see anywhere where you can specify how many processes to kick off.

Perhaps there is no way?

SirDice said:
I don't know Gentoo but it looks similar. Have a look at the examples in /usr/share/examples/etc/make.conf and the man page make.conf(5).
 
It's all done automatically, now.

If a port is known to work correctly with "make -j", then it will have MAKE_JOBS_SAFE set in the Makefile, and it will automatically use as many jobs as there are CPU cores.

If a port is known to not work with "make -j", then it will have MAKE_JOBS_UNSAFE set in the Makefile, and it will refuse to build if you try to use -j (will only build using 1 CPU core).

All other ports will continue to build using a single CPU core until someone determines that it can use MAKE_JOBS_SAFE or MAKE_JOBS_UNSAFE.
 
Back
Top