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

Remove use of local rank in trainers #926

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

rayg1234
Copy link
Collaborator

@rayg1234 rayg1234 commented Nov 25, 2024

Remove use local_rank to set cuda devices all together. Previously this was behind a feature flag but instead of maintaining the 2 versions, its easier to just consolidate since the local multiple-GPU runs are bugged right now and multiple ranks can be assigned on the same device. Each rank now will only see their local GPU (GPU-0) and not 8 devices.

After this there shouldn't be any code that tries to assign a cuda device that isn't "cuda" or "cuda:0".

To sanity check:

  • Local 1 rank run
  • Local N rank run
  • Cluster run

@rayg1234 rayg1234 added enhancement New feature or request minor Minor version release labels Nov 25, 2024
Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/fairchem/core/common/distutils.py 50.00% 1 Missing ⚠️
src/fairchem/core/trainers/base_trainer.py 0.00% 1 Missing ⚠️
Files with missing lines Coverage Δ
src/fairchem/core/_cli_hydra.py 69.73% <ø> (-0.42%) ⬇️
src/fairchem/core/trainers/ocp_trainer.py 69.66% <ø> (ø)
src/fairchem/core/common/distutils.py 57.04% <50.00%> (+0.49%) ⬆️
src/fairchem/core/trainers/base_trainer.py 87.19% <0.00%> (+0.19%) ⬆️

@rayg1234 rayg1234 requested a review from misko November 25, 2024 21:38
@rayg1234 rayg1234 marked this pull request as ready for review November 25, 2024 21:38
@rayg1234 rayg1234 changed the title [WIP] Remove use of local rank in trainers Remove use of local rank in trainers Nov 25, 2024
misko
misko previously approved these changes Nov 26, 2024
Copy link
Collaborator

@misko misko left a comment

Choose a reason for hiding this comment

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

LGTM! Looks great!

# TODO: dealing with local rank is dangerous
# T201111838 remove this and use CUDA_VISIBILE_DEVICES instead so trainers don't need to know about which devie to use
local_rank: int,
local_rank: int, # DEPRECATED, DO NOT USE
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we just remove this altogether and let if fail if used? or does it cause deeper issues if we do?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request minor Minor version release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants