To solve CUDA initialization: Unexpected error from cudaGetDeviceCount() error follow below methods.
ERROR LOG
UserWarning: CUDA initialization: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 804: forward compatibility was attempted on non supported HW (Triggered internally at /opt/conda/conda-bld/pytorch_1603729096996/work/c10/cuda/CUDAFunctions.cpp:100.)
Contents
How to solve CUDA initialization: Unexpected error from cudaGetDeviceCount() ?
Based on this problem, other users were experiencing the same error message if
- Their setup was broken due to a driver/library mismatch (rebooting seemed to fix the problem)
- Their installed drivers did not match the user-mode driver inside a Docker container (and forward compatibility failed due to the usage of non-server GPUs)
Alternative to Solve CUDA initialization: Unexpected error from cudaGetDeviceCount()
Remember to restart your computer.
I was getting the same error (cudaGetDeviceCount 30) when running CUDA 8.0 samples on Ubuntu 14. Everything was up to date: Nvidia driver (375), GeForce GT 730M chipset (capacity 3). It worked after restarting xserver:)
if restarting doesn’t work then run the below commands :
!pip3 install torch==1.10.1+cu113 torchvision==0.11.2+cu113 torchaudio==0.10.1+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html
!pip3 install torch-scatter -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
!pip3 install torch-scatter torch-sparse -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
!pip3 install torch-cluster -f https://data.pyg.org/whl/torch-1.10.0+cu113.html
!pip3 install torch-geometric
Hope the above solution works.
Also read :
The following classes could not be found: androidx.compose.ui.tooling.preview.ComposeViewAdapter
AttributeError: ‘Rectangle’ object has no property ‘norm_hist’ Python Error