Example #1
0
def test_nvml_nvlink_counters(ngpus, handles, counter, control, driver):

    if driver > 450.0:
        pytest.xfail(XFAIL_LEGACY_NVLINK_MSG)

    reset = 0
    for i in range(ngpus):
        for j in range(pynvml.NVML_NVLINK_MAX_LINKS):
            assert (
                pynvml.nvmlDeviceResetNvLinkUtilizationCounter(handles[i], j, counter)
                == pynvml.NVML_SUCCESS
            )
            pynvml.nvmlDeviceSetNvLinkUtilizationControl(
                handles[i], j, counter, control, reset
            )
            countdict = pynvml.nvmlDeviceGetNvLinkUtilizationCounter(
                handles[i], j, counter
            )
            ctl = pynvml.nvmlDeviceGetNvLinkUtilizationControl(handles[i], j, counter)
            assert countdict["rx"] >= 0
            assert countdict["tx"] >= 0
            assert ctl == control
            assert (
                pynvml.nvmlDeviceFreezeNvLinkUtilizationCounter(
                    handles[i], j, counter, 1
                )
                == pynvml.NVML_SUCCESS
            )
            assert (
                pynvml.nvmlDeviceFreezeNvLinkUtilizationCounter(
                    handles[i], j, counter, 0
                )
                == pynvml.NVML_SUCCESS
            )
Example #2
0
def test_nvml_nvlink_counters(ngpus, handles, counter, control):
    reset = 0
    for i in range(ngpus):
        for j in range(pynvml.NVML_NVLINK_MAX_LINKS):
            assert pynvml.nvmlDeviceResetNvLinkUtilizationCounter(
                handles[i], j, counter) == pynvml.NVML_SUCCESS
            pynvml.nvmlDeviceSetNvLinkUtilizationControl(
                handles[i], j, counter, control, reset)
            countdict = pynvml.nvmlDeviceGetNvLinkUtilizationCounter(
                handles[i], j, counter)
            ctl = pynvml.nvmlDeviceGetNvLinkUtilizationControl(
                handles[i], j, counter)
            assert countdict['rx'] >= 0
            assert countdict['tx'] >= 0
            assert ctl == control
            assert pynvml.nvmlDeviceFreezeNvLinkUtilizationCounter(
                handles[i], j, counter, 1) == pynvml.NVML_SUCCESS
            assert pynvml.nvmlDeviceFreezeNvLinkUtilizationCounter(
                handles[i], j, counter, 0) == pynvml.NVML_SUCCESS