(self)
| 58 | _lib_lock = threading.Lock() |
| 59 | |
| 60 | def load(self): |
| 61 | with self._lib_lock: |
| 62 | if self._nvmlLib is None: |
| 63 | self._nvmlLib = CDLL("libnvidia-ml.so.1") |
| 64 | |
| 65 | function_pointers = ["nvmlDeviceGetName", "nvmlDeviceGetUUID", "nvmlDeviceGetMemoryInfo", |
| 66 | "nvmlDeviceGetUtilizationRates", "nvmlInit_v2", "nvmlShutdown", |
| 67 | "nvmlDeviceGetCount_v2", "nvmlDeviceGetHandleByIndex_v2"] |
| 68 | |
| 69 | self.func_ptr = {n: self._function_pointer(n) for n in function_pointers} |
| 70 | |
| 71 | def _function_pointer(self, name): |
| 72 | try: |
no test coverage detected