[Rd] invoking R function in C++ in parallel

Gábor Csárdi
Sun, 01 Feb 2015 00:29:48 -0000

On Sat, Jan 31, 2015 at 7:05 PM, Dirk Eddelbuettel <edd at debian.org>
wrote:
[...]

> - either work in something like OpenMP and run in multiple threads that
>    remain /completely/ shielded from R, ie no R calls, and not even R data
>    types as you cannot trigger gc() calls from different threads
>

I think you can use R objects, as long as you don't call R functions on
them (not even from R's C api, although some of them are currently fine)
and consider them as read-only. E.g. if you have a numeric vector, you can
do
double *cvec = REAL(vec);
and then use cvec in your thread(s).

This is pretty restrictive, but could be enough in some cases.

Gabor

[...]

	[[alternative HTML version deleted]]