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

fix hostname -I for macOS #6497 #6990

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
10 changes: 7 additions & 3 deletions deepspeed/comm/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,13 @@ def mpi_discovery(distributed_port=TORCH_DISTRIBUTED_DEFAULT_PORT, verbose=True)
master_addr = None
if rank == 0:
import shlex
hostname_cmd = shlex.split("hostname -I")
result = subprocess.check_output(hostname_cmd)
master_addr = result.decode('utf-8').split()[0]
try:
Copy link
Collaborator

Choose a reason for hiding this comment

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

@fitzjalen - could you also run the pre-commit formatter in order to meet the Formatting requirements?

Copy link
Author

Choose a reason for hiding this comment

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

Yes, sure

Copy link
Author

Choose a reason for hiding this comment

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

@loadams done. New commit pushed with pre-commit reqs (4d11f93)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks @fitzjalen - it looks like you'll need to use the new DCO to sign off on your commits. If you click the details button below it will give you information on how to rebase and fix this, thanks for your PR!

hostname_cmd = shlex.split("hostname -I")
result = subprocess.check_output(hostname_cmd)
master_addr = result.decode('utf-8').split()[0]
except subprocess.CalledProcessError: # hostname -I not available (e.g. on macOS)
import socket
master_addr = socket.gethostbyname(socket.gethostname())
loadams marked this conversation as resolved.
Show resolved Hide resolved
master_addr = comm.bcast(master_addr, root=0)

# Determine local rank by assuming hostnames are unique
Expand Down