mirror of
https://github.com/XuehaiPan/nvitop.git
synced 2026-05-15 14:15:55 -06:00
fix(select): fix CUDA device selection tool nvisel
This commit is contained in:
parent
8bef345bec
commit
aa9148d413
3 changed files with 16 additions and 6 deletions
|
|
@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
-
|
||||
- Fix CUDA device selection tool `nvisel` by [@XuehaiPan](https://github.com/XuehaiPan).
|
||||
|
||||
### Removed
|
||||
|
||||
|
|
|
|||
|
|
@ -458,18 +458,16 @@ class GpuProcess: # pylint: disable=too-many-instance-attributes,too-many-publi
|
|||
_ident: tuple
|
||||
_hash: int | None
|
||||
|
||||
# pylint: disable-next=too-many-arguments
|
||||
# pylint: disable-next=too-many-arguments,unused-argument
|
||||
def __new__(
|
||||
cls,
|
||||
pid: int | None,
|
||||
device: Device,
|
||||
*,
|
||||
# pylint: disable=unused-argument
|
||||
gpu_memory: int | NaType | None = None,
|
||||
gpu_instance_id: int | NaType | None = None,
|
||||
compute_instance_id: int | NaType | None = None,
|
||||
type: str | NaType | None = None, # pylint: disable=redefined-builtin
|
||||
# pylint: enable=unused-argument
|
||||
) -> Self:
|
||||
"""Return the cached instance of :class:`GpuProcess`."""
|
||||
if pid is None:
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ def select_devices( # pylint: disable=too-many-arguments
|
|||
) -> list[Device]: ...
|
||||
|
||||
|
||||
# pylint: disable-next=too-many-branches,too-many-statements,too-many-locals,unused-argument,too-many-arguments
|
||||
# pylint: disable-next=too-many-branches,too-many-statements,too-many-locals,too-many-arguments
|
||||
def select_devices(
|
||||
devices: Iterable[Device] | None = None,
|
||||
*,
|
||||
|
|
@ -562,7 +562,19 @@ def main() -> int:
|
|||
)
|
||||
return 3
|
||||
|
||||
identifiers = select_devices(devices, **vars(args))
|
||||
identifiers = select_devices( # type: ignore[call-overload]
|
||||
devices,
|
||||
format=args.format,
|
||||
min_count=args.min_count,
|
||||
max_count=args.max_count,
|
||||
min_free_memory=args.min_free_memory,
|
||||
min_total_memory=args.min_total_memory,
|
||||
max_gpu_utilization=args.max_gpu_utilization,
|
||||
max_memory_utilization=args.max_memory_utilization,
|
||||
tolerance=args.tolerance,
|
||||
free_accounts=args.free_accounts,
|
||||
sort=args.sort,
|
||||
)
|
||||
identifiers = list(map(str, identifiers))
|
||||
result = args.sep.join(identifiers)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue