-
Notifications
You must be signed in to change notification settings - Fork 197
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[REVIEW] Add scheduler_file argument to support MNMG setup #1593
Changes from all commits
40ea1ca
1e594db
e943d2d
1271dc7
af8e2c0
f4530c3
5281041
6629add
1581466
edb491d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Copyright (c) 2020-2023, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,71 @@ | ||
# Copyright (c) 2022, NVIDIA CORPORATION. | ||
# Copyright (c) 2022-2023, NVIDIA CORPORATION. | ||
|
||
import os | ||
|
||
import pytest | ||
|
||
from dask.distributed import Client | ||
from dask_cuda import LocalCUDACluster, initialize | ||
from dask_cuda import LocalCUDACluster | ||
|
||
os.environ["UCX_LOG_LEVEL"] = "error" | ||
|
||
|
||
enable_tcp_over_ucx = True | ||
enable_nvlink = False | ||
enable_infiniband = False | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def cluster(): | ||
cluster = LocalCUDACluster(protocol="tcp", scheduler_port=0) | ||
yield cluster | ||
cluster.close() | ||
scheduler_file = os.environ.get("SCHEDULER_FILE") | ||
if scheduler_file: | ||
yield scheduler_file | ||
else: | ||
cluster = LocalCUDACluster(protocol="tcp", scheduler_port=0) | ||
yield cluster | ||
cluster.close() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def ucx_cluster(): | ||
initialize.initialize( | ||
create_cuda_context=True, | ||
enable_tcp_over_ucx=enable_tcp_over_ucx, | ||
enable_nvlink=enable_nvlink, | ||
enable_infiniband=enable_infiniband, | ||
) | ||
cluster = LocalCUDACluster( | ||
protocol="ucx", | ||
enable_tcp_over_ucx=enable_tcp_over_ucx, | ||
enable_nvlink=enable_nvlink, | ||
enable_infiniband=enable_infiniband, | ||
) | ||
yield cluster | ||
cluster.close() | ||
Comment on lines
-27
to
-40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is no longer needed: https://docs.rapids.ai/api/dask-cuda/nightly/examples/ucx/#localcudacluster-with-automatic-configuration |
||
scheduler_file = os.environ.get("SCHEDULER_FILE") | ||
if scheduler_file: | ||
yield scheduler_file | ||
else: | ||
cluster = LocalCUDACluster( | ||
protocol="ucx", | ||
) | ||
yield cluster | ||
cluster.close() | ||
|
||
|
||
@pytest.fixture(scope="session") | ||
def client(cluster): | ||
client = Client(cluster) | ||
client = create_client(cluster) | ||
yield client | ||
client.close() | ||
|
||
|
||
@pytest.fixture() | ||
def ucx_client(ucx_cluster): | ||
client = Client(cluster) | ||
client = create_client(ucx_cluster) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this was a bug previously where we passed Will revert if this was intentional. |
||
yield client | ||
client.close() | ||
|
||
|
||
def create_client(cluster): | ||
""" | ||
Create a Dask distributed client for a specified cluster. | ||
|
||
Parameters | ||
---------- | ||
cluster : LocalCUDACluster instance or str | ||
If a LocalCUDACluster instance is provided, a client will be created | ||
for it directly. If a string is provided, it should specify the path to | ||
a Dask scheduler file. A client will then be created for the cluster | ||
referenced by this scheduler file. | ||
|
||
Returns | ||
------- | ||
dask.distributed.Client | ||
A client connected to the specified cluster. | ||
""" | ||
if isinstance(cluster, LocalCUDACluster): | ||
return Client(cluster) | ||
else: | ||
return Client(scheduler_file=cluster) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to add this as we run tests on workers and scheduler and this module needs to be importable for that to happen in dask when running on a non local cluster.