When training the model in vscode, the following errors appear:
CUDA runtime error (38): no CUDA capable device is detected at/Torch/aten/SRC/THC/thcgeneral cpp:51
The reason is that CUDA is not selected correctly, so you need to check how many graphics cards you have first:
Enter Python in terminal; Enter the following code
import torch
print(torch.cuda.device_count()) #Number of available GPUs
View CUDA version
nvcc --version # Check your own CUDA version
I have two graphics cards in my library. Choose one from 0 or 1 and write it before
model = torch.nn.dataparallel (net). Cuda()
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
model = torch.nn.DataParallel(net).cuda()
Problem solving.
Read More:
- TensorFlow-gpu Error: failed call to cuInit: CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
- [Solved] CUDA error:-UserWarning: CUDA initialization: CUDA unknown error
- [Solved] RuntimeError: CUDA error: invalid device ordinal
- [Solved] Runtimeerror: CUDA error: device side assert triggered
- [Solved] UserWarning: CUDA initialization: CUDA unknown error
- Deep learning model error + 1: CUDA error: device side assert triggered
- [Solved] torch Do Targer Detection Error: RuntimeError: CUDA error: device-side assert triggered
- [Solved] CUDA error: device side assert triggered classification task error
- TensorRT model quantization error: Error Code 1: Cuda Runtime (an illegal memory access was encountered)
- [Solved] RuntimeError: CUDA error: out of memory
- CUDA_ERROR_SYSTEM_DRIVER_MISMATCH [How to Solve]
- [Solved] NCCL error in: /pytorch/torch/lib/c10d/ProcessGroupNCCL ,unhandled cuda error, NCCLversion 2.7.8
- PyCharm Error: RuntimeError: CUDA out of memory [How to Solve]
- [Solved] CUDA fails to compile in visual studio and throws error msb3721 and nvcc fatal
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
- [Solved] matlab Error: CUDA_ERROR_SYSTEM_NOT_READY
- CUDA error: CUBLAS_STATUS_NOT_INITIALIZED when calling `cublasCreate(handle)`
- [Solved] Bringing up interface eth0: Error: No suitable device found: no device found for connection ‘System eth0’.
- How to Solve error: command ‘C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\bin\nvcc.exe‘ failed
- Error 1 error MSB3721: Command ““C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe” -genco