2
votes

I've set up a new virtual machine (on GCP) with a K80 GPU on Ubuntu 16. Followed installation instructions for the CUDA toolkit 9.1

nvidia-smi returns correctly: NVIDIA-SMI 390.12 Driver Version: 390.12 ...

in pytorch, cuda.is_available() returns True, but any operation fails:

torch.randn(10).cuda() ==>

RuntimeError: cuda runtime error (2) : out of memory at /opt/conda/conda-
bld/pytorch_1512378422383/work/torch/lib/THC/generic/THCStorage.cu:58

What am I missing in the installation?

2

2 Answers

0
votes

Oh.. Never mind I had to restart the machine for the drivers to reload.

0
votes
  1. sometimes the GPU memory is occupied by the previous operation to free up the memory the IDE kernel (spyder/spyder3) can be restarted or restart your PC.
  2. try the code with sudo command if you are using Ubuntu.

hope it works for you as well.