stan-dev / rstan

RStan, the R interface to Stan
https://mc-stan.org
1.04k stars 265 forks source link

Within-chain parallelization in Ubuntu (WSL) not working. #1120

Open qymera0 opened 6 months ago

qymera0 commented 6 months ago

I have tried to fit a model with Within-chain parallelization using Ubuntu (through WSL) and am getting an error. The model normally works if I comment on the 'threads' argument. The model also works normally on Windows 10 (normally). Here is the model:

ccCicv <- brm( data = py$dfClean, family = student, cc ~ 1, prior = c( prior(normal(mean_y, sd_y * 5), class = Intercept), prior(cauchy(0, sd_y), class = sigma), prior(exponential(one_over_twentynine), class = nu) ), stanvars = ccVars, iter = 200000, warmup = 4000, chains = 4, cores = 4, seed = 123456, thin = 100,

control = list(adapt_delta = .90, max_treedepth = 15),

backend = "cmdstanr", threads = threading(6) )

Here is the error:

Error: Syntax error found! See the message above for more information. 7. stop("Syntax error found! See the message above for more information.", call. = FALSE) 6. cmdstan_mod$format(canonicalize = list("deprecations", "braces", "parentheses"), overwrite_file = overwrite_file, backup = FALSE) 5. withVisible(...elt(i)) 4. utils::capture.output(cmdstan_mod$format(canonicalize = list("deprecations", "braces", "parentheses"), overwrite_file = overwrite_file, backup = FALSE)) 3. .canonicalize_stan_model(tmp_file, overwrite_file = FALSE) 2. .make_stancode(bterms, data = data, prior = prior, stanvars = stanvars, save_model = save_model, backend = backend, threads = threads, opencl = opencl, normalize = normalize) 1. brm(data = py$dfClean, family = student, cc ~ 1, prior = c(prior(normal(mean_y, sd_y * 5), class = Intercept), prior(cauchy(0, sd_y), class = sigma), prior(exponential(one_over_twentynine), class = nu)), stanvars = ccVars, iter = 200000, warmup = 4000, chains = 4, seed = 123456, ...

BRMS version: 2.20.4 CMDSTANR version: 0.7.1 rstan version: 2.32.6 stanheaders version: 2.32.6

What I just did:

Updated the Linux; Updated all packages from CRAN; Installed RccpParallel from git-hub (current version: 5.1.7-9001); Re-compiled the constant locally.