Skip to content
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

MAINT: Simplify NCCL worker rank identification #1928

Closed
wants to merge 3 commits into from

Conversation

seberg
Copy link
Contributor

@seberg seberg commented Oct 25, 2023

This is a follow up on gh-1926, since the rank sorting seemed a bit hard to understand.
It does modify the logic in the sense that the host is now sorted by IP as a way to group based on it. But I don't really think that host sorting was ever a goal?

If the goal is really about being deterministic, then this should be more (or at least clearer) deterministic about order of worker IPs.
OTOH, if the NVML device order doesn't matter, we could just sort the workers directly.

The original gh-1587 mentions:

NCCL>1.11 expects a process with rank r to be mapped to r % num_gpus_per_node

which is something that neither approach seems to quite assure, if such a requirement exists, I would want to do one of:

  • Ensure we can guarantee this, but this requires initializing workers that are not involved in the operation.
  • At least raise an error, because if NCCL will end up raising the error it will be very confusing.

@seberg seberg requested a review from a team as a code owner October 25, 2023 11:48
@copy-pr-bot
Copy link

copy-pr-bot bot commented Oct 25, 2023

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@seberg seberg force-pushed the simplify-nccl-index branch from 7592639 to b76963e Compare October 25, 2023 11:49
@cjnolet
Copy link
Member

cjnolet commented Oct 27, 2023

/ok to test

@cjnolet cjnolet added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change labels Oct 27, 2023
@seberg seberg force-pushed the simplify-nccl-index branch from 399a37d to cef2263 Compare November 3, 2023 10:10
@cjnolet
Copy link
Member

cjnolet commented Nov 7, 2023

/ok to test

Copy link
Member

@cjnolet cjnolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM pending CI!

@cjnolet
Copy link
Member

cjnolet commented Nov 8, 2023

@seberg it looks like a couple of the test cases failed. Do you want to try and get these changes into 23.12?

@seberg seberg force-pushed the simplify-nccl-index branch from 5fb2c83 to fca015e Compare November 14, 2023 20:36
@cjnolet
Copy link
Member

cjnolet commented Nov 15, 2023

/ok to test

@cjnolet
Copy link
Member

cjnolet commented Jan 17, 2024

@seberg there's still a few failing tests in this PR. Do you still intend to contribute these improvements? (Just doing some PR upkeep while we're gearing up for release).

@cjnolet
Copy link
Member

cjnolet commented Jan 17, 2024

/ok to test

@cjnolet cjnolet changed the base branch from branch-23.12 to branch-24.02 January 17, 2024 15:56
@seberg seberg force-pushed the simplify-nccl-index branch 2 times, most recently from 9cccd58 to 8d2a9b0 Compare February 13, 2024 22:13
@seberg
Copy link
Contributor Author

seberg commented Feb 13, 2024

I have rebased the test away to partially to understand if that was the problem, I don't think it really got quite to the bottom of it anyway, although would be nice to have:

@pytest.mark.nccl
@pytest.mark.parametrize(
    "subset", [slice(-1, None), slice(1), slice(None, None, -2)]
)
def test_comm_init_worker_subset(client, subset):
    # Basic test that initializing a subset of workers is fine
    cb = Comms(comms_p2p=True, verbose=True)

    workers = list(client.scheduler_info()["workers"].keys())
    workers = workers[subset]
    cb.init(workers=workers)

This is a follow up on rapidsaigh-1926, since the rank sorting seemed
a bit hard to understand.
It does modify the logic in the sense that the host is now sorted
by IP as a way to group based on it.  But I don't really think that
host sorting was ever a goal?

If the goal is really about being deterministic, then this should
be more (or at least clearer) deterministic about order of worker
IPs.
OTOH, if the NVML device order doesn't matter, we could just sort
the workers directly.

The original rapidsaigh-1587 mentions:

    NCCL>1.11 expects a process with rank r to be mapped to r % num_gpus_per_node

which is something that neither approach seems to quite assure,
if such a requirement exists, I would want to do one of:
* Ensure we can guarantee this, but this requires initializing
  workers that are not involved in the operation.
