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
Enabling Infiniband support for Gloo data channel with auto IB detection #4795
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3fb4357
Enabling Infiniband support for Gloo data channel
teng-li fa9ae6e
Automatic use IB if available or fallback to TCP
teng-li 40b9fa8
Set WITH_GLOO_IBVERBS off by default
teng-li b5a4201
Added IB detecter in tools.setup_helpers
teng-li b45de3a
Now use dist_check to check all distributed related and addressed com…
teng-li File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import os | ||
import platform | ||
import subprocess | ||
|
||
from .env import check_env_flag | ||
|
||
IS_WINDOWS = (platform.system() == 'Windows') | ||
|
||
WITH_DISTRIBUTED = not check_env_flag('NO_DISTRIBUTED') and not IS_WINDOWS | ||
WITH_DISTRIBUTED_MW = WITH_DISTRIBUTED and check_env_flag('WITH_DISTRIBUTED_MW') | ||
WITH_GLOO_IBVERBS = False | ||
|
||
IB_DEVINFO_CMD = "ibv_devinfo" | ||
|
||
|
||
def get_command_path(command): | ||
""" | ||
Helper function that checks if the command exists in the path and gets the | ||
full path of a given linux command if it exists. | ||
""" | ||
def excutable(command_path): | ||
return os.path.isfile(command_path) and os.access(command_path, os.X_OK) | ||
|
||
for path in os.environ["PATH"].split(os.pathsep): | ||
command_path = os.path.join(path, command) | ||
if excutable(command_path): | ||
return command_path | ||
|
||
return None | ||
|
||
|
||
def should_build_ib(): | ||
""" | ||
Helper function that detects the system's IB support and returns if we | ||
should build with IB support. | ||
""" | ||
try: | ||
# If the command doesn't exist, we can directly return instead of | ||
# making a subprocess call | ||
full_cmd_path = get_command_path(IB_DEVINFO_CMD) | ||
if not full_cmd_path: | ||
return False | ||
subprocess.check_output([full_cmd_path, "--list"]) | ||
# Here we just would like to simply run the command to test if IB | ||
# related tools / lib are installed without parsing the output. We | ||
# will enable IB build as long as the command runs successfully. | ||
# | ||
# The output should look like either: | ||
# | ||
# > ibv_devinfo --list | ||
# 0 HCAs founds: | ||
# | ||
# or | ||
# | ||
# > ibv_devinfo --list | ||
# 4 HCAs found: | ||
# mlx5_3 | ||
# mlx5_2 | ||
# mlx5_1 | ||
# mlx5_0 | ||
return True | ||
except Exception: | ||
# We just take all the exceptions here without affecting the build | ||
return False | ||
|
||
|
||
WITH_GLOO_IBVERBS = WITH_DISTRIBUTED and (should_build_ib() or | ||
check_env_flag("WITH_GLOO_IBVERBS")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as off-topic.
Sorry, something went wrong.