To solve RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED error follow below methods.
ERROR LOG
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 263, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/usr/local/lib/python3.6/dist-packages/torch/nn/modules/conv.py", line 260, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
File "/home/khawar/anaconda3/envs/hypergraph_reid/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 399, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/home/khawar/anaconda3/envs/hypergraph_reid/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 396, in _conv_forward
self.padding, self.dilation, self.groups)
RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
Contents
How to solve RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED ?
To solve the RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED error you can install the torch and torchvision packages to resolve this. Run the below command.
pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html
Alternative to Solve RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED
When upgrading torch and torchvision to the current version using Cuda 10.2, I encountered the same issue (torch-1.8.0 and torchvision-0.9.0). Which version do you have?
I suppose this isn’t the best answer, but dropping to torch-1.7.1 and torchvision-0.8.2 works perfectly.
It didn’t always have anything to do with the PyTorch/CUDA/cuDNN version. When a convolution is conducted for the first time, PyTorch lazily initialises cuDNN. However, because PyTorch already had the entire memory in its internal cache, there was not enough GPU memory left to initialise cuDNN in my situation. Manually emptying the cache with “torch.cuda.empty cache()” right before the first convolution is done is an option. A simpler method is to force cuDNN initialization at the start by performing a mock convolution:
Hope the above solution works.
Also read :
ImportError: cannot import name ‘PY3’ from ‘torch._six’
WARNING: Value for scheme.data does not match. Please report this