From d674259e010367f7de88ec92bc4d8564fd76b3a8 Mon Sep 17 00:00:00 2001 From: Eric Shi Date: Thu, 14 Mar 2024 10:56:32 -0700 Subject: [PATCH] Document Device total_memory and free_memory --- warp/context.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/warp/context.py b/warp/context.py index 67c362e52..f545392da 100644 --- a/warp/context.py +++ b/warp/context.py @@ -2167,6 +2167,10 @@ def has_stream(self): @property def total_memory(self): + """The total amount of device memory available in bytes. + + This function is currently only implemented for CUDA devices. 0 will be returned if called on a CPU device. + """ if self.is_cuda: total_mem = ctypes.c_size_t() self.runtime.core.cuda_device_get_memory_info(self.ordinal, None, ctypes.byref(total_mem)) @@ -2177,6 +2181,10 @@ def total_memory(self): @property def free_memory(self): + """The amount of memory on the device that is free according to the OS in bytes. + + This function is currently only implemented for CUDA devices. 0 will be returned if called on a CPU device. + """ if self.is_cuda: free_mem = ctypes.c_size_t() self.runtime.core.cuda_device_get_memory_info(self.ordinal, ctypes.byref(free_mem), None)