# HG changeset patch
# User J. H. Palmieri <palmieri@math.washington.edu>
# Date 1319741907 25200
# Node ID 6458bd7abc89467b4649329b2a4b6bda797b8a52
# Parent 841c7bfafa5447a618f43eeb31b2d6050a135b0a
#11959: make Sage build spkgs in parallel by default.
Only build in serial if either SAGE_PARALLEL_SPKG_BUILD=no or if you
run "make build-serial".
In README.txt, highlight the presence of the files in spkg/logs/
diff --git a/.hgignore b/.hgignore
|
a
|
b
|
sage-python |
| 24 | 24 | Makefile.old |
| 25 | 25 | VERSION.txt |
| 26 | 26 | ^spkg-install$ |
| | 27 | spkg/parallel_make.cfg |
diff --git a/Makefile b/Makefile
|
a
|
b
|
all: doc # (already) indirectly depends |
| 43 | 43 | # test -x $@ # or make it executable if it exists; sanity check only anyway |
| 44 | 44 | |
| 45 | 45 | build: $(PIPE) |
| 46 | | cd spkg && "../$(PIPE)" "./install all 2>&1" "tee -a ../install.log" |
| | 46 | cd spkg && \ |
| | 47 | "../$(PIPE)" \ |
| | 48 | "env SAGE_PARALLEL_SPKG_BUILD='$(SAGE_PARALLEL_SPKG_BUILD)' ./install all 2>&1" \ |
| | 49 | "tee -a ../install.log" |
| | 50 | |
| | 51 | build-serial: SAGE_PARALLEL_SPKG_BUILD = no |
| | 52 | build-serial: build |
| 47 | 53 | |
| 48 | 54 | # You can choose to have the built HTML version of the documentation link to |
| 49 | 55 | # the PDF version. To do so, you need to build both the HTML and PDF versions. |
| … |
… |
install: |
| 155 | 161 | cd $(DESTDIR)/bin/; ./sage -c |
| 156 | 162 | |
| 157 | 163 | |
| 158 | | .PHONY: all build doc doc-html doc-html-jsmath doc-pdf \ |
| | 164 | .PHONY: all build build-serial doc doc-html doc-html-jsmath doc-pdf \ |
| 159 | 165 | doc-clean clean distclean \ |
| 160 | 166 | test check testoptional testlong ptest ptestall ptestlong \ |
| 161 | 167 | install testall ptestoptional |
diff --git a/README.txt b/README.txt
|
a
|
b
|
2. Install build dependencies. |
| 168 | 168 | installed when you install the programs listed above. |
| 169 | 169 | |
| 170 | 170 | 3. Extract the Sage source tarball and cd into a directory with no |
| 171 | | spaces in it. If you have a machine with 4 processors, say, type the |
| 172 | | following to configure the build script to perform a parallel |
| | 171 | spaces in it. If you have a machine with 4 processors, say, type |
| | 172 | the following to configure the build script to perform a parallel |
| 173 | 173 | compilation of Sage using 4 jobs: |
| 174 | 174 | |
| 175 | 175 | export MAKE="make -j4" |
| 176 | 176 | |
| 177 | | By default the above will only parallelize a small part of the build |
| 178 | | process. To make the spkg build part of the installation process |
| 179 | | parallel do: |
| | 177 | (With 4 processors, you might also consider "-j5" or "-j6" -- |
| | 178 | building with more jobs than CPU cores can speed things up.) |
| | 179 | You might in addition pass a "-l" flag to "make": this |
| | 180 | sets a load limit, so for example if you execute |
| 180 | 181 | |
| 181 | | export SAGE_PARALLEL_SPKG_BUILD="yes" |
| | 182 | export MAKE="make -j4 -l5.5" |
| 182 | 183 | |
| 183 | | The amount of processors used for the building of the spkg's is |
| 184 | | determined by what you assigned to MAKE. So the above is useless if |
| 185 | | you did export MAKE="make -j1". |
| | 184 | then "make" won't start more than one job at a time if the system |
| | 185 | load average is above 5.5. See |
| | 186 | http://www.gnu.org/software/make/manual/make.html#Options-Summary |
| | 187 | and http://www.gnu.org/software/make/manual/make.html#Parallel. |
| 186 | 188 | |
| 187 | 189 | If you want to run the test suite for each individual spkg as it is |
| 188 | 190 | installed, type: |
| … |
… |
10. OPTIONAL: It is recommended that you |
| 244 | 246 | plotting functionality benefits from it. |
| 245 | 247 | |
| 246 | 248 | |
| | 249 | PROBLEMS |
| | 250 | -------- |
| | 251 | |
| | 252 | If you have problems building Sage, check the Sage Installation Guide, |
| | 253 | and also note the following. Each separate component of Sage is |
| | 254 | contained in an spkg; these are stored in spkg/standard/. As each one |
| | 255 | is built, a build log is stored in spkg/logs/, so you can browse these |
| | 256 | to find error messages. If an spkg fails to build, the whole build |
| | 257 | process will stop soon after, so check the most recent log files |
| | 258 | first, or run |
| | 259 | |
| | 260 | grep -li "An error" spkg/logs/* |
| | 261 | |
| | 262 | from the top-level Sage directory to find log files with error |
| | 263 | messages in them. Send (a small part of) the relevant log file to the |
| | 264 | sage-devel mailing list, making sure to include at least some of the |
| | 265 | error messages; probably someone there will have some helpful |
| | 266 | suggestions. |
| | 267 | |
| | 268 | |
| 247 | 269 | SUPPORTED COMPILERS |
| 248 | 270 | ------------------- |
| 249 | 271 | |
diff --git a/spkg/install b/spkg/install
|
a
|
b
|
export ZODB |
| 428 | 428 | ZNPOLY=`$newest zn_poly` |
| 429 | 429 | export ZNPOLY |
| 430 | 430 | |
| | 431 | # If the user (or the Makefile) has set SAGE_PARALLEL_SPKG_BUILD=no, |
| | 432 | # then turn off parallel building by writing .NOTPARALLEL to |
| | 433 | # spkg/standard/parallel_make.cfg. Otherwise clear that file. |
| | 434 | if [[ ${SAGE_PARALLEL_SPKG_BUILD:-yes} = no ]]; then |
| | 435 | # Disable just building multiple packages at the same time; individual |
| | 436 | # spkgs still get built in parallel if they support it and '--jobs' |
| | 437 | # in $MAKE is greater than one (and at all specified): |
| | 438 | echo ".NOTPARALLEL:" > "$SAGE_ROOT"/spkg/parallel_make.cfg |
| | 439 | else |
| | 440 | # Create an (almost) empty file, s.t. including it from spkg/standard/deps |
| | 441 | # doesn't raise an error, thereby also invalidating any previous setting: |
| | 442 | echo > "$SAGE_ROOT"/spkg/parallel_make.cfg |
| | 443 | fi |
| 431 | 444 | |
| 432 | 445 | # Skip the rest if nothing to do (i.e., to [re]build): |
| 433 | | # Note that we should use $MAKE here, but we currently don't use |
| 434 | | # it further below either unless SAGE_PARALLEL_SPKG_BUILD=yes, which |
| 435 | | # I consider a "bug". -- Leif Leonhardy |
| 436 | | # If "make" doesn't understand the -q option, it should exit with a |
| 437 | | # non-zero status which is not a problem. |
| 438 | | if make -q -f standard/deps $1; then |
| | 446 | # If "make" doesn't understand the -q option (although we require |
| | 447 | # GNU make, which supports it), it should exit with a non-zero status |
| | 448 | # which is not a problem. |
| | 449 | if ${MAKE:-make} -q -f standard/deps $1; then |
| 439 | 450 | echo "Nothing to (re)build / all up-to-date." |
| 440 | 451 | exit 0 |
| 441 | 452 | fi |
| 442 | 453 | |
| 443 | | |
| 444 | 454 | # Dump environment for debugging purposes: |
| 445 | 455 | echo "*** ALL ENVIRONMENT VARIABLES BEFORE BUILD: ***" |
| 446 | | env |
| | 456 | env | sort |
| 447 | 457 | echo "***********************************************" |
| 448 | 458 | |
| 449 | | |
| 450 | 459 | ############################################################################### |
| 451 | 460 | # NOW do the actual build: |
| 452 | 461 | ############################################################################### |
| 453 | | if [ "$SAGE_PARALLEL_SPKG_BUILD" = "yes" ] && [ -n "$MAKE" ]; then |
| 454 | | time $MAKE -f standard/deps $1 |
| 455 | | else |
| 456 | | time make -f standard/deps $1 |
| 457 | | fi |
| | 462 | time ${MAKE:-make} -f standard/deps $1 |
| 458 | 463 | |
| 459 | | # added by Burcin Erocal, see trac #6295. |
| | 464 | # Added by Burcin Erocal, see trac #6295: |
| 460 | 465 | if [ $? -ne 0 ]; then |
| 461 | | echo "Error building Sage." |
| | 466 | echo >&2 "Error building Sage." |
| 462 | 467 | exit 1 |
| 463 | 468 | fi |
| 464 | 469 | |
| 465 | 470 | cd "$SAGE_ROOT" |
| 466 | 471 | |
| 467 | | # Rename makefile to Makefile (see #10156) |
| | 472 | # Rename makefile to Makefile (see #10156): |
| 468 | 473 | if [ -f makefile ]; then |
| 469 | 474 | mv makefile Makefile |
| 470 | 475 | if [ $? -ne 0 ]; then |
| … |
… |
if [ -f makefile ]; then |
| 473 | 478 | fi |
| 474 | 479 | fi |
| 475 | 480 | |
| 476 | | # build succeeded |
| 477 | | if [ "$1" = "all" ]; then |
| 478 | | echo "To install gap, gp, singular, etc., scripts" |
| 479 | | echo "in a standard bin directory, start sage and" |
| 480 | | echo "type something like" |
| 481 | | echo " sage: install_scripts('/usr/local/bin')" |
| 482 | | echo "at the Sage command prompt." |
| 483 | | echo "" |
| 484 | | echo "To build the documentation, run" |
| 485 | | echo " make doc" |
| 486 | | echo "" |
| 487 | | fi |
| 488 | | |
| | 481 | # Build succeeded. |
| 489 | 482 | echo "Sage build/upgrade complete!" |
| 490 | 483 | |
| | 484 | if [ "$1" = "all" ]; then |
| | 485 | echo |
| | 486 | echo "To install small scripts to directly run Sage's versions of GAP," |
| | 487 | echo "the PARI/GP interpreter, Maxima, or Singular etc. (by typing e.g." |
| | 488 | echo "just 'gap' or 'gp') into a standard 'bin' directory, start Sage" |
| | 489 | echo "by typing 'sage' (or './sage') and enter something like" |
| | 490 | echo |
| | 491 | echo " install_scripts('/usr/local/bin')" |
| | 492 | echo |
| | 493 | echo "at the Sage command prompt ('sage:')." |
| | 494 | echo |
| | 495 | echo "If you issued 'make', 'make all', or a similar command, then the" |
| | 496 | echo "HTML version of the documentation will be built right now." |
| | 497 | echo "Otherwise, if you want to (re)build the HTML documentation," |
| | 498 | echo "run 'make doc'. To build the PDF version, run 'make doc-pdf'." |
| | 499 | echo |
| | 500 | fi |
diff --git a/spkg/standard/deps b/spkg/standard/deps
|
a
|
b
|
SAGE_SPKG = sage-spkg $${SAGE_SPKG_OPTS} |
| 9 | 9 | INSTALL = $(SAGE_ROOT)/spkg/pipestatus |
| 10 | 10 | |
| 11 | 11 | ############################################################################### |
| | 12 | # The file parallel_make.cfg is either empty (build in parallel) or |
| | 13 | # contains ".NOTPARALLEL:" (build serially). This file is written |
| | 14 | # by spkg/install. This setting has no effect on sub-makes -- it |
| | 15 | # only determines whether more than one spkg may be built at a time. |
| | 16 | ############################################################################### |
| | 17 | include $(SAGE_ROOT)/spkg/parallel_make.cfg |
| | 18 | |
| | 19 | ############################################################################### |
| 12 | 20 | # The base system; required in order to run sage-spkg |
| 13 | 21 | ############################################################################### |
| 14 | 22 | BASE = $(INST)/$(PREREQ) $(INST)/$(DIR) $(INST)/$(SAGE_BZIP2) |