Closed LopezRicardo1 closed 9 months ago
That should just work if you move tensors to the MPS device.
Eg:
x <- torch_randn(10, 10)$to(device="mps")
y <- torch_randn(10, 10)$to(device="mps")
torch_mm(x, y)
If both tensors are on the MPS device, then the operation will happen on the GPU if there's a kernel for it.
I see, thank you!
Though, using this setting the operation will be done in the GPU, right? How can I check if there's a kernel for GPU?
I'm still in a learning curve on this!
The easiest way is to run and see if it works :) At this point, most operations already support running on mac GPU's. If you have large enough tensors you will quicky see your GPU usage going up in the system monitor app:
library(torch)
x <- torch_randn(10000, 10000)$to(device="mps")
for (i in 1:1000) {
y <- torch_mm(x, x)
}
y[10]
Yes, GPU 90% on system monitor!
Thanks!
Is there a way to perform matrix algebra operations using Mac M2 Max Gpu system using Torch R?