Testing code for GPUs works without using a GPU

I do most of my developing on a 2013 Macbook Pro with a GeForce GT 750M (which is no longer supported by PyTorch). I have access to a cluster with a number of GPUs that I can run things on, but often there is a substantial wait before I can run anything.

Is there any way I can run test my code runs on a GPU without actually having a “working” GPU, without having to constantly submit jobs to the cluster to debug?

3 Likes

A general rule of thumb is that code that works on the CPU (that you wrote using pytorch) should also work on a GPU (as long as your tensors and models are converted to CUDA with .cuda(…) or .to(…) calls).