Re: [Rd] How to safely using OpenMP pragma inside a .C() function?

From: pawelm <pawel.matykiewicz_at_gmail.com>
Date: Wed, 31 Aug 2011 13:46:06 -0700 (PDT)

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_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 31 Aug 2011 - 20:49:05 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 01 Sep 2011 - 03:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive