-
Notifications
You must be signed in to change notification settings - Fork 10
Description
My machine:
OS: Arch Linux
GPU: NVIDIA GeForce GTX 750ti (2GB)
Native Nvidia OpenCL drivers, version 495.46
R info:
R version: 4.1.2
Package version: CRAN OpenCL_0.2-2
I'm doing some pretty heavy simulations which tend to max out the VRAM on my GPU. This is fine because I can simply call "as.numeric" on the result of the oclRun command to retrieve the stored simulations off my GPU. I do something like this:
args <- list()
args$kernel <- kernel
args$size <- size
args$dim <- dim
args[[length(args) + 1]] <- as.clBuffer(input1, ctx)
args[[length(args) + 1]] <- as.clBuffer(input2, ctx)
...
res <- do.call(oclRun, args)
dat <- as.numeric(res)
save(dat, file = "dat.Rda")
I can see as I'm saving the data that my GPU's memory is still full using nvtop in the terminal. The output vector is what's eating the ram because there are about a million results being stored. If I do rm(res), the pointer to the clBuffer on the GPU is lost to the R session, but there isn't a corresponding call to clReleaseMemObject, or something like that to free up the VRAM. Can a method for rm be added to do this call? Or can some other way for releasing the buffer memory on the GPU be added? I'd like to put that "res-dat-save" block into a loop, but currently I have to let R quit for the GPU memory to be released.
Thanks for all the work with this package, I'm finding it very useful.