cschwan/sage-on-gentoo — Issue #115: parallel building is currently broken
Author: kiwifb
Created: 2012-01-17 02:27:32+00:00
State: open

Ages ago I introduced the following line in the sage ebuild:

export MAKE=${MAKEOPTS}

At the time it was allowing sage to use the appropriate -j setting from MAKEOPTS at build time. This has been broken for a while now....

I am not sure when the change has been introduced but the current stable sage detects the number of CPUs and use that value to build sage in parallel. In 4.8.alpha5 Jeroen introduced SAGE_NUM_THREADS which is set up in sage-env by calling a new script called sage-num-threads.py. Currently sage-4.8.alpha6 builds at -j1 unless you specify SAGE_NUM_THREADS manually.

There are a number of issues here:
# should we add SAGE_NUM_THREADS to sage-env
# How do we re-enable parallel building

For the second question the current plan that came to me during the research for this post is as follow:
# install sage-num-threads.py in sage-baselayout (with patching to use MAKEOPTS rather than MAKE)
# call sage-num-threads.py in the same way it is done in upstream sage-env to set SAGE_NUM_THREADS in the ebuild.

The advantage is of course reusing work done upstream. I have no idea how to do this properly in bash (remember it needs to parse anything in MAKEOPTS and mine reads "-j12 VERBOSE=1" for example. Upstream may have something that work in python so using it is nice.