* At least raise an error, because if NCCL will end up raising
  the error it will be very confusing.
@seberg seberg changed the base branch from branch-24.02 to branch-24.04 February 13, 2024 22:22
@seberg seberg force-pushed the simplify-nccl-index branch from 8d2a9b0 to 063bd70 Compare February 13, 2024 22:22
@VibhuJawa
Copy link
Member

@seberg , Would be amazing if we can get this PR in soon, in our internal cugraph experiments we ran into a error on 64+ nodes which seem to get fixed when we use this PR , dont really understand why but will be nice to get our customers unblocked.

@alexbarghi-nv
Copy link
Member

Just wanted to follow up on this; this PR is critical for us. We are currently unable to run at scale without it and have resorted to patching the containers we use for testing.

@seberg
Copy link
Contributor Author

seberg commented Mar 11, 2024

@VibhuJawa would you be able to take a look at it? I can see that my test was bad (although not sure in what way). Rebasing it away isn't great, but since it is, I really don't know what is blocking it (where there further test issues, beyond my failed attempt at adding a new test?).

@VibhuJawa
Copy link
Member

VibhuJawa commented Mar 12, 2024

@VibhuJawa would you be able to take a look at it?

Sure, will try to build and repro this locally and see where we land.

@VibhuJawa
Copy link
Member

Started a PR here with your test @seberg , Cant seem to recreate the error with this test (#1928 (comment)) locally so trying to recreate it on CI.

#2228

@seberg
Copy link
Contributor Author

seberg commented Mar 15, 2024

I am not sure if the tests will hit anything. I thought the test should run into it (before your old fixes anyway) but that is only if it is run with an set/number of workers on it.

@VibhuJawa
Copy link
Member

VibhuJawa commented Mar 15, 2024

I am not sure if the tests will hit anything. I thought the test should run into it (before your old fixes anyway) but that is only if it is run with an set/number of workers on it.

Yup, I agree. It's good to have a test and that the test is only valid at a certain scale of use.

I think it will be useful for me and users in general when running into problems at scale (often >128 workers) and verify all of the raft dask tests pass.

Lets see if CI passes #2228 here , (last run ran into unrelated C++ test issues which i think should be fixed after merging main into it).

If the tests pass , we can either merge that PR or this PR with tests added (no preference) , if it does not it gives us info for triaging actual failures.

@VibhuJawa
Copy link
Member

VibhuJawa commented Mar 15, 2024

@seberg , Looks like CI passed, Do you think we should just merge in #2228 , once we have your approval and go ahead ? (Will obviously edit the PR title, description etc to match this PR)

@seberg
Copy link
Contributor Author

seberg commented Mar 15, 2024

Sure, go ahead.

@seberg seberg closed this Mar 15, 2024
rapids-bot bot pushed a commit that referenced this pull request Mar 15, 2024
This PR is based on @seberg work in  #1928 .  

From the PR:


This is a follow up on #1926, since the rank sorting seemed a bit hard to understand.

It does modify the logic in the sense that the host is now sorted by IP as a way to group based on it. But I don't really think that host sorting was ever a goal? 

If the goal is really about being deterministic, then this should be more (or at least clearer) deterministic about order of worker IPs.

OTOH, if the NVML device order doesn't matter, we could just sort the workers directly. 

The original #1587 mentions:

NCCL>1.11 expects a process with rank r to be mapped to r % num_gpus_per_node
which is something that neither approach seems to quite assure, if such a requirement exists, I would want to do one of:

Ensure we can guarantee this, but this requires initializing workers that are not involved in the operation.
At least raise an error, because if NCCL will end up raising the error it will be very confusing.

Authors:
  - Vibhu Jawa (https://github.com/VibhuJawa)
  - Sebastian Berg (https://github.com/seberg)

Approvers:
  - Corey J. Nolet (https://github.com/cjnolet)

URL: #2228
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change python
Projects
Development

Successfully merging this pull request may close these issues.

4 participants