mirror of
https://github.com/microsoft/mscclpp.git
synced 2026-05-11 17:00:22 +00:00
Support python wheel build (#787)
## Support Python wheel build This PR modernizes the Python packaging for MSCCL++ by defining dependencies and optional extras in `pyproject.toml`, enabling proper wheel builds with `pip install ".[cuda12]"`. ### Changes **`pyproject.toml`** - Add `dependencies` (numpy, blake3, pybind11, sortedcontainers) - Add `optional-dependencies` for platform-specific CuPy (`cuda11`, `cuda12`, `cuda13`, `rocm6`), `benchmark`, and `test` extras - Bump minimum Python version from 3.8 to 3.10 **`test/deploy/setup.sh`** - Use `pip install ".[<platform>,benchmark,test]"` instead of separate `pip install -r requirements_*.txt` + `pip install .` steps - Add missing CUDA 13 case **`docs/quickstart.md`** - Update install instructions to use extras (e.g., `pip install ".[cuda12]"`) - Document all available extras and clarify that `rocm6` builds CuPy from source - Update Python version references to 3.10 **`python/csrc/CMakeLists.txt`**, **`python/test/CMakeLists.txt`** - Update `find_package(Python)` from 3.8 to 3.10 ### Notes - The `requirements_*.txt` files are kept for Docker base image builds where only dependencies (not the project itself) should be installed. - CuPy is intentionally not in base dependencies — users must specify a platform extra to get the correct pre-built wheel (or source build for ROCm). --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
find_package(Python 3.10 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(nanobind GIT_REPOSITORY https://github.com/wjakob/nanobind.git GIT_TAG v1.9.2)
|
||||
FetchContent_MakeAvailable(nanobind)
|
||||
|
||||
@@ -192,6 +192,9 @@ class NativeCodeCompiler:
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self._initialized = False
|
||||
|
||||
def _do_init(self):
|
||||
self._is_hip = cp.cuda.runtime.is_hip
|
||||
self._device_arch = get_device_arch()
|
||||
self._compiler = self._get_compiler()
|
||||
@@ -226,6 +229,7 @@ class NativeCodeCompiler:
|
||||
]
|
||||
self._cache_dir = Path(env().cache_dir) / "native"
|
||||
self._cache_dir.mkdir(parents=True, exist_ok=True)
|
||||
self._initialized = True
|
||||
|
||||
def _get_compiler(self) -> str:
|
||||
"""Get the path to the appropriate compiler.
|
||||
@@ -246,6 +250,8 @@ class NativeCodeCompiler:
|
||||
Returns:
|
||||
str: The GPU architecture string (e.g., "sm_90" for NVIDIA or "gfx90a" for AMD).
|
||||
"""
|
||||
if not self._initialized:
|
||||
self._do_init()
|
||||
return self._device_arch
|
||||
|
||||
def __call__(self, name: str, file: str, **kwds):
|
||||
@@ -290,6 +296,8 @@ class NativeCodeCompiler:
|
||||
>>> # Use the module to create an algorithm
|
||||
>>> algo = module.create_allreduce_algorithm(comm, buffer, size)
|
||||
"""
|
||||
if not self._initialized:
|
||||
self._do_init()
|
||||
if not os.path.isfile(file):
|
||||
raise FileNotFoundError(f"The specified source file does not exist: {file}")
|
||||
|
||||
|
||||
@@ -5,6 +5,6 @@ netifaces
|
||||
pytest
|
||||
numpy
|
||||
matplotlib
|
||||
sortedcontainers @ git+https://github.com/grantjenks/python-sortedcontainers.git@3ac358631f58c1347f1d6d2d92784117db0f38ed
|
||||
sortedcontainers
|
||||
blake3
|
||||
pybind11
|
||||
@@ -5,6 +5,6 @@ netifaces
|
||||
pytest
|
||||
numpy
|
||||
matplotlib
|
||||
sortedcontainers @ git+https://github.com/grantjenks/python-sortedcontainers.git@3ac358631f58c1347f1d6d2d92784117db0f38ed
|
||||
sortedcontainers
|
||||
blake3
|
||||
pybind11
|
||||
@@ -5,6 +5,6 @@ netifaces
|
||||
pytest
|
||||
numpy
|
||||
matplotlib
|
||||
sortedcontainers @ git+https://github.com/grantjenks/python-sortedcontainers.git@3ac358631f58c1347f1d6d2d92784117db0f38ed
|
||||
sortedcontainers
|
||||
blake3
|
||||
pybind11
|
||||
@@ -5,6 +5,6 @@ netifaces
|
||||
pytest
|
||||
numpy
|
||||
matplotlib
|
||||
sortedcontainers @ git+https://github.com/grantjenks/python-sortedcontainers.git@3ac358631f58c1347f1d6d2d92784117db0f38ed
|
||||
sortedcontainers
|
||||
blake3
|
||||
pybind11
|
||||
@@ -1,7 +1,7 @@
|
||||
# Copyright (c) Microsoft Corporation.
|
||||
# Licensed under the MIT license.
|
||||
|
||||
find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
find_package(Python 3.10 COMPONENTS Interpreter Development.Module REQUIRED)
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(nanobind GIT_REPOSITORY https://github.com/wjakob/nanobind.git GIT_TAG v1.4.0)
|
||||
FetchContent_MakeAvailable(nanobind)
|
||||
|
||||
Reference in New Issue
Block a user