def test_get_ucx_net_devices_auto(): pytest.importorskip("ucp") for idx in range(get_n_gpus()): # Since the actual device is system-dependent, we just check that # this function call doesn't fail. If any InfiniBand devices are # available, it will return that, otherwise an empty string. get_ucx_net_devices(idx, "auto")
def test_get_ucx_net_devices_callable(): net_devices = [ "mlx5_0:1", "mlx5_0:1", "mlx5_1:1", "mlx5_1:1", "mlx5_2:1", "mlx5_2:1", "mlx5_3:1", "mlx5_3:1", ] for idx in range(8): dev = get_ucx_net_devices(idx, lambda i: "mlx5_%d:1" % (i // 2)) assert dev == net_devices[idx]
def test_get_ucx_net_devices_raises(): with pytest.raises(ValueError): get_ucx_net_devices(None, "auto")
def test_get_ucx_net_devices_raises(): pytest.importorskip("ucp") with pytest.raises(ValueError): get_ucx_net_devices(None, "auto")