<div dir="ltr"><div>Dear Rcpp developers,</div><div><br></div><div> I'm trying to parallelize some of my algorithms but I have encountered</div><div>the following problem: </div><div><br></div><div># I have a cppFunction</div>
<div>cppFunction(' double inner_Cpp(double a){ return 1;  } ')</div><div><br></div><div># And an R wrapper around it</div><div>wrapper_R<- function(input)</div><div>{</div><div>  inner_Cpp(input)</div><div>}</div>
<div><br></div><div># And I want to call the wrappen in parallel within algorithm</div><div>algo <- function(input)</div><div>{</div><div>  cl <- makeCluster(2)</div><div>  clusterExport(cl, "inner_Cpp")</div>
<div>  a <- clusterApply(cl, 1:2, wrapper_R)</div><div>  stopCluster(cl)</div><div>  </div><div>  a</div><div>}</div><div><br></div><div>algo(2)</div><div><br></div><div>Error in checkForRemoteErrors(val) : </div><div>
  2 nodes produced errors; first error: NULL value passed as symbol address</div><div><br></div><div>It seems that I'm unable to find the address of inner_Cpp.</div><div>If the inner function is an R function there is no problem:</div>
<div><br></div><div>inner_R <- function(input) 1</div><div><br></div><div>wrapper_R<- function(input)</div><div>{</div><div>  inner_R(input)</div><div>}</div><div><br></div><div>algo <- function(input)</div><div>
{</div><div>  cl <- makeCluster(2)</div><div>  clusterExport(cl, "inner_R")</div><div>  </div><div>  a <- clusterApply(cl, 1:2, wrapper_R)</div><div>  </div><div>  stopCluster(cl)</div><div>  </div><div>  a</div>
<div>}</div><div><br></div><div>algo(2)</div><div><br></div><div>[[1]]</div><div>[1] 1</div><div><br></div><div>[[2]]</div><div>[1] 1</div><div><br></div><div>Do you have any idea about why this is happening?</div><div>Given that I have just started parallelizing my algorithms in this</div>
<div>way, any suggestion/criticism about the overall approach is </div><div>more then welcome!</div><div><br></div><div>Matteo</div></div>