[R] How to put inlined C code on a worker node?

Jeff Newmiller jdnewmil at dcn.davis.CA.us
Fri Nov 14 19:04:09 CET 2014


Repeating yourself verbatim is poor form. At least quote your previous message and indicate that this is a reprise.

While I doubt that my opinion is universal, I think that mixing C and R in the same file is already living on the edge of good practice. You are assuming that all of your nodes have the infrastructure to compile your code on the fly, which is something you have to insure for each node in your facilities. A less convenient but more conventional approach is to create your own support package(s) that contain the compiled portions of your code and distribute them prior to running your application.

However, this conversation might be more productive if conducted between you and the maintainer of the inline package (see ?maintainer) or on the R-devel list because it is outside the R language.

---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.

On November 14, 2014 7:42:01 AM PST, Mikhail Umorin <mikeumo at gmail.com> wrote:
>Hello —
>
>I am using inline C functions within foreach %dopar% loop. On SMP
>(doParallel, doMP) it works but on MPI-based clusters (doMPI) it
>does’t. The reason, I think, is because the object code produced using
>the inline package, essentially an .so file, does not get copied onto
>the worker nodes when they are spawned using startMPIcluster().
>
>Does anyone have any ideas on how I can send the object code to the
>workers and re-link it to the inline functions, or some other way? I
>know that I can define the inline functions within the foreach loop but
>it is very limiting and does not look pretty when you have a lot of
>functions to define. So, is there I way that follows a good programming
>style?
>
>I would prefer to do it from within the R script and use the “spawning”
>mode to paralellize.
>
>Thank you for your time, 
>
>Mikhail.
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list