mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-22 06:05:47 -06:00
style(core/libnvml): rename functions
Signed-off-by: Xuehai Pan <XuehaiPan@pku.edu.cn>
This commit is contained in:
parent
c1039222df
commit
5bce06d7a9
1 changed files with 6 additions and 3 deletions
|
|
@ -498,7 +498,9 @@ def __patch_backward_compatibility_layers() -> None:
|
|||
'nvmlDeviceGetMPSComputeRunningProcesses_v2': 'nvmlDeviceGetMPSComputeRunningProcesses',
|
||||
}
|
||||
|
||||
def callback(name, names, exception, pynvml, modself): # pylint: disable=unused-argument
|
||||
def patch_process_info_callback(
|
||||
name, names, exception, pynvml, modself
|
||||
): # pylint: disable=unused-argument
|
||||
if name in nvmlDeviceGetRunningProcesses_v3_v2:
|
||||
mapping = nvmlDeviceGetRunningProcesses_v3_v2
|
||||
struct_type = c_nvmlProcessInfo_v2_t
|
||||
|
|
@ -523,10 +525,11 @@ def __patch_backward_compatibility_layers() -> None:
|
|||
_pynvml.__dict__.update( # need to use module.__dict__.__setitem__ because module.__setattr__ will not work
|
||||
# The patching ordering is important
|
||||
_nvmlGetFunctionPointer=patch_function_pointers_when_fail(
|
||||
names=set(nvmlDeviceGetRunningProcesses_v3_v2), callback=callback
|
||||
names=set(nvmlDeviceGetRunningProcesses_v3_v2), callback=patch_process_info_callback
|
||||
)(
|
||||
patch_function_pointers_when_fail(
|
||||
names=set(nvmlDeviceGetRunningProcesses_v2_v1), callback=callback
|
||||
names=set(nvmlDeviceGetRunningProcesses_v2_v1),
|
||||
callback=patch_process_info_callback,
|
||||
)(
|
||||
_pynvml._nvmlGetFunctionPointer # pylint: disable=protected-access
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue