GPU functions in rstan

To get the gpu stuff working with rstan/brms I add the below to my makevars. I need to figure out a solution to pulling out the OpenCL headers

The list below needs updated, but at the bottom of the docs we have a list of the functions that can use the GPU backend.

http://mc-stan.org/math/opencl_support.html

The big bummer with GPUs in general is the cost of transferring data to and from the GPU is v high. For cholesky, every iteration we need to pass the value and adjoints of the matrix that holds stan’s autodiff class variable var. Though note for the glm methods we have some tricks in the compiler so it goes fast for much smaller problems. We set that threshold when we first started writing the gpu code, but a lot of performance improvements have happened since then so we should probs go back and check if that’s lower now. Though I wouldn’t expect it to be more than 1000 or so.

4 Likes