From c16587511dab7efadf720ee78033eb88641f5d90 Mon Sep 17 00:00:00 2001 From: Xuehai Pan Date: Sat, 26 Aug 2023 10:51:51 +0000 Subject: [PATCH] chore(api/process): remove attribute `gpu_cc_protected_memory` --- nvitop/api/device.py | 1 - nvitop/api/libnvml.py | 2 -- nvitop/api/process.py | 29 ----------------------------- 3 files changed, 32 deletions(-) diff --git a/nvitop/api/device.py b/nvitop/api/device.py index bcf0b6f..497d8b5 100644 --- a/nvitop/api/device.py +++ b/nvitop/api/device.py @@ -2111,7 +2111,6 @@ class Device: # pylint: disable=too-many-instance-attributes,too-many-public-me gpu_memory=gpu_memory, gpu_instance_id=getattr(p, 'gpuInstanceId', UINT_MAX), compute_instance_id=getattr(p, 'computeInstanceId', UINT_MAX), - gpu_cc_protected_memory=getattr(p, 'usedGpuCcProtectedMemory', NA), ) proc.type = proc.type + type diff --git a/nvitop/api/libnvml.py b/nvitop/api/libnvml.py index 8bbc702..396c84e 100644 --- a/nvitop/api/libnvml.py +++ b/nvitop/api/libnvml.py @@ -695,8 +695,6 @@ if not _pynvml_installation_corrupted: if obj.usedGpuMemory == ULONGLONG_MAX: # Special case for WDDM on Windows, see comment above obj.usedGpuMemory = None - if getattr(obj, 'usedGpuCcProtectedMemory', None) == ULONGLONG_MAX: - obj.usedGpuCcProtectedMemory = None processes.append(obj) return processes diff --git a/nvitop/api/process.py b/nvitop/api/process.py index 004660d..2bbc712 100644 --- a/nvitop/api/process.py +++ b/nvitop/api/process.py @@ -470,7 +470,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi gpu_memory: int | NaType | None = None, gpu_instance_id: int | NaType | None = None, compute_instance_id: int | NaType | None = None, - gpu_cc_protected_memory: int | NaType | None = None, type: str | NaType | None = None, # pylint: disable=redefined-builtin # pylint: enable=unused-argument ) -> Self: @@ -509,7 +508,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi gpu_memory: int | NaType | None = None, gpu_instance_id: int | NaType | None = None, compute_instance_id: int | NaType | None = None, - gpu_cc_protected_memory: int | NaType | None = None, type: str | NaType | None = None, # pylint: disable=redefined-builtin ) -> None: """Initialize the instance returned by :meth:`__new__()`.""" @@ -534,14 +532,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi else: self._gpu_instance_id = self._compute_instance_id = NA - if gpu_cc_protected_memory is None and not hasattr( - self, - '_gpu_cc_protected_memory', - ): - gpu_cc_protected_memory = NA - if gpu_cc_protected_memory is not None: - self.set_gpu_cc_protected_memory(gpu_cc_protected_memory) - for util in ('sm', 'memory', 'encoder', 'decoder'): if not hasattr(self, f'_gpu_{util}_utilization'): setattr(self, f'_gpu_{util}_utilization', NA) @@ -631,15 +621,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi """The percentage of used GPU memory by the process, or :const:`nvitop.NA` if not applicable.""" return self._gpu_memory_percent - def gpu_cc_protected_memory(self) -> int | NaType: # in bytes - """The used GPU conf compute protected memory in bytes, or :const:`nvitop.NA` if not applicable.""" - return self._gpu_cc_protected_memory - - def gpu_cc_protected_memory_human(self) -> str | NaType: # in human readable - # pylint: disable-next=line-too-long - """The used GPU conf compute protected memory in human readable format, or :const:`nvitop.NA` if not applicable.""" - return self._gpu_cc_protected_memory_human - def gpu_sm_utilization(self) -> int | NaType: # in percentage """The utilization rate of SM (Streaming Multiprocessor), or :const:`nvitop.NA` if not applicable.""" return self._gpu_sm_utilization @@ -667,12 +648,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi gpu_memory_percent = round(100.0 * memory_used / memory_total, 1) # type: ignore[assignment] self._gpu_memory_percent = gpu_memory_percent - def set_gpu_cc_protected_memory(self, value: int | NaType) -> None: - """Set the used GPU conf compute protected memory in bytes.""" - # pylint: disable=attribute-defined-outside-init - self._gpu_cc_protected_memory = value - self._gpu_cc_protected_memory_human = bytes2human(self.gpu_cc_protected_memory()) - def set_gpu_utilization( self, gpu_sm_utilization: int | NaType | None = None, @@ -694,7 +669,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi def update_gpu_status(self) -> int | NaType: """Update the GPU consumption status from a new NVML query.""" self.set_gpu_memory(NA) - self.set_gpu_cc_protected_memory(NA) self.set_gpu_utilization(NA, NA, NA, NA) processes = self.device.processes() process = processes.get(self.pid, self) @@ -702,7 +676,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi # The current process is gone and the instance has been removed from the cache. # Update GPU status from the new instance. self.set_gpu_memory(process.gpu_memory()) - self.set_gpu_cc_protected_memory(process.gpu_cc_protected_memory()) self.set_gpu_utilization( process.gpu_sm_utilization(), process.gpu_memory_utilization(), @@ -1031,8 +1004,6 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi gpu_memory_utilization=self.gpu_memory_utilization(), gpu_encoder_utilization=self.gpu_encoder_utilization(), gpu_decoder_utilization=self.gpu_decoder_utilization(), - gpu_cc_protected_memory=self.gpu_cc_protected_memory(), - gpu_cc_protected_memory_human=self.gpu_cc_protected_memory_human(), ) @classmethod