[R-pkg-devel] multithreading in packages
Vladimir Dergachev
vo|ody@ @end|ng |rom m|nd@pr|ng@com
Sat Oct 9 16:56:16 CEST 2021
On Sat, 9 Oct 2021, Gábor Csárdi wrote:
> 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.
Great, thank you !
>
> 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.)
Useful link ! I also did a search for cran+omp and this turned up some
packages as well.
Looks like both openmp and pthreads are used in packages that passed CRAN
checks.
thanks
Vladimir Dergachev
>
> Gabor
>
> [...]
>
More information about the R-package-devel
mailing list