Skip to content

nvmlSystemGetProcessName fails for WSL  #49

@fostiropoulos

Description

@fostiropoulos

nvmlSystemGetProcessName https://docs.nvidia.com/deploy/nvml-api/group__nvmlSystemQueries.html#group__nvmlSystemQueries_1gf37b04cea12ef2fcf6a463fed1b983b2

Based on the documentation returns the a string encoded in ANSI.

However it is automatically decoded in "utf-8"

return res.decode()

For this reason the function fails in WSL where the returned process name is in ANSI. ANSI encoding is not well-supported in Linux though.

A proposed solution would be to have a special case for windows (it already exists in other parts of the library) or set errors="ignore" for this specific function call (as it appears to be the only encoded in ANSI from the documentation)

Minimal Example

from pynvml.smi import nvidia_smi as smi

import torch
torch.randn(1000).to("cuda")
_instance = smi.getInstance()
# fails here
device = _instance.DeviceQuery()
device["gpu"][0]["processes"]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions