Cmdstanpy with GPU/OpenCL

HI all,

I wonder if there is a documentation on running cmdstandpy with GPU (similar to the one for cmdstanr from here:

From the cmdstanr GPU documentation, we will only need to set CPP option stan_opencl to True when compiling the model but will need to spec OpenCL platform and device ID via function argument opencl_ids when calling sample.

However, in the cmdstanpy API reference, the sample function of CmdStanModel does not have the opencl_id argument. Meanwhile, from Source code for cmdstanpy.compiler_opts, it seems that OPENCL_DEVICE_ID and OPENCL_PLATFORM_ID are expected in CPP options.

So, is it correct that in cmdstanpy, the model is complied with specific device and platform id?


1 Like

Dear Akcchoi,
I am strucggeling to enable my cmdstanr for running on GPU. I accrossed suddenly with your post here. I am wondering if you know how I can create opencl application on my laptop? I am running on windows 10 and using rstudio. I already installed NVIDIA toolkit but I donot know how I must inform stan about
cpp_options and Open_CL IDs. beacuse thease two options seems did not yet activated on my stan. ANd I guess I must do something manually to inform stan about this two options. Do you have any idea


cmdstanpy seems to not have a run-time option to select the OpenCL IDs, which means that you need to select them at compile time using the OPENCL_DEVICE_ID and OPENCL_PLATFORM_ID flags.

Those need to be placed in the make/local file.

1 Like

Unfortunately, Iā€™m still in the reading documentation phrase.

1 Like

Dear Rok

is there any link or github page that shows the steps for manually changing the make/local files?