When we upload our code to the server to run, we encounter the following problems:
THCudaCheck FAIL file=/pytorch/aten/src/THC/THCGeneral.cpp line=50 error=100 : no CUDA-capable device is detected
Traceback (most recent call last):
File "HyperAttentionDTI_main.py", line 185, in <module>
model = AttentionDTI(hp).cuda()
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 304, in cuda
return self._apply(lambda t: t.cuda(device))
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 201, in _apply
module._apply(fn)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 223, in _apply
param_applied = fn(param)
File "/usr/local/lib/python3.7/site-packages/torch/nn/modules/module.py", line 304, in <lambda>
return self._apply(lambda t: t.cuda(device))
File "/usr/local/lib/python3.7/site-packages/torch/cuda/__init__.py", line 197, in _lazy_init
torch._C._cuda_init()
RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /pytorch/aten/src/THC/THCGeneral.cpp:50
It’s because our graphics card settings are wrong, because we know whether we have a graphics card or not, otherwise we won’t report the wrong graphics card problem
Solution:
Let’s look at the program code we executed and check the CUDA part. I set my graphics card to 6. We don’t have so many graphics cards to use. I checked the location of my graphics card, which is No. 0. Therefore, we set the first line of the following code to 0!
os.environ["CUDA_VISIBLE_DEVICES"] = "6"
if __name__ == "__main__":
"""select seed"""
SEED = 1234
random.seed(SEED)
torch.manual_seed(SEED)
torch.cuda.manual_seed_all(SEED)
# torch.backends.cudnn.deterministic = True
Read More:
- [Solved] RuntimeError: cuda runtime error: device-side assert trigger
- [Solved] RuntimeError: cuda runtime error (801) : operation not supported at
- [Solved] RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors
- pytorch: RuntimeError CUDA error device-side assert triggered
- [Solved] Pycharm paddle Error: Error: (External) CUDA error(35), CUDA driver version is insufficient for CUDA
- [DL Common Issue] RuntimeError: CUDA error 59: Device-side assert triggered
- RTX 3090 Run pytorch Error: CUDA error: no kernel image is available for execution on the device
- Pytorch CUDA Error: UserWarning: CUDA initialization: CUDA unknown error…
- How to Solve Error: RuntimeError CUDA out of memory
- [Solved] RuntimeError: cublas runtime error : resource allocation failed at
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemm
- RuntimeError: CUDA error: an illegal memory access was encountered
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cubla…
- [How to Solve] RuntimeError: CUDA out of memory.
- [Solved] Using summary to View network parameters Error: RuntimeError: Input type (torch.cuda.FloatTensor)
- [Solved] torchsummary Error: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.F
- Pytorch torch.cuda.FloatTensor Error: RuntimeError: one of the variables needed for gradient computation has…
- [Solved] pytorch Error: KeyError: tensor(2, device=‘cuda:0‘)
- [Solved] CUDA failure 999: unknown error ; GPU=-351697408 ; hostname=4f5e6dff58e6 ; expr=cudaSetDevice(info_.device_id);
- YOLOX Model conversion error: [TensorRT] ERROR: runtime.cpp (25) – Cuda Error in allocate: 2 (out of memory)