So I have 2 custom Rcpp functions CustFunc1(x,y)
and CustFunc2(a,b)
. Both are computationally demanding (thus the c++). My question is there a way in R to run the concurrently with the dopar package? Or can I do a system call to directly access the cpp code and try to do parallel via some command line tools?
Right now the flow is:
result1=CustFunc(x,y) ##Takes 20 minutes
result2=CustFunc(a,b) ## Take 20 minutes
get_both <- function(x) {
foreach(i = seq_along(x)) %dopar% {
result1=CustFunc(x,y)
result2=CustFunc(a,b)
}
}
get_both$result1 == result1 #???
get_both$result2 == result2 ##??