mem_get_info
- paddle.cuda. mem_get_info ( device: DeviceLike = None ) tuple[int, int] [source]
-
Return the free and total GPU memory (in bytes) for a given device using
cudaMemGetInfo.This function queries the CUDA runtime for the amount of memory currently available and the total memory capacity of the specified device.
- Parameters
-
device (DeviceLike, optional) – The target device. If
None(default), the current device, as returned bypaddle.device.get_devicewill be used. - Returns
-
-
A tuple
(free, total), where -
free(int): The number of free bytes of GPU memory available.total(int): The total number of bytes of GPU memory.
-
A tuple
- Return type
-
tuple[int, int]
Examples
>>> >>> from paddle.cuda import mem_get_info >>> free_bytes, total_bytes = mem_get_info()
