Error in checkForRemoteErrors(val) :
3 nodes produced errors; first error: Failed to create the shared library. Run 'printErrors()' to see the compilation errors--
You received this message because you are subscribed to the Google Groups "nimble-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nimble-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nimble-users/de64e562-ced2-46b9-b855-8cdd601022c3n%40googlegroups.com.
Hi Chris:I tried to Print the errors, but it did not return anything.I am using Windows 11, Rstudio and R 4.2.2My guess is that the code executes in all the workers but the issue is happening in collecting the results from all the workers and returning it back to the main.I found a (not a perfect) workaround.I added a
save(results,file=paste("nimble",ir,".Rdata",sep=""), compress=T)within the function.With this, if I use
res_repl = foreach(ir= 1:10,.verbose=T) %dopar% {#.packages=c("nimble")
fit = run_repl(ir)
}and suppose the last execution completion is for the worker with ir=9 when the code fails to collect results from all the workers, I can still get the saved results for ir=1:8 and the 10th one but not the 9th one.I have used parallel in R before without issues, such as with cmdstan.Sanjib
Chris:I upgraded to R 4.3.1 and rtools43 but received the same error
Error in { : task 1 failed - "Failed to create the shared library. 1 [main] make (25384) C:\rtools43\usr\bin\make.exe: *** fatal error - add_item ("\??\C:\rtools43", "/", ...) failed, errno 1 Stack trace: Frame Function Args 0007FFFFCD30 00018006119E (00018028FD7A, 000180271B51, 000000008000, 0007FFFF8B30) msys-2.0.dll+0x2119E 0007FFFFCD30 0001800469BA (000000000000, 0007FFFFCD30, 0001A1000010, 0007FFFFABDE) msys-2.0.dll+0x69BA 0007FFFFCD30 0001800469F2 (0007FFFF9BC0, 000000000001, 000000008000, 000000000001) msys-2.0.dll+0x69F2 0007FFFFCD30 00018007E497 (000700000000, 000000000000, 0000FFFFFFFF, 000000000000) msys-2.0.dll+0x3E497 0007FFFFCD30 000180182A25 (000180073204, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x142A25 0007FFFFCD30 000180047012 (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x7012 0007FFFFFFF0 000180045C86 (000000000000, 000000000000, 000000000000, 000000000000) msys-2.0.dll+0x5C86 0007FFFFFFF0 000180045D34 (
>SanjibOn Mon, Sep 25, 2023 at 8:46 PM Sanjib Basu <sanj...@gmail.com> wrote:I added the "showCompilerOutput=TRUE"I am attaching the Outfile from doParallelNow, on the R-Studio console, I got this message (which did not show up in the Outfile)
Error in { : task 1 failed - "Failed to create the shared library. 0 [main] make (30120) C:\rtools42\usr\bin\make.exe: *** fatal error - add_item ("\??\C:\rtools42", "/", ...) failed, errno 1 Stack trace: Frame Function Args 000FFFFCD30 00180062AAE (00180299B8A, 00180274E41, 00000000000, 000FFFF8B30) 000FFFFCD30 0018004846A (00000000000, 000FFFFCD30, 00180020010, 000FFFFABDE) 000FFFFCD30 001800484A2 (000FFFF9BC0, 00000000001, 00000000000, 00000000001) 000FFFFCD30 001800ED047 (00000000000, 00000000000, 000FFFFFFFF, 00000000000) 000FFFFCD30 00180132605 (001800DC2D4, 00000000000, 00000000000, 00000000000) 000FFFFCD30 00180048AB8 (00000000000, 00000000000, 00000000000, 00000000000) 000FFFFFFF0 00180047716 (00000000000, 00000000000, 00000000000, 00000000000) 000FFFFFFF0 001800477C4 (00000000000, 00000000000, 00000000000, 00000000000) End of stack trace"I played with the "sink" command you suggested but could not make it work (it was not writing anything in the file I specified). I am attaching my code below.Can you suggest how to add the "sink" ?
-------------------library(nimble)
# Simulate some data
myData <- rgamma(1000, shape = 0.4, rate = 0.8)
myCode <- nimbleCode({
a ~ dunif(0, 100)
b ~ dnorm(0, 100)
for (i in 1:length_y) {
y[i] ~ dgamma(shape = a, rate = b)
}
})
run_MCMC_allcode <- function(seed,data, code) {
library(nimble)
myModel <- nimbleModel(code = code,
data = list(y = data),
constants = list(length_y = 1000),
inits = list(a = 0.5, b = 0.5))
CmyModel <- compileNimble(myModel,showCompilerOutput=TRUE)
myMCMC <- buildMCMC(CmyModel, monitors = c("a","b"))
CmyMCMC <- compileNimble(myMCMC,showCompilerOutput=TRUE)
results <- runMCMC(CmyMCMC, niter = 10000, setSeed = seed)
return(results)
}
library(parallel)
library(foreach)
library(doParallel)
cl <- makePSOCKcluster(8, outfile="err2.txt")
registerDoParallel(cl,cores=8)
getDoParWorkers()
# result is a list of dc.mod and el.mod nrep times
#zz = file("err2.txt", open = "wt")
result = foreach(ir= c(1:9),
.packages=c("nimble"),.verbose=T)%dopar% { #
#sink(zz, type = "message", append=T)
out = run_MCMC_allcode(seed=ir, data = myData, code = myCode)
}Sanjib