[R-sig-hpc] openmp C functions in R
luke at stat.uiowa.edu
luke at stat.uiowa.edu
Fri Apr 2 20:08:58 CEST 2010
You could check out how I handle this in the pnmath package at
http://www.stat.uiowa.edu/~luke/R/experimental/pnmath_0.0-3.tar.gz
luke
On Thu, 1 Apr 2010, Carl Boettiger wrote:
> Dear R-sig-hpc,
>
> I have a C function that uses openmp for parallelization on shared memory
> architecture. I have a Makevars file in the src directory which specifies
> the the -fopenmp flag. When I run R CMD SHLIB file.c to compile my file, it
> uses the openmp flag and doesn't give any warnings. Yet when I call the
> function from R using the .C interface, it uses only one processor. If I
> compile a stand-alone version of the C code, it runs in parallel on all
> available processors. Is this the expected behavior? What is the correct
> way to adapt already parallelized C code to be callable from R?
>
> Thanks very much for your help.
> Carl
>
>
--
Luke Tierney
Chair, Statistics and Actuarial Science
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa Phone: 319-335-3386
Department of Statistics and Fax: 319-335-3017
Actuarial Science
241 Schaeffer Hall email: luke at stat.uiowa.edu
Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu
More information about the R-sig-hpc
mailing list