I posted a example code with the problem here <a href="http://pastebin.com/SCrqcp83">http://pastebin.com/SCrqcp83</a><div><br><div>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.<div>
<br></div><div><a href="http://pastebin.com/SCrqcp83">http://pastebin.com/SCrqcp83</a><br><br><div class="gmail_quote">On Sat, Jan 19, 2013 at 5:52 PM, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On 19 January 2013 at 17:44, Nicholas Pezolano wrote:<br>
| Maybe I did not describe my question/problem clearly,<br>
|<br>
| I've seen the examples and you would call <br>
|<br>
| RInside R(int argc, int argv); after int main and mpi_init, and all nodes<br>
| should have an embedded R instance.<br>
<br>
</div>It works with MPI, and hence works the other way around.<br>
<br>
A controller/master node lauches all the worker nodes. Then __each worker<br>
node launches its own R instance via RInside__.<br>
<br>
How you get data and programs there is up for you. I like packages for many<br>
reasons, they work here too.<br>
<br>
And sorry, I am in the middle of a few other things and cannot debug what you<br>
have described in what is after all incomplete (or I missed it) and not<br>
reproducible.<br>
<span class="HOEnZb"><font color="#888888"><br>
Dirk<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
| However the problem with using MPI and RInside in the above master slave model<br>
| is the RInside objects/R instance will not be callable from the do_work<br>
| function. <br>
|<br>
| for instance the following code snippet works in the examples with mpi but<br>
| produces an error when used in a function or with the master slave model.<br>
|<br>
| do_work(.......){<br>
|<br>
| R["data"] = data;<br>
| R.parseEvalQ();<br>
| R.parseEvalQ(garch);<br>
|<br>
| }<br>
|<br>
| test.cpp: In function ‘void do_work(std::string, int&)’:<br>
| test.cpp:278:4: error: expected primary-expression before ‘[’ token<br>
| test.cpp:279:4: error: expected primary-expression before ‘.’ token<br>
| test.cpp:280:4: error: expected primary-expression before ‘.’ token<br>
|<br>
| The error is because the function doesn't have access to the the R object<br>
|<br>
|<br>
| On Sat, Jan 19, 2013 at 5:14 PM, Dirk Eddelbuettel <<a href="mailto:edd@debian.org">edd@debian.org</a>> wrote:<br>
|<br>
|<br>
| On 19 January 2013 at 16:29, Nicholas Pezolano wrote:<br>
| | Hi I'm using Rinside with MPI and testing out a simple master slave<br>
| model.<br>
| |<br>
| | heres a basic example of what i'm trying to do.<br>
| | <a href="http://www.lam-mpi.org/tutorials/one-step/ezstart.php" target="_blank">http://www.lam-mpi.org/tutorials/one-step/ezstart.php</a><br>
| |<br>
| | The function do_work(unit_of_work_t work){ ..... gets run across all<br>
| the<br>
| | N nodes until the M units of work are done. <br>
| | I am calling many R functions from C++, as well as loading R<br>
| libraries,<br>
| | in the do_work function.<br>
| |<br>
| | Is there a way to load R once on each of the slaves and have the do_work<br>
| | function have access to RInside for every iteration of the master-slave<br>
| model?<br>
| |<br>
| | Do I have to run RInside R(argc, argv); for<br>
| every-time<br>
| | the function do_work is called by the master?<br>
| |<br>
| | Is there a way to free the R instance or is this handled automatically?<br>
| or is<br>
| | there a better approach?<br>
|<br>
| Do you know that there is a working example, contributed in the early days<br>
| by<br>
| Jianping Hua?<br>
|<br>
| All this assumes that you are a tad familiar with basic MPI. The model used<br>
| here uses straight MPI from C (or C++), and each (worker/slave) node just<br>
| happens to do its work with R.<br>
|<br>
| There are other models, notably Rmpi and you are not forced to use RInside<br>
| in<br>
| order to deploy MPI with R. If you have basic questions, r-sig-hpc may be<br>
| a<br>
| better place.<br>
|<br>
| Dirk<br>
|<br>
|<br>
|<br>
| --<br>
| Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
|<br>
|<br>
|<br>
|<br>
| --<br>
| Nicholas Pezolano<br>
| Department of Applied Math & Statistics<br>
| State University of New York at Stony Brook<br>
|<br>
<br>
--<br>
Dirk Eddelbuettel | <a href="mailto:edd@debian.org">edd@debian.org</a> | <a href="http://dirk.eddelbuettel.com" target="_blank">http://dirk.eddelbuettel.com</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Nicholas Pezolano</div><div>Cell - 1-516-815-6024</div><div>Department of Applied Math & Statistics<br>State University of New York at Stony Brook</div>
<div><a href="http://hpcadvisorycouncil.com/events/2012/ISC12-Student-Cluster-Competition/team_stony_brook.php" target="_blank">ISC'12 Super Computing Competition Stony Brook Team</a></div>
</div></div></div>