preface
Today, a project using pytorch on the viewing server suddenly made an error after upgrading. The whole content of the error report is limited by the title. I’ll send it below.
builtins. RuntimeError: CUDA unknown error – this may be due to an incorrectly set up environment, e.g. changing env variable CUDA_ VISIBLE_ DEVICES after program start. Setting the available devices to be zero.
Screenshot of error reporting
Later, I consulted some materials, and the following are some solutions.
Solution:
Method 1: add environment variables
Since I started the project as a docker container, I installed VIM after entering the container, and then in ~/Bashrc finally added something.
export CUDA_ VISIBLE_ DEVICES=0
Since the selected graphics card number is 0 when building the container, the number I configured above is 0.
Check $CUDA after restarting the container_ VISIBLE_ The devices output is normal, but the problem is not solved, and the error is still reported.
Method 2: add environment variables to the code
Add the following code at the beginning of the initialization CUDA area.
import os
os.environ['CUDA_VISIBLE_DEVICES'] =‘0’
It still hasn’t solved the problem.
Method 3: restart the server
Referring to some articles, I mentioned that if the system upgrades the graphics card driver without restarting, it will also lead to the same error.
So I restarted the server and solved the problem.
Read More:
- Pytorch CUDA Error: UserWarning: CUDA initialization: CUDA unknown error…
- [Solved] Windows10 Pycharm Use Virtual Environment Error: Cannot set up a python SDK
- [Solved] with ERRTYPE = cudaError CUDA failure 999 unknown error
- [Solved] RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at
- [Solved] Pycharm paddle Error: Error: (External) CUDA error(35), CUDA driver version is insufficient for CUDA
- [Solved] ProxyError: Conda cannot proceed due to an error in your proxy configuration.
- [Solved] pycharm Import New Project Error: cannot set up a python sdk
- Error:Could not install packages due to an OSError:[WinError 5] Access denied
- [Solved] CUDA failure 999: unknown error ; GPU=-351697408 ; hostname=4f5e6dff58e6 ; expr=cudaSetDevice(info_.device_id);
- RuntimeError: CUDA error: an illegal memory access was encountered
- python2.7 ExcelWriter error Exception caught in workbook destructor. Explicit close() may be require
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemm
- [Solved] RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors
- [Solved] Python Read bam File Error: &&OSError: no BGZF EOF marker; file may be truncated
- [Solved] Mujoco Error: Missing path to your environment variable.
- [Solved] RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the
- [Solved] Using summary to View network parameters Error: RuntimeError: Input type (torch.cuda.FloatTensor)
- [Solved] Python matplotlib Error: RuntimeError: In set_size: Could not set the fontsize…
- [ncclUnhandledCudaError] unhandled cuda error, NCCL version xx.x.x
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cubla…