[Rd] Running two R instances at the same time

Peter Juhasz peter.juhasz83 at gmail.com
Mon Sep 7 17:36:38 CEST 2009


On Mon, Sep 7, 2009 at 4:47 PM, Andrew Piskorski<atp at piskorski.com> wrote:
> On Sat, Sep 05, 2009 at 08:31:18PM +0200, Peter Juhasz wrote:
>
>> I don't understand how is this possible. Maybe there is an issue of
>> thread-safety with the R backend, meaning that the two R *interpreter*
>> instances are talking to the same backend that's capable of processing
>> only one thing at a time?
>
> No.  Particularly since there is no R "backend" involved at all, not
> if you're starting up the standard R from Ubuntu 9.04 (rather than
> Rserve or something else unusual).  People run multiple R processes
> concurrently on the same (multi-core) machine all the time, works
> fine.
>
>> Please see http://www.perlmonks.org/?node_id=792460 for an extended
>> discussion of the problem, and especially
>> http://www.perlmonks.org/?node_id=793506 for excerpts of output and
>> actual code.
>
> The most likely explanation seems to be that you have a bug in your
> Perl code.  Have you tried using your Perl framework to fork something
> OTHER than R?  Have you tried manually starting up two R processes and
> running your R code that way?  And, what is the actual R code you're
> running?  You don't seem to have shown it anywhere.
>
> --
> Andrew Piskorski <atp at piskorski.com>
> http://www.piskorski.com/
>

Actually, I have ran some tests that clarified the issue somewhat.

- It is always possible that my Perl code is buggy but that doesn't
seem to play a role in this case.
- I tried to use my Perl system to start two non-R processes - it
worked as expected, they ran concurrently without ill effects.

But please see http://www.perlmonks.org/index.pl?node_id=793907 ,
where I posted my R code in its simplest form along with an example
run which exhibits the symptoms I originally wrote about.

>From that test I conclude that it is not my Perl code nor R itself
that is wrong here, but the specific package I use. That package -
NADA, from which I use the 'cenros' command - seems to be the culprit.

Please forgive my complete lack of experience when it comes to R, this
made me assume things that didn't make sense.

Péter Juhász



More information about the R-devel mailing list