chore(api/process): remove attribute gpu_cc_protected_memory

This commit is contained in:
Xuehai Pan 2023-08-26 10:51:51 +00:00
parent d44e6b7411
commit c16587511d
3 changed files with 0 additions and 32 deletions

View file

@ -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

View file

@ -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

View file

@ -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