OpenCL demo fails to run on a Linux

hi, I am trying out the openCL demo: Running Stan on the GPU with OpenCL • cmdstanr

I have a Ubuntu local machine (Mint 20.3) and I only have CPU. I just want to see how it would go.

$ clinfo -l
Platform #0: Intel(R) OpenCL HD Graphics
 `-- Device #0: Intel(R) Gen9 HD Graphics NEO
Platform #1: Intel Gen OCL Driver
 `-- Device #0: Intel(R) HD Graphics Skylake ULT GT2

> mod_cl <- cmdstan_model("R/bernoulli_logit_glm.stan",
+                         cpp_options = list(stan_opencl = TRUE))
Model executable is up to date!
> 
> fit_cl <- mod_cl$sample(data = mdata, chains = 4, parallel_chains = 4,
+                         opencl_ids = c(0, 0), refresh = 0)
Running MCMC with 4 parallel chains...

Chain 1 Exception: initialize_buffer: clCreateBuffer CL_INVALID_HOST_PTR: Unknown error -37 (in '/tmp/RtmpC0ZJNq/model-954f34b3e16b.stan', line 15, column 2 to column 57) 

I am pretty sure I fail to set up my OpenCL properly. If there is a quick check or fix I can do, please let me know. Thank you.

We’ve identified that this behaviour is a bug related to the use of OpenCL with integrated graphics (rather than a discrete GPU).

There are more details in this GitHub issue, and I’ll let you know once a fix has been merged and how you can use it with your cmdstanr install

1 Like