[Rd] Multithreaded code in .Call interface

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Oct 13 10:57:22 CEST 2012


On 13/10/2012 08:09, Rob Anderson wrote:
> Hi,
>
> I was wondering if it is safe to call R functions and/or R BLAS functions
> from within multithreaded C/C++ code(.Call interface)? It is not in case
> with MATLAB. I was experimenting  using pthreads and OpenMP.

Not unless it is documented to be so.  (I believe the internal BLAS to 
be fine, but you could use an external one: although with care if that 
also uses threads.)

See also §8.1.5 of 'Writing R Extensions'.

> Thanks,
> Rob


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list