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

make_distribute_tutorial_work_in_google_colab #3022

Conversation

venkatram-dev
Copy link
Contributor

@venkatram-dev venkatram-dev commented Aug 31, 2024

Fixes #ISSUE_NUMBER

#3003
#3009

Description

for issue 3003

mp.set_start_method("spawn") works in local (mac)
But using that does not work well in google colab, since it has some restrictions.
So added below code snippet to address both.

    if "google.colab" in sys.modules:
        print("Running in Google Colab")
        mp.get_context("spawn")
    else:
        mp.set_start_method("spawn")

Please note mp.set_start_method("fork") will also work in google colab. But it will work only if the code is run once.
Upon rerunning, it will fail. mp.get_context("spawn") allows multiple reruns with our restarting the session.

Also added clarification for issue 3009

`-  reading from ``tensor`` after ``dist.irecv()`` will result in undefined behaviour,
until ``req.wait()`` has been executed.`

Since the change is in the same file (and is little), I am trying to address both issues together.
I am happy to make 2 PRs if needed.

Checklist

  • The issue that is being fixed is referred in the description (see above "Fixes #ISSUE_NUMBER")
  • Only one issue is addressed in this pull request
  • Labels from the issue that this PR is fixing are added to this pull request
  • No unnecessary issues are included into this pull request.

cc @wconstab @osalpekar @H-Huang @kwen2501

Copy link

pytorch-bot bot commented Aug 31, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3022

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit c7f5a9d with merge base 01eeee6 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@venkatram-dev
Copy link
Contributor Author

@svekars , Please review.

Note : Since the change is in the same file (and is little), I am trying to address both issues together.
I am happy to make 2 PRs if needed.

Copy link

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as stale.
Feel free to remove the stale label if you feel this was a mistake.
If you are unable to remove the stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the stale Stale PRs label Dec 31, 2024
@c-p-i-o
Copy link
Contributor

c-p-i-o commented Jan 11, 2025

@venkatram-dev - do you want to resolve the conflicts and land this PR?

@svekars svekars merged commit e6fc189 into pytorch:main Jan 13, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants