使用OpenMP构建OpenBLAS:无法设置OpenMP线程数

时间:2018-01-30 17:57:24

标签: python multithreading numpy openmp openblas

我试图使用OpenBLAS和OpenMP运行Numpy,但我似乎不能让OMP_NUM_THREADS来改变使用的线程数。

我使用USE_OPENMP=1从源代码编译OpenBLAS,并确认我获得了正确的构建,

OpenBLAS build complete. (BLAS CBLAS)

OS               ... Linux             
Architecture     ... x86_64               
BINARY           ... 64bit                 
C compiler       ... GCC  (command line : gcc)
Library Name     ... libopenblas_haswellp-r0.3.0.dev.a (Multi threaded; Max num-threads is 48)

Use OpenMP in the multithreading. Because of ignoring OPENBLAS_NUM_THREADS and GOTO_NUM_THREADS flags, 
you should use OMP_NUM_THREADS environment variable to control the number of threads.

我导出OMP_DYNAMIC=false,导出USE_OPENMP=1并将OMP_NUM_THREADS设置为不同的值,但没有运气。当我检查链接Numpy与OpenBLAS的库时:

$ ldd openblas/numpy/core/multiarray.so 
    linux-vdso.so.1 =>  (0x00007ffcedba9000)
    libopenblas.so.0 => /opt/openblas-OpenMP/lib/libopenblas.so.0 (0x00007f78ab9ae000)
    libm.so.6 => /lib64/libm.so.6 (0x00007f78ab6ac000)
    libpython2.7.so.1.0 => /lib64/libpython2.7.so.1.0 (0x00007f78ab2e1000)
    libgomp.so.1 => /lib64/libgomp.so.1 (0x00007f78ab0bb000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f78aae9f000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f78aaade000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f78ac350000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007f78aa8da000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007f78aa6d7000)

所以我看到 libgomp.so.1 正在链接,这意味着我已经使用OpenMP构建了Numpy。正如我所说,我将动态线程设置为false,所以我哪里出错了?我试图致电numpy.cholesky

编辑:我正在RHEL 7.3上运行

0 个答案:

没有答案