I just found this (performance improvement of the "dist" function when using openmp):
.Internal(setMaxNumMathThreads(1)); .Internal(setNumMathThreads(1)); m <- matrix(rnorm(810000),900,900); system.time(d <- dist(m)) user system elapsed 3.510 0.013 3.524 .Internal(setMaxNumMathThreads(5)); .Internal(setNumMathThreads(5)); m <- matrix(rnorm(810000),900,900); system.time(d <- dist(m)); user system elapsed 3.536 0.007 1.321 Works great! Just the question stays if it's a good practice to use "R_num_math_threads" in external packages? Thanks -- View this message in context: http://r.789695.n4.nabble.com/How-to-safely-use-OpenMP-pragma-inside-a-C-function-tp3777036p3782178.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