Reliably detect number of make build threads to use
At the moment all calls to make
are effectively with -j1
. Setting make
up to use more threads is easy: `export MAKEFLAGS="-j4"'.
However, detecting the number of logical hardware threads available to pass to make doesn't seem so easy. This is because when the container is in a virtualised environment, e.g. Virtualbox, where x cores are assigned from a CPU with y cores, the number of reported cores is still y. Even hwloc
reports y.
Comments (6)
-
-
reporter Sounds good.
Where is the best place to put this? I suggest inside the user
fenics
.bash_profile
so that we don't ramp up build threads on bamboo or the cloud building service, where everything is always run as pseudo-root
-
reporter Ah, I re-read my initial report... If you have 1 CPU assigned in VirtualBox, how many do you get reported in your command? I get 4, regardless of assigned resources.
-
My machine has 12 cores, VirtualBox reports 2.
-
reporter Attempt at a fix in commit 6e2ec75.
See how it goes in the build system...
-
reporter - changed status to resolved
Completely changed my mind on this. Best and safest option is to pass
--env
rather than trying autodetect...@logg: Know you asked for this, update to latest version of
fenicsproject
script and adjust theDEFAULT_MAKEFLAGS
variable near top or uncomment the magic line below to autodetect.Fixed commit b4af0005
- Log in to comment
grep -c '^processor' /proc/cpuinfo
does the trick for me (tested natively, from inside VirtualBox and with Docker on OSX).