[Rd] Embedded R Fails When Run on LSF Queue System

Dirk Eddelbuettel edd at debian.org
Mon Nov 11 03:33:55 CET 2013


On 10 November 2013 at 21:13, Nigel Delaney wrote:
| Thanks Dirk.  I'll confess I am mostly trying to follow the practices
| outlined in the writing R-extensions manual and books by Chambers and
| Gentleman, but  have found some conflicting advice on the internet in
| various places, and am also trying to build off a previously existing code
| base (that at least worked on some
| operating-systems/architectures/scenarios, but seems to break when I move
| the program around to any new type of environment).  Will definitely
| re-write that bit.

I had it easier :)   When we started littler, Jeff had already worked out all
embedding kinks via his rApache project.  RInside is a port / rewrite of the
same logic to C++ from the C used in littler.

| Sincere thanks again.  Out of curiosity, can I ask one more question since I
| gather you have much more expertise than myself?  The extension manual has a
| somewhat obscure, to me at least, section on threading issues (8.1.5).  My
| understanding is that because the R_CStackStart is a single value, if R is
| called from multiple threads (even if never simultaneously), it is
| essentially best to just disable the stack check rather than try to re-write
| this value each time, which I gather might need to be done (and simply
| increasing the stack size of the calling thread will not help).  Is this the
| approach you have taken in your projects?  Or do you think this is also a
| bad idea?

Yep. Just a set a big fat mutex before you start multithreading, never ever
call anything that could touch R, thne release the mutex when you're done and
continue single-threaded.  I know of no other sane way.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com



More information about the R-devel mailing list