Memory information in bytes Example: >>> print(ctx.device(0).memory()) {'total': 4238016512L, 'used': 434831360L, 'free': 3803185152L} Returns: total/used/free memory in bytes
(self)
| 90 | self.hnd = hnd |
| 91 | |
| 92 | def memory(self): |
| 93 | """Memory information in bytes |
| 94 | |
| 95 | Example: |
| 96 | |
| 97 | >>> print(ctx.device(0).memory()) |
| 98 | {'total': 4238016512L, 'used': 434831360L, 'free': 3803185152L} |
| 99 | |
| 100 | Returns: |
| 101 | total/used/free memory in bytes |
| 102 | """ |
| 103 | class GpuMemoryInfo(Structure): |
| 104 | _fields_ = [ |
| 105 | ('total', c_ulonglong), |
| 106 | ('free', c_ulonglong), |
| 107 | ('used', c_ulonglong), |
| 108 | ] |
| 109 | |
| 110 | c_memory = GpuMemoryInfo() |
| 111 | _check_return(_NVML.get_function( |
| 112 | "nvmlDeviceGetMemoryInfo")(self.hnd, byref(c_memory))) |
| 113 | return {'total': c_memory.total, 'free': c_memory.free, 'used': c_memory.used} |
| 114 | |
| 115 | def utilization(self): |
| 116 | """Percent of time over the past second was utilized. |
nothing calls this directly
no test coverage detected