[R-pkg-devel] multithreading in packages

Gábor Csárdi c@@rd|@g@bor @end|ng |rom gm@||@com
Sat Oct 9 14:24:12 CEST 2021


On Sat, Oct 9, 2021 at 8:52 AM Ivan Krylov <krylov.r00t using gmail.com> wrote:
[...]
> >    * pthread or openmp ? I am particularly concerned about
> > interaction with other packages. I have seen that using pthread and
> > openmp libraries simultaneously can result in incorrectly pinned
> > threads.
>
> pthreads-based code could be harder to run on Windows (which is a
> first-class platform for R, expected to be supported by most packages).

R uses mingw on windows, and mingw supports pthreads, you don't need
to do anything special on Windows. You don't even need a
`Makevars`/`Makevars.win` or configure* file just for using pthreads.

Some CRAN packages do this, you can search here:
https://github.com/search?l=C&p=5&q=org%3Acran+pthread_create&type=Code
(Some of these are from Unix-specific code, but not all.)

Gabor

[...]



More information about the R-package-devel mailing list