MCPcopy Create free account
hub / github.com/mlco2/codecarbon / get_delta

Method get_delta

codecarbon/core/gpu.py:140–161  ·  view source on GitHub ↗

Get difference since last time this function was called >>> get_delta() [ { "name": "Tesla V100-SXM2-16GB", "uuid": "GPU-4e817856-1fb8-192a-7ab7-0e0e4476c184", "delta_energy_consumption":2000, "power_usage":

(self, last_duration: Time)

Source from the content-addressed store, hash-verified

138 return []
139
140 def get_delta(self, last_duration: Time) -> List:
141 """Get difference since last time this function was called
142 >>> get_delta()
143 [
144 {
145 "name": "Tesla V100-SXM2-16GB",
146 "uuid": "GPU-4e817856-1fb8-192a-7ab7-0e0e4476c184",
147 "delta_energy_consumption":2000,
148 "power_usage": 42159,
149 }
150 ]
151 """
152 try:
153 devices_info = []
154 for i in range(self.device_count):
155 gpu_device = self.devices[i]
156 devices_info.append(gpu_device.delta(last_duration))
157 return devices_info
158
159 except Exception:
160 logger.warning("Failed to retrieve gpu information", exc_info=True)
161 return []
162
163
164def is_gpu_details_available() -> bool:

Calls 1

deltaMethod · 0.45