Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit fcd5164

Browse files
committed
MAINT: set OPENBLAS_THREAD_TIMEOUT on arm64 macOS to avoid performance issues
Addresses at least part of scipy/scipy#15050, TBD if that closes it or if we need to rebuild OpenBLAS instead later. For now (and for the 1.7.3 release) this is the safest and quickest improvement.
1 parent d94b566 commit fcd5164

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

_distributor_init.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,14 @@
1010
"""
1111

1212
import os
13+
import sys
14+
import platform
15+
1316

14-
# on Windows SciPy loads important DLLs
15-
# and the code below aims to alleviate issues with DLL
16-
# path resolution portability with an absolute path DLL load
1717
if os.name == 'nt':
18+
# on Windows SciPy loads important DLLs
19+
# and the code below aims to alleviate issues with DLL
20+
# path resolution portability with an absolute path DLL load
1821
from ctypes import WinDLL
1922
import glob
2023
# convention for storing / loading the DLL from
@@ -61,3 +64,9 @@
6164
WinDLL(os.path.abspath(filename))
6265
finally:
6366
os.chdir(owd)
67+
elif sys.platform == 'darwin' and platform.machine() == 'arm64':
68+
# On arm64 macOS the OpenBLAS runtimes of NumPy and SciPy don't seem to work
69+
# well together unless this timeout limit is set - it results in very slow
70+
# performance for some linalg functionality.
71+
# See https://github.com/scipy/scipy/issues/15050 for details.
72+
os.environ['OPENBLAS_THREAD_TIMEOUT'] = '1'

0 commit comments

Comments
 (0)