gpuopenanalytics / pynvml

Provide Python access to the NVML library for GPU diagnostics
BSD 3-Clause "New" or "Revised" License
214 stars 30 forks source link

[pytest] test_nvmlSystemGetDriverVersion() and test_nvmlSystemGetNVMLVersion() fails #22

Closed ksangeek closed 4 years ago

ksangeek commented 4 years ago

Describe the bug test_nvmlSystemGetDriverVersion() and test_nvmlSystemGetNVMLVersion() fails because the version number reported cannot be cast to float as expected by the testcase.

Steps/Code to reproduce bug Executing the pytest reports these failures in pynvml/tests/test_nvml.py test file -

________________________ test_nvmlSystemGetNVMLVersion _________________________

nvml = None

    def test_nvmlSystemGetNVMLVersion(nvml):
        vsn = 0.0
>       vsn = float(pynvml.nvmlSystemGetDriverVersion().decode())
E       ValueError: could not convert string to float: '440.33.01'

test_nvml.py:57: ValueError
_______________________ test_nvmlSystemGetDriverVersion ________________________

nvml = None

    def test_nvmlSystemGetDriverVersion(nvml):
        vsn = 0.0
>       vsn = float(pynvml.nvmlSystemGetDriverVersion().decode())
E       ValueError: could not convert string to float: '440.33.01'

test_nvml.py:71: ValueError
ksangeek commented 4 years ago

As is understood with the above error messages, it is clear that the attempt to cast the driver version number with multiple dots . e.g. 440.33.01 to float is not working. https://github.com/gpuopenanalytics/pynvml/blob/f778ba4f4c7da2bcdd2abca8bd190994ecd879d3/pynvml/tests/test_nvml.py#L72

ksangeek commented 4 years ago

With the changes proposed in PR https://github.com/gpuopenanalytics/pynvml/pull/23 I am able to get past this issue. Please let me know if there are suggestions to improve the test or any other review comments. Thanks.

ksangeek commented 4 years ago

Fixed using https://github.com/gpuopenanalytics/pynvml/pull/23. Thanks!