Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Merge commit '4b11a706e1267b385099d8691b4468efd974f94d' of git://trac…
Browse files Browse the repository at this point in the history
….sagemath.org/sage into t/27754/public/python3.8
  • Loading branch information
Matthias Koeppe committed Aug 30, 2020
2 parents b9d451c + 4b11a70 commit a9b6965
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
7 changes: 7 additions & 0 deletions build/bin/sage-site
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ if [ "$1" = "-docbuild" -o "$1" = "--docbuild" ]; then
# cause the build to hang. If stdin is /dev/null, TeX just aborts.
shift
export LANG=C # to ensure it is possible to scrape out non-EN locale warnings

# See #30351: bugs in macOS implementations of openblas/libgopm can cause
# docbuild to hang if multiple OpenMP threads are allowed.
if [ `uname` = 'Darwin' ]; then
export OMP_NUM_THREADS=1
fi

exec sage-python -m sage_setup.docbuild "$@" </dev/null
fi

Expand Down
9 changes: 6 additions & 3 deletions src/bin/sage-runtests
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,13 @@ if __name__ == "__main__":
# cause us to run out of physical memory, leading to system
# instability (as opposed to virtual memory allocs failing)
options.memlimit = -1

# Limit the number of threads to 2 to save system resources.
# See Trac #23713 and #23892
os.environ["OMP_NUM_THREADS"] = "2"
# See Trac #23713, #23892, #30351
if sys.platform == 'darwin':
os.environ["OMP_NUM_THREADS"] = "1"
else:
os.environ["OMP_NUM_THREADS"] = "2"

os.environ["SAGE_NUM_THREADS"] = "2"

from sage.doctest.control import DocTestController
Expand Down
6 changes: 3 additions & 3 deletions src/sage_setup/docbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ def build_many(target, args, processes=None):
...
WorkerDiedException: worker for 4 died with non-zero exit code -9
"""
import multiprocessing
from multiprocessing import Process, Queue, cpu_count, set_start_method
# With OS X, Python 3.8 defaults to use 'spawn' instead of 'fork'
# in multiprocessing, and Sage docbuilding doesn't work with
# 'spawn'. See trac #27754.
if os.uname().sysname == 'Darwin':
multiprocessing.set_start_method('fork', force=True)
from six.moves.queue import Empty
set_start_method('fork', force=True)
from queue import Empty

if processes is None:
processes = multiprocessing.cpu_count()
Expand Down

0 comments on commit a9b6965

Please sign in to comment.