Variational inference does in general work with OpenCL, there are however a few things to note here:
-
the opencl_ids argument is not currently exposed for variational in cmdstanr, which means that you need to set the IDs via the makefile OPENCL_PLATFORM_ID and OPENCL_DEVICE_ID flags at compile time. We will probably add this for variatonal as well, but it was not a big priority so far.
-
your model is very unlikely to yield a speedup from using the Stan OpenCL backend right now