[Rcpp-devel] RInside and MPI master slave model proper usage

Dirk Eddelbuettel edd at debian.org
Sun Jan 20 03:32:24 CET 2013


On 19 January 2013 at 18:50, Nicholas Pezolano wrote:
| I posted a example code with the problem here http://pastebin.com/SCrqcp83
| 
| The example makefile from the /mpi folder compiles the code with out issue and
| runs when the line 153  R.parseEvalQ(R_libs); is commented out.
| 
| http://pastebin.com/SCrqcp83

I glanced at your code.  What follows is an educated guess, not a full test.

You initialize RInsinde in main(). That is correct.  

You initialize RInside again in slave(). That is not good.  This is related
to how we have to pass reference to the _one_ R instance around when we have
a GUI (the Qt example) or webapp (the Wt example).  Even though those
frameworks are multithreaded and can respond to multiple events, R is not
multithreaded or even re-entrant. You have to be careful how you "talk" to it
as there can only be one context for R or else bad things happen.

I added some reference and pointer instance callbacks to get to the one
per-process singleton RInside instance.  If you use that, things may work.

Again, this is just an educated guess at this point.

Good luck,  Dirk

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


More information about the Rcpp-devel mailing list