r - snow, inline & Rcpp: -


i've written function in rcpp , compiled inline. now, want run in parallel on different cores, i'm getting strange error. here's minimal example, function funcpp1 can compiled , runs itself, cannot called snow's clustercall function. function runs single process, gives following error when ran in parallel:

error in checkforremoteerrors(lapply(cl, recvresult)) :    2 nodes produced errors; first error: null value passed symbol address 

and here code:

## load , compile library(inline) library(rcpp) library(snow) src1 <- '      rcpp::numericmatrix xbem(xbe);      int nrows = xbem.nrow();      rcpp::numericvector gv(g);      (int = 1; < nrows; i++) {       xbem(i,_) = xbem(i-1,_) * gv[0] + xbem(i,_);      }      return xbem; ' funcpp1 <- cxxfunction(signature(xbe = "numeric", g="numeric"),body = src1, plugin="rcpp")  ## single process <- matrix(rnorm(400), 20,20) funcpp1(a, 0.5)  ## parallel cl <- makecluster(2, type = "sock")  clusterexport(cl, 'funcpp1')  clustercall(cl, funcpp1, a, 0.5) 

think through -- inline do? creates c/c++ function you, compiles , links dynamically-loadable shared library. 1 sit? in r's temp directory.

so tried right thing shipping r frontend calling shared library other process (which has temp directory !!), not dll / file there.

hence advice create local package, install , have both snow processes load , call it.

(and always: better quality answers may had on rcpp-devel list read more rcpp constributors is.)


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -