Re: [Rd] OpenMP and random number generation

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Wed, 22 Feb 2012 12:23:54 +0000

On 22/02/2012 08:23, Mathieu Ribatet wrote:
> Dear all,
>
> Now that R has OpenMP facilities,

Hmm, not exactly new.

> I'm trying to use it for my own package but I'm still wondering if it
is safe to use random number generation within a OpenMP block. I looked at the R writing extension document both on the OpenMP and Random number generation but didn't find any information about that.
>
> Could someone tell me if it is safe or not please ?

Using threads in compiled code called from R (e.g. pthreads or OpenMP) is 'for experts only': we do not document which parts of R are or are not thread-safe except via making the sources available. If you need to ask then it is not safe for you, and in particular it would be unsafe to call Get/PutRNGstate.

> Best,
> Mathieu
>
> -----------------------------------------------------------------
> I3M, UMR CNRS 5149
> Universite Montpellier II,
> 4 place Eugene Bataillon
> 34095 Montpellier cedex 5 France
> http://www.math.univ-montp2.fr/~ribatet
> Tel: + 33 (0)4 67 14 41 98

-- 
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

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 22 Feb 2012 - 12:27:59 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 Wed 22 Feb 2012 - 15:10:20 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