0

I am trying to optimize a Rcpp function parallely using the R package "optimParallel". But I am getting the error:

Error in checkForRemoteErrors(val) : 3 nodes produced errors; first error: object 'Likelihood' not found

Now, the function "Likelihood" is written in C++ and exported to R via "Rcpp". I found in this link: parallelize Own Package in R

that I have to define the function in R global environment, which I did. But it did not solve the problem. I did not write the C++ code here as it is too complex.

gultu
  • 143
  • 10
  • 1
    It's a FAQ. Just scroll back a few questions under the Rcpp tag as we had it recently. You are too optimistic in thinking that your in-session compiled function magically travels to all other processes. – Dirk Eddelbuettel Apr 09 '19 at 14:40
  • @DirkEddelbuettel I saw your link which you think can answer my question. I want to know how to define my code as an object; while the code calls another code (which is basically an integration in C++, so has a functor defined prior defining the integration function) . – gultu Apr 09 '19 at 22:27
  • 1
    As we say in those previous answers: write a package around that function, have the package loaded by each worker. There is no other good way. – Dirk Eddelbuettel Apr 09 '19 at 22:29
  • @DirkEddelbuettel; making package following the steps in this link: https://support.rstudio.com/hc/en-us/articles/200486088-Using-Rcpp-with-RStudio ? – gultu Apr 09 '19 at 22:31

0 Answers0