Simon, This is very useful example and explanation. Thank you very, very much. The icing on the cake would be some guidelines how to set up the number of threads. R source code uses global variable R_num_math_threads. Can we use that? Or each openmp-enabled R package would have it's own mechanism?
Related question: I was trying to find out if R_num_math_threads could be set up by a user and I found this line in the ./src/main/names.c file: {"setNumMathThreads", do_setnumthreads, 0, 11, 1, {PP_FUNCALL, PREC_FN, 0}} It suppose to be a function name but all I get in R command line is: Error: could not find function "setNumMathThreads" Any thoughts? Thank you Regards -- View this message in context: http://r.789695.n4.nabble.com/How-to-safely-use-OpenMP-pragma-inside-a-C-function-tp3777036p3782073.html Sent from the R devel mailing list archive at Nabble.com. ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel