GPU supported in rstan 2.19.x?

Hello,

Is GPU support enabled in rstan 2.19.x? If so, can you please advise how to do it?

Are the instructions in https://github.com/stan-dev/math/wiki/OpenCL-GPU-Routines sufficient to get it working? Eg, when you create the make/local file is this in the math folder within the local copy of StanHeaders?

Thanks in advance
Julian

My understanding is that it is the same deal except that ~/.R/Makevars takes the place of the make/local file.

Thanks for the fast reply. I’m a bit stumped why it isn’t working then.

I’ve got rstan 2.19.2 and NVIDIA CUDA 10.1 and am running Windows.

Here’s my C:\Users\username\Documents\.R\makevars.win

CXX14FLAGS=-O3
CXX14 = g++ -m$(WIN) -std=c++1y
CXX11FLAGS=-O3
STAN_OPENCL=true
OPENCL_PLATFORM_ID=1
OPENCL_DEVICE_ID=0
CC = g++
LDFLAGS_OPENCL= -L"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64" -lOpenCL

Here’s the output from clinfo -l:

Platform #0: Intel(R) OpenCL
 +-- Device #0: Intel(R) HD Graphics 630
 `-- Device #1: Intel(R) Core(TM) i7-7820HQ CPU @ 2.90GHz
Platform #1: NVIDIA CUDA
 `-- Device #0: GeForce 940MX

g++ is in my path and can be called from the command prompt fine. I’ve got the latest Rtools.

I’ve got my own Gaussian Process code with a 700x700 covariance matrix to which cholesky_decompose() is applied but no GPU activity…

Any way I can try to diagnose the issue?

Thanks in advance for the help.

Because of the transfer times from CPU->GPU we did a bunch of benchmarking and found that matrices that are less than 1200x1200 or so don’t receive any speedups from moving over to the GPU. We have a little check function in the code that only turns on the OpenCL code if the matrix is larger than 1200x1200.

We are slowly working on some speedups to lower that number. But given manpower right now we’d rather enable more of the math library to use the OpenCL functions