cmdstanr compiles a model just fine for me on Windows when I run the sample code in the OpenCL vignette as long as I do not try to compile for OpenCL. So, after saving the example model as indicated in the vignette, this compiles just fine:
library(cmdstanr)
check_cmdstan_toolchain(fix = TRUE)
# Generate some fake data
n <- 250000
k <- 20
X <- matrix(rnorm(n * k), ncol = k)
y <- rbinom(n, size = 1, prob = plogis(3 * X[,1] - 2 * X[,2] + 1))
mdata <- list(k = k, n = n, y = y, X = X)
# Compile the model without STAN_OPENCL=TRUE
mod_cl <- cmdstan_model("bernoulli_logit_glm.stan"
# ,
# cpp_options = list(stan_opencl = TRUE)
)
On the other hand, this fails with the following error information:
> library(cmdstanr)
>
> check_cmdstan_toolchain(fix = TRUE)
The C++ toolchain required for CmdStan is setup properly!
>
> # Generate some fake data
> n <- 250000
> k <- 20
> X <- matrix(rnorm(n * k), ncol = k)
> y <- rbinom(n, size = 1, prob = plogis(3 * X[,1] - 2 * X[,2] + 1))
> mdata <- list(k = k, n = n, y = y, X = X)
>
> # Compile the model with STAN_OPENCL=TRUE
> mod_cl <- cmdstan_model("bernoulli_logit_glm.stan"
+ ,
+ cpp_options = list(stan_opencl = TRUE)
+ )
Compiling Stan program...
In file included from stan/lib/stan_math/stan/math/opencl/prim.hpp:86,
from stan/lib/stan_math/stan/math/prim.hpp:7,
from stan/src/stan/io/dump.hpp:7,
from src/cmdstan/command.hpp:24,
from src/cmdstan/main.cpp:1:
stan/lib/stan_math/stan/math/opencl/scalar_type.hpp:14:8: error: partial specialization of 'struct stan::scalar_type<T, typename std::enable_if<stan::math::conjunction<stan::is_kernel_expression_and_not_scalar<T, void> >::value, void>::type>' after instantiation of 'struct stan::scalar_type<stan::math::constant_<int>, void>' [-fpermissive]
struct scalar_type<T, require_all_kernel_expressions_and_none_scalar_t<T>> {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
mingw32-make.exe: *** [make/program:14: src/cmdstan/main_opencl.o] Error 1
Error: An error occured during compilation! See the message above for more information.
This looks somewhat similar to the partial specialization error that was being discussed in the Linux context elsewhere on this board, but this is on Windows and seems a bit different.
Would appreciate any suggestions.
- Operating System: Windows 10
- CmdStan Version: v2.26.1
- cmdstanr Version: 0.4.0.9000
- R version: Microsoft 4.0.2 Open
- Compiler/Toolkit: mingw32 (I think, whatever RTools 4.0 installs)