mschubert / clustermq

R package to send function calls as jobs on LSF, SGE, Slurm, PBS/Torque, or each via SSH
https://mschubert.github.io/clustermq/
Apache License 2.0
146 stars 27 forks source link

parallel glmnet requires `.packages` in `foreach` #140

Closed Zhuk66 closed 5 years ago

Zhuk66 commented 5 years ago

The following code does not work:

library(glmnet) set.seed(1010) n=1000;p=100 nzc=trunc(p/10) x=matrix(rnorm(np),n,p) beta=rnorm(nzc) fx= x[,seq(nzc)] %% beta eps=rnorm(n)*5 y=drop(fx+eps) px=exp(fx) px=px/(1+px) ly=rbinom(n=length(px),prob=px,size=1) set.seed(1011) cvob1=cv.glmnet(x,y, parallel=T) Error in e$fun(obj, substitute(ex), parent.frame(), e$data) : foreach .packages currently not supported in clustermq 5: (function () traceback(2))() 4: stop("foreach .packages currently not supported in clustermq") 3: e$fun(obj, substitute(ex), parent.frame(), e$data) 2: foreach(i = seq(nfolds), .packages = c("glmnet")) %dopar% { which = foldid == i ... 1: cv.glmnet(x, y, parallel = T)

cv.glmnet calls foreach with .packages that is not currently supported. Can you add support for .packages?

mschubert commented 5 years ago

Yes, that's on the list and I'll add it in the next release.

Thank you for documenting this.

mschubert commented 5 years ago

@Zhuk66 This should be fixed in the latest develop, it would be great if you could test it

Zhuk66 commented 5 years ago

Thank you very much. I will.

Sent from my iPhone

On May 2, 2019, at 10:46 AM, Michael Schubert notifications@github.com wrote:

@Zhuk66 This should be fixed in the latest develop, it would be great if you could test it

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.