@@ -33,7 +33,8 @@ test_that("all methods error when opencl_ids is used with non OpenCL model", {
3333test_that(" all methods error on invalid opencl_ids" , {
3434 skip_if_not(Sys.getenv(" CMDSTANR_OPENCL_TESTS" ) %in% c(" 1" , " true" ))
3535 stan_file <- testing_stan_file(" bernoulli" )
36- mod <- cmdstan_model(stan_file = stan_file , cpp_options = list (stan_opencl = TRUE ))
36+ mod <- cmdstan_model(stan_file = stan_file , cpp_options = list (stan_opencl = TRUE ),
37+ force_recompile = TRUE )
3738 utils :: capture.output(
3839 expect_warning(
3940 mod $ sample(data = testing_data(" bernoulli" ), opencl_ids = c(1000 , 1000 ), chains = 1 ),
@@ -74,33 +75,34 @@ test_that("all methods run with valid opencl_ids", {
7475 fit <- mod $ sample(data = testing_data(" bernoulli" ), opencl_ids = c(0 , 0 ), chains = 1 )
7576 )
7677 expect_false(is.null(fit $ metadata()$ opencl_platform_name ))
77- expect_false(is.null(fit $ metadata()$ opencl_ids_name ))
78+ expect_false(is.null(fit $ metadata()$ opencl_device_name ))
7879
7980 stan_file_gq <- testing_stan_file(" bernoulli_ppc" )
80- mod_gq <- cmdstan_model(stan_file = stan_file_gq , cpp_options = list (stan_opencl = TRUE ))
81+ mod_gq <- cmdstan_model(stan_file = stan_file_gq , cpp_options = list (stan_opencl = TRUE ),
82+ force_recompile = TRUE )
8183 expect_gq_output(
8284 fit <- mod_gq $ generate_quantities(fitted_params = fit , data = testing_data(" bernoulli" ), opencl_ids = c(0 , 0 )),
8385 )
8486 expect_false(is.null(fit $ metadata()$ opencl_platform_name ))
85- expect_false(is.null(fit $ metadata()$ opencl_ids_name ))
87+ expect_false(is.null(fit $ metadata()$ opencl_device_name ))
8688
8789 expect_sample_output(
8890 fit <- mod $ sample(data = testing_data(" bernoulli" ), opencl_ids = c(0 , 0 ))
8991 )
9092 expect_false(is.null(fit $ metadata()$ opencl_platform_name ))
91- expect_false(is.null(fit $ metadata()$ opencl_ids_name ))
93+ expect_false(is.null(fit $ metadata()$ opencl_device_name ))
9294
9395 expect_optim_output(
9496 fit <- mod $ optimize(data = testing_data(" bernoulli" ), opencl_ids = c(0 , 0 ))
9597 )
9698 expect_false(is.null(fit $ metadata()$ opencl_platform_name ))
97- expect_false(is.null(fit $ metadata()$ opencl_ids_name ))
99+ expect_false(is.null(fit $ metadata()$ opencl_device_name ))
98100
99101 expect_vb_output(
100102 fit <- mod $ variational(data = testing_data(" bernoulli" ), opencl_ids = c(0 , 0 ))
101103 )
102104 expect_false(is.null(fit $ metadata()$ opencl_platform_name ))
103- expect_false(is.null(fit $ metadata()$ opencl_ids_name ))
105+ expect_false(is.null(fit $ metadata()$ opencl_device_name ))
104106})
105107
106108test_that(" error for runtime selection of OpenCL devices if version less than 2.26" , {
@@ -111,7 +113,7 @@ test_that("error for runtime selection of OpenCL devices if version less than 2.
111113 mod <- cmdstan_model(stan_file = stan_file , cpp_options = list (stan_opencl = TRUE ),
112114 force_recompile = TRUE )
113115 expect_error(
114- mod $ sample(data = data_list , chains = 1 , refresh = 0 , opencl_ids = c(1 ,1 )),
116+ mod $ sample(data = testing_data( " bernoulli " ) , chains = 1 , refresh = 0 , opencl_ids = c(1 ,1 )),
115117 " Runtime selection of OpenCL devices is only supported with CmdStan version 2.26 or newer" ,
116118 fixed = TRUE
117119 )
0 commit comments