there is a cuMemGetInfo function which will let you query the total memory and the free memory on the device before you call cudaMalloc. (Even though cuMemGetInfo is technically part of the driver API, you can safely use it from the Runtime API as well.)
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Memory problem | 9 | 6715 | March 20, 2008 | |
| Get actual free memory amount? | 1 | 14750 | July 29, 2009 | |
| CudaMemGetInfo problem | 3 | 7238 | July 9, 2014 | |
| Allocated memory information | 1 | 3152 | January 20, 2009 | |
| Getting the available device memory | 2 | 1429 | November 13, 2008 | |
| Max size of array | 5 | 1518 | April 12, 2018 | |
| How much allocated memory | 2 | 3156 | May 30, 2014 | |
| how to get the available size of memory? | 6 | 6535 | April 17, 2008 | |
| Maximum amount of memory you can cudamalloc? | 5 | 15251 | February 22, 2010 | |
| Why do cudaMemGetInfo also occupies a lot of GPU memory? | 2 | 712 | December 22, 2021 |