我从openBLAS那里得到了很多警告,比如
OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option. OpenBLAS Warning : Detect OpenMP Loop and this application may hang. Please rebuild the library with USE_OPENMP=1 option.
下面是我的src/Makevars文件
PKG_CPPFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)下面是我的头文件:
#define ARMA_NO_DEBUG
#ifdef _OPENMP
#include <omp.h>
#endif
//[[Rcpp::depends(RcppArmadillo)]]
#include <RcppArmadillo.h>
//[[Rcpp::depends(RcppProgress)]]
#include <progress.hpp>
#include <Rcpp.h>
#include <R.h>在我的代码中使用openMP,如下所示
#pragma omp parallel for num_threads(n_threads) schedule(dynamic) private(W, mu)
for (unsigned int j = 0; j < m; j++)其中n_threads是通过函数参数传递的。当n_threads = 1的时候一切都很好,但是当n_threads = 2的时候得到上面的警告。完整的代码可以在here找到,它也依赖于其他文件(对不起,我不能在这里粘贴,因为它有点长)。
我尝试将USE_OPENMP=1添加到src/Makevars中,但不起作用。任何人都有解决方案吗?谢谢!
发布于 2016-06-30 02:06:24
在CPU模式下运行Torch时,我收到了相同的警告。用OPEN_MP 1重建OpenBLAS为我修复了这个问题。
如果要使用OPEN_MP 1重建OpenBLAS,则:
转到您克隆OpenBLAS存储库的文件夹(对于我来说,它是/home/brt/OpenBLAS/OpenBLAS)
cd /home/brt/code/OpenBLAS/
make clean
make USE_OPENMP=1
sudo make install如果您还没有这样做,
sudo vi /etc/ld.so.conf.d/openblas.conf添加行: /opt/OpenBLAS/lib
保存并关闭
sudo ldconfig这将重新生成OpenBLAS,并将OPEN_MP设置为1
https://stackoverflow.com/questions/34578526
复制相似问题