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 Makevar
file 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?