RuntimeError: CUDA out of memory. Tried to allocate 600.00 MiB (GPU 0; 23.69 GiB total capacity; 21.82 GiB already allocated; 115.25 MiB free; 21.87 GiB reserved in total by PyTorch)
Runtime error: CUDA out of memory. Attempt to allocate 600.00 MIB (GPU 0; 23.69 gib total capacity; 21.82 gib allocated; 115.25 MIB free; pytorch reserves a total of 21.87 GIB)
reason
A similar bug is due to insufficient video memory
Solution 1: release the video memory
First fuser - V/dev/NVIDIA *
or sudo fuser - V/dev/NVIDIA *
, view the processes running on the GPU recently, and then sudo kill the relevant process number.
Of which:
Fuser: it can display which program is currently using a file, mount point, or even network port on the disk, and give the details of the program process – V: detailed mode/dev/NVIDIA *: all NVIDIA related interfaces (such as GPU)
Solution 2: turn down the batch size
If it is not enough after releasing part of the video memory, you can reduce the batch size
Reference:
after NVIDIA GPU kill process, the video memory is still unclear
Read More:
- Runtimeerror using Python training model: CUDA out of memory error resolution
- RuntimeError: CUDA error: out of memory solution (valid for pro-test)
- MobaXterm error cuda:out of memory
- CUDA error:out of memory
- python MemoryError: Unable to allocate 165. MiB for an array with shape
- Kvm internal error: process exited :cannot set up guest memory ‘pc.ram‘:Cannot allocate memory
- os::commit_memory(0x0000000538000000, 11408506880, 0) failed; error=‘Cannot allocate memory‘
- Remember a virtual machine expansion swapoff failed: cannot allocate memory
- Swap off failed: cannot allocate memory
- Problems in the construction of CUDA environment (GPU parallel programming)
- Mysql cannot allocate memory for the buffer pool solution
- CentOS execution command error: – bash: fork: cannot allocate memory processing / viewing process number
- [Solved] Android compile error: cannot allocate memory
- Fatal error: Newspace:: rebalance allocation failed – process out of memory (memory overflow)
- Python: CUDA error: an illegal memory access was accounted for
- RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at /opt/conda/conda-bld/
- PyTorch CUDA error: an illegal memory access was encountered
- Server composer install error: proc_open(): fork failed-Cannot allocate memory
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`
- [MMCV]RuntimeError: CUDA error: no kernel image is available for execution on the device