I want to fit a
brms model on a Linux cluster. The system I am working on only has a C compiler on the head node, not on compute nodes (this seems non-negotiable). I suspect that separating compilation (on head) and sampling (on compute) ought to be possible based on a previous
RStan post on this forum. I think I need to compile the model and write out an intermediate file on the head node, then load the intermediate file and sample on the compute node. Furthermore, I suspect this “intermediate file” is the dynamic shared object (DSO) referred to in
How do I compile the model without starting sampling, write out the DSO, then load it back into an R session on another node?
Attempts towards an answer:
Here’s a sample model based on the
brms docs that I am using as a testbed:
# Normal model with heterogeneous variances data_het <- data.frame( y = c(rnorm(500), rnorm(500, 1, 2), rnorm(500, 50, 50)), x = factor(rep(c("a", "b", "c"), each = 500)) ) # Fit model fit <- brm(bf(y ~ x, quantile = 0.25), data = data_het, family = asym_laplace(), chains = 8)
I’ve tried to prevent sampling by setting
iter = 0, warmup = 0. Doing so throws an error, but does seem to have compiled without sampling.
> fit Family: asym_laplace Links: mu = identity; sigma = identity; quantile = identity Formula: y ~ x quantile = 0.25 Data: data_het (Number of observations: 1500) The model does not contain posterior samples.
- Operating System: Springdale Linux 7.6 (Verona)
- brms Version: 2.8.0