This issue was discussed in wlandau/instantiate#30 and the solution recommended was to create an issue here to ask for capitalizing "stan_threads" in
|
assert_valid_threads <- function(threads, cpp_options, multiple_chains = FALSE) { |
|
threads_arg <- if (multiple_chains) "threads_per_chain" else "threads" |
|
checkmate::assert_integerish(threads, .var.name = threads_arg, |
|
null.ok = TRUE, lower = 1, len = 1) |
|
if (is.null(cpp_options[["stan_threads"]]) || !isTRUE(cpp_options[["stan_threads"]])) { |
|
if (!is.null(threads)) { |
|
warning( |
|
"'", threads_arg, "' is set but the model was not compiled with ", |
|
"'cpp_options = list(stan_threads = TRUE)' ", |
|
"so '", threads_arg, "' will have no effect!", |
|
call. = FALSE |
|
) |
|
threads <- NULL |
|
} |
|
} else if (isTRUE(cpp_options[["stan_threads"]]) && is.null(threads)) { |
|
stop( |
|
"The model was compiled with 'cpp_options = list(stan_threads = TRUE)' ", |
|
"but '", threads_arg, "' was not set!", |
|
call. = FALSE |
|
) |
|
} |
|
invisible(threads) |
|
} |
.
I don't know if this would be possible or if it would also be allowed for both "stan_threads " and "STAN_THREADS" to point to the same setting internally, but this would fix an issue with getting instantiate to allow for pre-compiling with multi-threading allowed without generating a warning.
This issue was discussed in wlandau/instantiate#30 and the solution recommended was to create an issue here to ask for capitalizing
"stan_threads"incmdstanr/R/cpp_opts.R
Lines 149 to 171 in 5f2a8c8
I don't know if this would be possible or if it would also be allowed for both
"stan_threads "and"STAN_THREADS"to point to the same setting internally, but this would fix an issue with gettinginstantiateto allow for pre-compiling with multi-threading allowed without generating a warning.