Error in read_cmdstan_csv Assertion on ‘files’ failed on Linux

I am using foreach() to run a batch execution of data with cmdstanr on a Linux workstation. I am able to run the batch execution fine on Windows, but when I switch to Linux, I get an error:

Error in read_cmstan_csv(): Assertion on 'files' failed: File does not exist

Below is the function I am using to run the batch execution:

result_all <- foreach(i = 1:5, .packages="cmdstanr") %dopar% {
  mod <- mod_2step$sample(data = data[[i]],
                                       refresh=0,
                                       seed = 20040425,
                                       chains=chains,
                                       iter_warmup = 2500,
                                       iter_sampling = 2500,
                                       thin=thin,
                                       max_treedepth=20,adapt_delta=0.99,
                                       parallel_chains = 4)
}

This seems like it might be the same issue as in Parallel the same model fitting for differen data - #4 by karimn

Like @jsocolar suggested there, it might help to specify the output_basename (and maybe output_dir) arguments when calling sample. It could have something to do with how the default temporary files are being created, but you can override that with those arguments.

I’m giving this a try. It’s working so far, but I will let you know if I hit any problems.

Thanks!

1 Like