Skip to content

Commit 7697378

Browse files
committed
Add testcase for Issue stan-dev#765
Demonstrate inability to sample models with opencl from exe file.
1 parent 895e1d0 commit 7697378

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/testthat/test-opencl.R

+10
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,13 @@ test_that("error for runtime selection of OpenCL devices if version less than 2.
117117
)
118118
reset_cmdstan_version()
119119
})
120+
121+
test_that("model from exe_file retains open_cl option", {
122+
skip_if_not(Sys.getenv("CMDSTANR_OPENCL_TESTS") %in% c("1", "true"))
123+
stan_file <- testing_stan_file("bernoulli")
124+
mod <- cmdstan_model(stan_file = stan_file, cpp_options = list(stan_opencl = TRUE))
125+
mod_from_exe <- cmdstan_model(exe_file = mod$exe_file())
126+
expect_sample_output(
127+
fit <- mod_from_exe$sample(data = testing_data("bernoulli"), opencl_ids = c(0, 0), chains = 1)
128+
)
129+
})

0 commit comments

Comments
 (0)