Temporarily allow MKL/OPENBLAS threading?
See original GitHub issueI noticed this Issue #317 and its associated fix: https://github.com/pyscf/pyscf/blob/e064645ee08728c64412ed9bc8e7ffe45fc8e1f4/pyscf/__init__.py#L42
Suppresses MKL and OPENBLAS threading for the entire pyscf calculation. With @hongzhouye’s RSDF (#1034) speedup over GDF, calls to scipy solve_triangular
become a bottleneck in the process, e.g. https://github.com/pyscf/pyscf/blob/8a4d973aeab9f7f3adb08cf1d15ba73a05fc7c17/pyscf/pbc/df/df.py#L362 which appears to be single threaded due to the aforementioned setting.
I wonder if there is a way to temporarily allow BLAS/LAPACK multithreading for these calls to solve_triangular
? They only show in df modules.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
OpenBLAS set number of threads for one routine only
While this works, it sets the openblas num threads globally, preventing each subroutines to use a different number of threads when running in ......
Read more >Multithreading · ITensors.jl - JuliaHub
Enable or disable block sparse multithreading. In addition, we have found that it is best to disable BLAS and Strided multithreading when using ......
Read more >changelog file - OpenBLAS
A new compile-time option USE_TLS has been added to enable the new code, and it is hoped that ... (d744c9) * Improved cblas.h...
Read more >BLAS performance testing for Julia 1.8
Let OpenBLAS detect the number of threads on startup, which is usually Sys.CPU_THREADS. With Julia master on a 20 core box (40 hyperthreads),...
Read more >Speedup by using external BLAS/LAPACK with CmdStan and ...
e.g. OpenBLAS and Intel MKL can use more than one thread also for BLAS/LAPACK. You can set the number of threads with environment...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@btglau I’m 99% sure
scipy.linalg.solve_triangular
should not be parallelized across threads. That function calls the LAPACK functiontrtrs
, see the SciPy source here: https://github.com/scipy/scipy/blob/47bb6febaa10658c72962b9615d5d5aa2513fa3a/scipy/linalg/basic.py#L349.The MKL docs don’t list
trtrs
as a function that’s parallelized with threads. I’ve tried out usingscipy.linalg.solve_triangular
on it’s own (with MKL and several OpenBLAS versions as the SciPy backend) and none show threading dependence while other methods likescipy.linalg.solve
do (see the mini-benchmark here).You may try the threadpoolctl package, which allows to set BLAS threading dynamically.