I got tons of warning from openBLAS like
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.
Here is what my src/Makevars file looks like
PKG_CPPFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
And here is my header file:
#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 is used in my code like this
#pragma omp parallel for num_threads(n_threads) schedule(dynamic) private(W, mu)
for (unsigned int j = 0; j < m; j++)
where n_threads
is passed via function argument. Everything is fine when n_threads = 1
but got the above warnings when n_threads = 2
.
A complete code can be found here, which depends on other files as well (sorry I cannot paste here as it is a bit long).
I tried adding USE_OPENMP=1
to src/Makevars, but it does not work. Any body has a solution? Thank you!