This is a related problem to Deleting temporary files created by cmdstanr
I’m trying to run a Monte Carlo simulation with brms and this creates a lot of temporary files in /tmp
on linux due to left-over un-reusable Stan files. I’m wondering if there’s a way to automate deleting the files.
Using cmdstanr
, this seems to be one way to get temporary files created
library(brms)
tmp<-brms::brm(
count ~ zBase * Trt + (1|patient),
data = epilepsy, family = poisson(),
prior = prior(normal(0, 10), class = b) +
prior(cauchy(0, 2), class = sd), backend = "cmdstanr"
)
tmp[["fit"]]@stan_args[[1]][["model"]]
tmp[["fit"]]@stan_args[[1]][["file"]]
tmp[["fit"]]@stan_args[[1]][["profile_file"]]
tmp[["fit"]]@stan_args[[1]][["model"]]
needs to have _model
removed from its end, but it’s workable.
Using rstan
, I’m going to guess that these are the names of the temporary files in /tmp
library(brms)
tmp2<-brms::brm(
count ~ zBase * Trt + (1|patient),
data = epilepsy, family = poisson(),
prior = prior(normal(0, 10), class = b) +
prior(cauchy(0, 2), class = sd), backend = "rstan", stan_model_args = list(save_dso = FALSE)
)
tmp2[["fit"]]@stanmodel@dso@dso_filename
Are there any other temporary files I’m missing? What would be the easiest way to safely clean them up?
- Operating System:
Ubuntu 22.04
- brms Version: `brms Version 2.22.6