From csardi.gabor at gmail.com  Sun Feb  1 01:29:48 2015
From: csardi.gabor at gmail.com (=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=)
Date: Sat, 31 Jan 2015 19:29:48 -0500
Subject: [Rd] invoking R function in C++ in parallel
In-Reply-To: <21709.28119.188963.170738@max.nulle.part>
References: <CAFLer83nzRs1cV7Cpu7VWUEDrqaSC7kjrUBbMUHzaFAp97DQGA@mail.gmail.com>
	<21709.28119.188963.170738@max.nulle.part>
Message-ID: <CABtg=K=oxOB_w8-baCvS5SN+OkMR0k0KHGjwLT5HeTnDZqhrNw@mail.gmail.com>

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



[Rd] invoking R function in C++ in parallel
=?UTF-8?B?R8OhYm9yIENzw6FyZGk=?=