From pawel.matykiewicz at gmail.com  Wed Aug 31 22:46:06 2011
From: pawel.matykiewicz at gmail.com (pawelm)
Date: Wed, 31 Aug 2011 13:46:06 -0700 (PDT)
Subject: [Rd] How to safely using OpenMP pragma inside a .C() function?
In-Reply-To: <1314821163584-3782073.post@n4.nabble.com>
References: <1314643732236-3777036.post@n4.nabble.com>
	<B2571962-7567-4F59-A1CB-415088594F47@r-project.org>
	<1314705201298-3778482.post@n4.nabble.com>
	<1314723468677-3779214.post@n4.nabble.com>
	<798B5A8C-40DD-4BFD-B02A-45950F94EAF4@r-project.org>
	<1314821163584-3782073.post@n4.nabble.com>
Message-ID: <1314823566871-3782178.post@n4.nabble.com>

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.



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