cmdstanr icon indicating copy to clipboard operation
cmdstanr copied to clipboard

Utilize multiple GPUs

Open thk686 opened this issue 2 years ago • 1 comments

I am testing stan on a system with three A100 GPUs. It appears all of the jobs run on the first GPU, ignoring the others. It seems this code:

      if (!is.null(self$opencl_ids)) {
        args$opencl <- c("opencl", paste0("platform=", self$opencl_ids[1]), paste0("device=", self$opencl_ids[2]))
      }

could be generalized to iterate over a vector of device ids.

thk686 avatar Jan 02 '24 18:01 thk686

There are a few things that need to change on the backend but yes this is very doable. I need to make the OpenCL context in the math library thread local then each chain can get a gpu

SteveBronder avatar Jan 03 '24 16:01 SteveBronder