Skip to content

Commit 903b394

Browse files
rparolinclaude
andcommitted
fix(test): unblock root pixi run test workflow
`pixi run test` failed at the cuda_bindings build stage because list-form pixi `cmd` arrays didn't expand `$PIXI_ENVIRONMENT_NAME` reliably, so the inner per-package `pixi run` calls picked the cuda_bindings default environment (no cuda-version pin). The conda solver then resolved cuda-version=12.9 and the build failed with a missing `CUatomicOperation_enum` (a CUDA-13.x-only symbol). Wrap the three test-* tasks in `bash -c '...'` so the shell expands `$PIXI_ENVIRONMENT_NAME` and forward it explicitly via `-e` to each inner pixi run. Once the bindings build was unblocked, cuda_core's cython test build hit a second issue: `cythonize` cannot resolve `cimport cuda.bindings.*` against pixi-build's editable install, which exposes the cuda namespace package via a finder hook that Cython's filesystem .pxd resolver does not consult. Replace the `cythonize` CLI invocation with a small Python wrapper that calls `Cython.Build.cythonize()` with an explicit `include_path` resolved from the imported `cuda.bindings` package. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9eec539 commit 903b394

3 files changed

Lines changed: 45 additions & 13 deletions

File tree

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# The Cython CLI has no --include-path flag, and pixi-build's editable install
5+
# exposes the cuda namespace package through a finder hook that Cython's
6+
# filesystem .pxd resolver does not consult. Locate the package's parent
7+
# directory at runtime and pass it to cythonize() explicitly.
8+
9+
import glob
10+
import os
11+
from pathlib import Path
12+
13+
import cuda.bindings
14+
from Cython.Build import cythonize
15+
from setuptools import setup
16+
17+
HERE = Path(__file__).resolve().parent
18+
CUDA_PKG_PARENT = Path(cuda.bindings.__file__).parents[2]
19+
20+
# `setup(... build_ext --inplace)` resolves the .so destination relative to cwd
21+
# and the module's basename, so chdir into HERE before invoking it.
22+
os.chdir(HERE)
23+
24+
extensions = cythonize(
25+
sorted(glob.glob("test_*.pyx")),
26+
language_level=3,
27+
include_path=[str(CUDA_PKG_PARENT)],
28+
compiler_directives={"freethreading_compatible": True},
29+
)
30+
31+
setup(ext_modules=extensions, script_args=["build_ext", "--inplace"])

cuda_core/tests/cython/build_tests.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ else
1515
exit 1
1616
fi
1717

18-
cythonize -3 -i -Xfreethreading_compatible=True ${SCRIPTPATH}/test_*.pyx
18+
python "${SCRIPTPATH}/build_tests.py"

pixi.toml

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,30 @@ PIXI_ENVIRONMENT_NAME = "${PIXI_ENVIRONMENT_NAME/default/cu13}"
1919

2020
# Test Tasks
2121
# Runs tests across all sub-packages: pathfinder → bindings → core (dependency order)
22-
# Each sub-package has its own pixi.toml; the -e environment propagates via PIXI_ENVIRONMENT_NAME
22+
# Each sub-package has its own pixi.toml; the active environment is forwarded
23+
# explicitly via -e "$PIXI_ENVIRONMENT_NAME" in each inner pixi run.
2324
#
2425
# Usage: pixi run test | pixi run -e cu12 test | pixi run -e cu13 test
2526
[target.linux.tasks.test-pathfinder]
2627
cmd = [
27-
"pixi",
28-
"run",
29-
"--manifest-path",
30-
"$PIXI_PROJECT_ROOT/cuda_pathfinder",
31-
"test",
28+
"bash",
29+
"-c",
30+
'pixi run --manifest-path "$PIXI_PROJECT_ROOT/cuda_pathfinder" -e "$PIXI_ENVIRONMENT_NAME" test',
3231
]
3332

3433
[target.linux.tasks.test-bindings]
3534
cmd = [
36-
"pixi",
37-
"run",
38-
"--manifest-path",
39-
"$PIXI_PROJECT_ROOT/cuda_bindings",
40-
"test",
35+
"bash",
36+
"-c",
37+
'pixi run --manifest-path "$PIXI_PROJECT_ROOT/cuda_bindings" -e "$PIXI_ENVIRONMENT_NAME" test',
4138
]
4239

4340
[target.linux.tasks.test-core]
44-
cmd = ["pixi", "run", "--manifest-path", "$PIXI_PROJECT_ROOT/cuda_core", "test"]
41+
cmd = [
42+
"bash",
43+
"-c",
44+
'pixi run --manifest-path "$PIXI_PROJECT_ROOT/cuda_core" -e "$PIXI_ENVIRONMENT_NAME" test',
45+
]
4546

4647
[target.linux.tasks.test]
4748
depends-on = [

0 commit comments

Comments
 (0)