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

feat(pt): support CPU parallel training with PT #4224

Merged
merged 3 commits into from
Oct 23, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions deepmd/pt/entrypoints/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,18 @@
local_rank = os.environ.get("LOCAL_RANK")
if local_rank is not None:
local_rank = int(local_rank)
assert dist.is_nccl_available()
dist.init_process_group(backend="nccl")
nccl_available = dist.is_nccl_available()
gloo_available = dist.is_gloo_available()

Check warning on line 109 in deepmd/pt/entrypoints/main.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/entrypoints/main.py#L108-L109

Added lines #L108 - L109 were not covered by tests
# nccl first
if nccl_available:
backend = "nccl"
elif gloo_available:
backend = "gloo"

Check warning on line 114 in deepmd/pt/entrypoints/main.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/entrypoints/main.py#L111-L114

Added lines #L111 - L114 were not covered by tests
iProzd marked this conversation as resolved.
Show resolved Hide resolved
iProzd marked this conversation as resolved.
Show resolved Hide resolved
else:
raise RuntimeError(

Check warning on line 116 in deepmd/pt/entrypoints/main.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/entrypoints/main.py#L116

Added line #L116 was not covered by tests
"No suitable backend found. Neither NCCL nor Gloo is available."
)
dist.init_process_group(backend=backend)

Check warning on line 119 in deepmd/pt/entrypoints/main.py

View check run for this annotation

Codecov / codecov/patch

deepmd/pt/entrypoints/main.py#L119

Added line #L119 was not covered by tests
iProzd marked this conversation as resolved.
Show resolved Hide resolved

def prepare_trainer_input_single(
model_params_single, data_dict_single, rank=0, seed=None
Expand Down