[core] add nccl symmetric memory for all reduce (#24532)
Signed-off-by: Amir Samani <asamani@nvidia.com> Signed-off-by: Michael Goin <mgoin64@gmail.com> Co-authored-by: Michael Goin <mgoin64@gmail.com>
This commit is contained in:
co-authored by
Michael Goin
parent
a3a7828010
commit
8c1c81a3de
@@ -1383,6 +1383,38 @@ def find_nccl_library() -> str:
|
||||
return so_file
|
||||
|
||||
|
||||
def find_nccl_include_paths() -> Optional[list[str]]:
|
||||
"""
|
||||
We either use the nccl.h specified by the `VLLM_NCCL_INCLUDE_PATH`
|
||||
environment variable, or we find the library file brought by
|
||||
nvidia-nccl-cuXX. load_inline by default uses
|
||||
torch.utils.cpp_extension.include_paths
|
||||
"""
|
||||
paths: list[str] = []
|
||||
inc = envs.VLLM_NCCL_INCLUDE_PATH
|
||||
if inc and os.path.isdir(inc):
|
||||
paths.append(inc)
|
||||
|
||||
try:
|
||||
import importlib.util
|
||||
spec = importlib.util.find_spec("nvidia.nccl")
|
||||
if spec and getattr(spec, "submodule_search_locations", None):
|
||||
for loc in spec.submodule_search_locations:
|
||||
inc_dir = os.path.join(loc, "include")
|
||||
if os.path.exists(os.path.join(inc_dir, "nccl.h")):
|
||||
paths.append(inc_dir)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
seen = set()
|
||||
out: list[str] = []
|
||||
for p in paths:
|
||||
if p and p not in seen:
|
||||
out.append(p)
|
||||
seen.add(p)
|
||||
return out or None
|
||||
|
||||
|
||||
prev_set_stream = torch.cuda.set_stream
|
||||
|
||||
_current_stream_tls = threading.local()
|
||||
|
||||
Reference in New Issue
Block a user