-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Use random default port instead of a fix one #587
Conversation
@@ -603,7 +603,8 @@ def init_ddp_connection(self): | |||
default_port = int(default_port) + 15000 | |||
|
|||
except Exception as e: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls, drop the as e
@@ -603,7 +603,8 @@ def init_ddp_connection(self): | |||
default_port = int(default_port) + 15000 | |||
|
|||
except Exception as e: | |||
default_port = 12910 | |||
import random | |||
default_port = random.randint(15000,65535) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
user numpy.random.randint()
actually, this won’t work. |
so what about random port which will be the save over the package? |
how? ddp starts a process independently for each GPU, and you can’t guarantee the same number. |
You would have to set it in init, but I need to have look at it in detail... |
can’t set in init because the processes all run at different times without guarantee of the same start time |
How about hashing the python cmd args to a get a fix random number for all processes as a workaround? |
well if you set |
random seed is standard for anything ML. that doesn’t solve the problem though. but hashing the command might be a good option |
Before submitting
What does this PR do?
Fixes #485.
PR review
Anyone in the community is free to review the PR once the tests have passed.
If we didn't discuss your PR in Github issues there's a high chance it will not be merged.
Did you have fun?
Make sure you had fun coding 🙃