# RuntimeError: CUDA out of memory in pytorch while running

## post by vyeminen on Apr 12, 2023

Getting this error while running my model

RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 22.06 GiB total capacity; 19.72 GiB already allocated; 8.38 MiB free; 20.41 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation. See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

869 views

### Related topics

| Topic | Replies | Views | Activity |
| --- | --- | --- | --- |
| [CUDA_ERROR_OUT_OF_MEMORY on tensorbook](https://deeptalk.lambda.ai/t/cuda-error-out-of-memory-on-tensorbook/557) | [4](https://deeptalk.lambda.ai/t/cuda-error-out-of-memory-on-tensorbook/557/1) | 4.4k | [Nov 2018](https://deeptalk.lambda.ai/t/cuda-error-out-of-memory-on-tensorbook/557/5) |
| [Random runtime CUDA error on Lambda machine](https://deeptalk.lambda.ai/t/random-runtime-cuda-error-on-lambda-machine/3432) | [0](https://deeptalk.lambda.ai/t/random-runtime-cuda-error-on-lambda-machine/3432/1) | 998 | [Jan 2023](https://deeptalk.lambda.ai/t/random-runtime-cuda-error-on-lambda-machine/3432/1) |
| [CUDA driver initialization failed](https://deeptalk.lambda.ai/t/cuda-driver-initialization-failed/3319) | [0](https://deeptalk.lambda.ai/t/cuda-driver-initialization-failed/3319/1) | 2.0k | [Nov 2022](https://deeptalk.lambda.ai/t/cuda-driver-initialization-failed/3319/1) |
| [CUDA runtime implicit initialization on GPU:0](https://deeptalk.lambda.ai/t/cuda-runtime-implicit-initialization-on-gpu-0/2023) | [0](https://deeptalk.lambda.ai/t/cuda-runtime-implicit-initialization-on-gpu-0/2023/1) | 1.0k | [Dec 2020](https://deeptalk.lambda.ai/t/cuda-runtime-implicit-initialization-on-gpu-0/2023/1) |
| [Memory Problems with TensorFlow 2.11](https://deeptalk.lambda.ai/t/memory-problems-with-tensorflow-2-11/3675) | [1](https://deeptalk.lambda.ai/t/memory-problems-with-tensorflow-2-11/3675/1) | 658 | [May 2023](https://deeptalk.lambda.ai/t/memory-problems-with-tensorflow-2-11/3675/2) |
