File tree 3 files changed +39
-7
lines changed
3 files changed +39
-7
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,10 @@ set -x -e
11
11
# find pyscf/lib/deps -name "*cint*" -exec rm {} \+
12
12
# rm pyscf-2.0-depsa-openblas.tar.gz
13
13
14
+ # C extensions must be installed with sequential BLAS library
15
+ # https://pyscf.org/install.html#using-optimized-blas
16
+ export CMAKE_CONFIGURE_ARGS=" -DWITH_F12=OFF -DBLA_VENDOR=Intel10_64lp_seq"
17
+
14
18
# env PYTHON not defined in certain conda-build version
15
19
# $PYTHON -m pip install . -vv
16
- export CMAKE_CONFIGURE_ARGS=" -DWITH_F12=OFF"
17
20
pip install -v --prefix=$PREFIX .
Original file line number Diff line number Diff line change 39
39
40
40
import os
41
41
import sys
42
- # Avoid too many threads being created in OMP loops.
43
- # See issue https://github.com/pyscf/pyscf/issues/317
44
- if 'OPENBLAS_NUM_THREADS' not in os .environ :
45
- os .environ ['OPENBLAS_NUM_THREADS' ] = '1'
46
- if 'MKL_NUM_THREADS' not in os .environ :
47
- os .environ ['MKL_NUM_THREADS' ] = '1'
48
42
49
43
# Load modules which are developed as plugins of the namespace package
50
44
PYSCF_EXT_PATH = os .getenv ('PYSCF_EXT_PATH' )
Original file line number Diff line number Diff line change 37
37
except ImportError :
38
38
ThreadPoolExecutor = None
39
39
40
+ if sys .platform .startswith ('linux' ):
41
+ # Avoid too many threads being created in OMP loops.
42
+ # See issue https://github.com/pyscf/pyscf/issues/317
43
+ try :
44
+ from elftools .elf .elffile import ELFFile
45
+ except ImportError :
46
+ pass
47
+ else :
48
+ def _ldd (so_file ):
49
+ libs = []
50
+ with open (so_file , 'rb' ) as f :
51
+ elf = ELFFile (f )
52
+ for seg in elf .iter_segments ():
53
+ if seg .header .p_type != 'PT_DYNAMIC' :
54
+ continue
55
+ for t in seg .iter_tags ():
56
+ if t .entry .d_tag == 'DT_NEEDED' :
57
+ libs .append (t .needed )
58
+ break
59
+ return libs
60
+
61
+ so_file = os .path .abspath (os .path .join (__file__ , '..' , 'libnp_helper.so' ))
62
+ for p in _ldd (so_file ):
63
+ if 'mkl' in p and 'thread' in p :
64
+ warnings .warn (f'PySCF C exteions are incompatible with { p } . '
65
+ 'MKL_NUM_THREADS is set to 1' )
66
+ os .environ ['MKL_NUM_THREADS' ] = '1'
67
+ break
68
+ elif 'openblasp' in p or 'openblaso' in p :
69
+ warnings .warn (f'PySCF C exteions are incompatible with { p } . '
70
+ 'OPENBLAS_NUM_THREADS is set to 1' )
71
+ os .environ ['OPENBLAS_NUM_THREADS' ] = '1'
72
+ break
73
+ del p , so_file , _ldd
74
+
40
75
from pyscf .lib import param
41
76
from pyscf import __config__
42
77
You can’t perform that action at this time.
0 commit comments