Skip to content

Commit 7dd3a06

Browse files
authored
Bindings: fix missing wheel dependency in CUDA 13 container builds (#966)
* Bindings: fix missing wheel dependency in CUDA 13 container builds Signed-off-by: Ovidiu Mara <[email protected]> * Fix nixlbench container installation Signed-off-by: Ovidiu Mara <[email protected]> --------- Signed-off-by: Ovidiu Mara <[email protected]>
1 parent 51f36b7 commit 7dd3a06

File tree

11 files changed

+32
-37
lines changed

11 files changed

+32
-37
lines changed

benchmark/nixlbench/contrib/Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ RUN echo "/usr/local/nixl/lib/$ARCH-linux-gnu" > /etc/ld.so.conf.d/nixl.conf &&
205205
echo "/usr/local/nixl/lib/$ARCH-linux-gnu/plugins" >> /etc/ld.so.conf.d/nixl.conf && \
206206
ldconfig
207207

208-
RUN uv pip install .
208+
RUN CUDA_MAJOR=$(echo $CUDA_VERSION | cut -d. -f1) && \
209+
./contrib/tomlutil.py --wheel-name "nixl-cu${CUDA_MAJOR}" pyproject.toml && \
210+
uv pip install . && \
211+
uv pip install build/src/bindings/python/nixl-meta/nixl-*.whl
209212

210213
WORKDIR /workspace/nixlbench
211214

contrib/Dockerfile.manylinux

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ RUN IFS=',' read -ra PYTHON_VERSIONS <<< "$WHL_PYTHON_VERSIONS" && \
280280
--output-dir dist ; \
281281
done
282282

283-
# Copy the meta package wheel to the output directory
284-
RUN cp build/src/bindings/python/nixl-meta/nixl*.whl dist/
283+
# Copy the meta package wheel to the dist directory, which will be used to push to PyPI.
284+
# Only do this for the CUDA 12 builds, since by default nixl depends on nixl-cu12.
285+
RUN if [ "$(echo $CUDA_VERSION | cut -d. -f1)" = "12" ]; then \
286+
cp build/src/bindings/python/nixl-meta/nixl*.whl dist/; \
287+
fi
285288

286-
RUN uv pip install dist/nixl*cp${DEFAULT_PYTHON_VERSION//./}*.whl
289+
RUN uv pip install dist/nixl*cp${DEFAULT_PYTHON_VERSION//./}*.whl build/src/bindings/python/nixl-meta/nixl*.whl

contrib/build-wheel.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ if [ "$CUDA_MAJOR" -ne 12 ] && [ "$CUDA_MAJOR" -ne 13 ]; then
8383
exit 1
8484
fi
8585
PKG_NAME="nixl-cu${CUDA_MAJOR}"
86-
PKG_DIR="nixl_cu${CUDA_MAJOR}"
87-
./contrib/tomlutil.py --wheel-name $PKG_NAME --wheel-dir $PKG_DIR pyproject.toml
86+
./contrib/tomlutil.py --wheel-name $PKG_NAME pyproject.toml
8887
uv build --wheel --out-dir $TMP_DIR --python $PYTHON_VERSION
8988

9089
# Bundle libraries

contrib/tomlutil.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
parser = argparse.ArgumentParser()
2323
parser.add_argument("--wheel-name", type=str, help="Set the project name")
24-
parser.add_argument("--wheel-dir", type=str, help="Set the wheel dir")
2524
parser.add_argument("file", type=str, help="The toml file to modify")
2625
args = parser.parse_args()
2726

@@ -37,21 +36,5 @@
3736
# ```
3837
doc["project"]["name"] = args.wheel_name
3938

40-
if args.wheel_dir:
41-
# Set the wheel dir
42-
# Example:
43-
# ```toml
44-
# [tool.meson-python.args]
45-
# setup = ["-Dinstall_headers=false", "-Dwheel_dir=<wheel_dir>"]
46-
# ```
47-
if "meson-python" not in doc["tool"]:
48-
doc["tool"]["meson-python"] = tomlkit.table()
49-
if "args" not in doc["tool"]["meson-python"]:
50-
doc["tool"]["meson-python"]["args"] = tomlkit.table()
51-
setup = doc["tool"]["meson-python"]["args"].get("setup", [])
52-
setup = [s for s in setup if not s.startswith("-Dwheel_dir=")]
53-
setup.append(f"-Dwheel_dir={args.wheel_dir}")
54-
doc["tool"]["meson-python"]["args"]["setup"] = setup
55-
5639
with open(args.file, "w") as f:
5740
f.write(tomlkit.dumps(doc))

meson.build

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,21 @@ if cuda_dep.found()
107107
warning('GPUNETIO plugin not supported in CUDA version: ' + nvcc.version())
108108
doca_gpunetio_dep = disabler()
109109
endif
110+
111+
# Set the Python CUDA-specific wheel directory
112+
cuda_version_major = nvcc.version().split('.')[0]
113+
if cuda_version_major == '12'
114+
cuda_wheel_dir = 'nixl_cu12'
115+
elif cuda_version_major == '13'
116+
cuda_wheel_dir = 'nixl_cu13'
117+
else
118+
error('Unsupported CUDA version: ' + cuda_version_major)
119+
endif
110120
else
111121
warning('CUDA not found. UCX backend will be built without CUDA support, and some plugins will be disabled.')
112122
doca_gpunetio_dep = disabler()
123+
warning('CUDA not found, cannot autodetect wheel dir; defaulting to nixl_cu12')
124+
cuda_wheel_dir = 'nixl_cu12'
113125
endif
114126

115127
# DOCA GPUNETIO

meson_options.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ option('static_plugins', type: 'string', value: '', description: 'Plugins to be
2828
option('build_docs', type: 'boolean', value: false, description: 'Build Doxygen documentation')
2929
option('log_level', type: 'combo', choices: ['trace', 'debug', 'info', 'warning', 'error', 'fatal', 'auto'], value: 'auto', description: 'Log Level (auto: auto-detect based on build type: trace for debug builds, info for release builds)')
3030
option('rust', type: 'boolean', value: false, description: 'Build Rust bindings')
31-
option('wheel_dir', type : 'string', value : 'nixl', description : 'Set a custom Python wheel dir (e.g. nixl_cu12)')
3231

3332
# Tests
3433
option('build_tests', type: 'boolean', value: true, description: 'Build all tests')

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ dependencies = ["torch", "numpy"]
3434
profile = "black"
3535

3636
[tool.meson-python.args]
37-
setup = ['-Dinstall_headers=false', '-Dwheel_dir=nixl_cu12']
37+
setup = ['-Dinstall_headers=false']

src/api/python/meson.build

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515

1616
py = import('python').find_installation('python3', pure: false)
1717

18-
wheel_dir = get_option('wheel_dir')
19-
20-
py.install_sources('_api.py', subdir: (wheel_dir))
21-
py.install_sources('__init__.py', subdir: (wheel_dir))
22-
py.install_sources('py.typed', subdir: (wheel_dir))
23-
py.install_sources('logging.py', subdir: (wheel_dir))
18+
py.install_sources('_api.py', subdir: (cuda_wheel_dir))
19+
py.install_sources('__init__.py', subdir: (cuda_wheel_dir))
20+
py.install_sources('py.typed', subdir: (cuda_wheel_dir))
21+
py.install_sources('logging.py', subdir: (cuda_wheel_dir))

src/bindings/python/meson.build

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,16 @@ nixl_dep = declare_dependency(link_with: nixl_lib, include_directories: nixl_inc
1919

2020
py = import('python').find_installation('python3', pure: false)
2121

22-
wheel_dir = get_option('wheel_dir')
23-
2422
py.extension_module('_bindings',
2523
'nixl_bindings.cpp',
26-
subdir: (wheel_dir),
24+
subdir: (cuda_wheel_dir),
2725
dependencies: [nixl_dep, serdes_interface, pybind_dep],
2826
include_directories: [nixl_inc_dirs, utils_inc_dirs],
2927
install: true)
3028

3129
py.extension_module('_utils',
3230
'nixl_utils.cpp',
33-
subdir: (wheel_dir),
31+
subdir: (cuda_wheel_dir),
3432
dependencies: [pybind_dep],
3533
install: true)
3634

src/bindings/python/nixl-meta/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ build_dir = meson.current_build_dir()
2020
pyproject_toml = configure_file(
2121
input: 'pyproject.toml.in',
2222
output: 'pyproject.toml',
23-
configuration: { 'VERSION': meson.project_version() }
23+
configuration: { 'VERSION': meson.project_version(), 'WHEEL_DEP': cuda_wheel_dir.replace('_', '-') }
2424
)
2525

2626
readme_md = fs.copyfile('README.md')

0 commit comments

Comments
 (0)