1

I have done my first project in Rcpp recently. I prepared a Rcpp source code (say code_1) which works fine in my case, then I used Openmp to speed up the running time and it gives me the second code (say code_2) which works faster. But when I built my package by using the second code, I saw that the running time is same as code_1. In my package, I have protected any reference to OpenMP by using the following structure for header and also related portions of the code:

#ifdef _OPENMP
// related commands
#endif

Indeed, I modified the Makevarfile as below according to this link R package with C/C++ and openMP: how to make "Makevars" file under "mypackage/src/" folder?:

PKG_LIBS = $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)$(SHLIB_OPENMP_CFLAGS)
PKG_CFLAGS = $(SHLIB_OPENMP_CFLAGS)

I don't know how I can decrease the running time in the package similar to my second source code. Who has any experience in this case?

Community
  • 1
  • 1
Jmath
  • 53
  • 4
  • @coatless I have modified my makevars file by using your mentioned link and especially by using the answer by Dirk Eddelbuettel – Jmath Apr 07 '17 at 21:37

0 Answers0