cpp_options = list(stan_threads = TRUE) does not work when included in src/install.libs.R.
#31
Replies: 2 comments 2 replies
|
I installed https://github.com/toddmccready/disize/tree/errors and noticed Inside $STAN_THREADS
[1] TRUE
$STAN_VERSION
[1] "2.36.0"So it is actually compiling with threads enabled. If you run: library(cmdstanr)
library(disize)
library(tidyverse)
debugonce(cmdstanr:::assert_valid_threads)and then run https://github.com/toddmccready/disize/blob/e140984f50f33d4aaae4e5f06ea27bb584c6a1ec/tests/testthat/test-disize.R#L8-L78, you will see 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"]])) { # should be 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)) { # should be cpp_options[["STAN_THREADS"]]
stop(
"The model was compiled with 'cpp_options = list(stan_threads = TRUE)' ",
"but '", threads_arg, "' was not set!",
call. = FALSE
)
}
invisible(threads)
} |
|
This should finally be addressed by stan-dev/cmdstanr#1212. I apologize for the delay! |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
My
install.libs.Rfile has been modified like so:However whenever I load and run the model I get this warning:
And my current workaround is to just re-compile the model:
A reproducible example is available at https://github.com/toddmccready/disize/tree/errors by running the tests in
tests/testthat/test-disize.RAll reactions