Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
DeepEP
Commits
26cf250a
Unverified
Commit
26cf250a
authored
Aug 05, 2025
by
windreamer
Committed by
GitHub
Aug 05, 2025
Browse files
build(setuptools): fix nvshmem dynamic library name searching in Python 3.9 (#351)
parent
ab0a3dd2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
setup.py
setup.py
+7
-6
No files found.
setup.py
View file @
26cf250a
...
@@ -2,13 +2,14 @@ import os
...
@@ -2,13 +2,14 @@ import os
import
subprocess
import
subprocess
import
setuptools
import
setuptools
import
importlib
import
importlib
import
importlib.resources
from
pathlib
import
Path
from
torch.utils.cpp_extension
import
BuildExtension
,
CUDAExtension
from
torch.utils.cpp_extension
import
BuildExtension
,
CUDAExtension
# Wheel specific: the wheels only include the soname of the host library `libnvshmem_host.so.X`
# Wheel specific: the wheels only include the soname of the host library `libnvshmem_host.so.X`
def
get_nvshmem_host_lib_name
():
def
get_nvshmem_host_lib_name
(
base_dir
):
for
path
in
importlib
.
resources
.
files
(
'nvidia.nvshmem'
).
iterdir
():
path
=
Path
(
base_dir
).
joinpath
(
'lib'
)
for
file
in
path
.
rglob
(
'libnvshmem_host.so.*'
):
for
file
in
path
.
rglob
(
'libnvshmem_host.so.*'
):
return
file
.
name
return
file
.
name
raise
ModuleNotFoundError
(
'libnvshmem_host.so not found'
)
raise
ModuleNotFoundError
(
'libnvshmem_host.so not found'
)
...
@@ -21,7 +22,7 @@ if __name__ == '__main__':
...
@@ -21,7 +22,7 @@ if __name__ == '__main__':
if
nvshmem_dir
is
None
:
if
nvshmem_dir
is
None
:
try
:
try
:
nvshmem_dir
=
importlib
.
util
.
find_spec
(
"nvidia.nvshmem"
).
submodule_search_locations
[
0
]
nvshmem_dir
=
importlib
.
util
.
find_spec
(
"nvidia.nvshmem"
).
submodule_search_locations
[
0
]
nvshmem_host_lib
=
get_nvshmem_host_lib_name
()
nvshmem_host_lib
=
get_nvshmem_host_lib_name
(
nvshmem_dir
)
import
nvidia.nvshmem
as
nvshmem
import
nvidia.nvshmem
as
nvshmem
except
(
ModuleNotFoundError
,
AttributeError
,
IndexError
):
except
(
ModuleNotFoundError
,
AttributeError
,
IndexError
):
print
(
'Warning: `NVSHMEM_DIR` is not specified, and the NVSHMEM module is not installed. All internode and low-latency features are disabled
\n
'
)
print
(
'Warning: `NVSHMEM_DIR` is not specified, and the NVSHMEM module is not installed. All internode and low-latency features are disabled
\n
'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment