Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

SageMaker @remote function: Added multi-node functionality #4984

Merged
merged 13 commits into from
Jan 16, 2025

Conversation

brunopistone
Copy link
Collaborator

Issue #, if available:

Description of changes: Added the possibility to execute distributed SageMaker Training jobs across multiple nodes (multiple instances), by loading distributed environment variables

Testing done: Unit tests for remote_function, added 2 additional unit tests for single node and multi-node

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

  • I have read the CONTRIBUTING doc
  • I certify that the changes I am introducing will be backward compatible, and I have discussed concerns about this, if any, with the Python SDK team
  • I used the commit message format described in CONTRIBUTING
  • I have passed the region in to all S3 and STS clients that I've initialized as part of this change.
  • I have updated any necessary documentation, including READMEs and API docs (if appropriate)

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have added unit and/or integration tests as appropriate to ensure backward compatibility of the changes
  • I have checked that my tests are not configured for a specific region or account (if appropriate)
  • I have used unique_name_from_base to create resource names in integ tests (if appropriate)
  • If adding any dependency in requirements.txt files, I have spell checked and ensured they exist in PyPi

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@brunopistone brunopistone requested a review from a team as a code owner January 6, 2025 15:39
@brunopistone brunopistone requested a review from chad119 January 6, 2025 15:39
@@ -91,7 +91,7 @@ def remote(
use_spot_instances=False,
max_wait_time_in_seconds=None,
use_torchrun=False,
nproc_per_node=1,
nproc_per_node: Optional[int] = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

What does nproc stand for ? Can we use the unabbreviated string for the parameter ?

Comment on lines +358 to +375
except OSError:
logger.info("No Neurons detected (normal if no neurons installed)")
return 0
except subprocess.CalledProcessError as e:
if e.output is not None:
try:
msg = e.output.decode("utf-8").partition("error=")[2]
logger.info(
"No Neurons detected (normal if no neurons installed). \
If neuron installed then %s",
msg,
)
except AttributeError:
logger.info("No Neurons detected (normal if no neurons installed)")
else:
logger.info("No Neurons detected (normal if no neurons installed)")

return 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add unit tests for these ?
Or this file in general in a separate test file ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added 3 unit tests for the environment bootstrap:

  1. single instance with CPU
  2. single instance with multi GPUs
  3. multiple instances with multi GPUs

@nargokul nargokul merged commit ae3cc1c into aws:master Jan 16, 2025
13 of 14 checks passed
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants