Skip to content

Commit ba01e22

Browse files
Build conda python packages independently of the Python version
Build one set of conda python packages per CUDA x arch instead of one per Python version, taking conda-python-build from 16 jobs to 4. All three python packages have to become version-independent for the matrix filter to be safe, since they share a single output channel: - cuopt: abi3 via 'version_independent: true', built against the minimum supported Python. 'python-gil' is dropped because 'python-abi3' already depends on it transitively, and cython is raised to >=3.2.2 for its Limited API support. - cuopt-server, cuopt-sh-client: 'noarch: python'. Neither builds extension modules. build.sh passes the abi3 floor only for cuopt, so the two pure packages keep using the plain install args. Depends on #1731, which sets 'wheel.py-api' in python/cuopt. Signed-off-by: Ramakrishna Prabhu <ramakrishnap@nvidia.com>
1 parent 187f06a commit ba01e22

10 files changed

Lines changed: 33 additions & 18 deletions

File tree

.github/workflows/build.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ jobs:
8181
date: ${{ inputs.date }}
8282
sha: ${{ inputs.sha }}
8383
script: ci/build_python.sh
84+
# Build a conda package for each CUDA x ARCH x minimum supported Python version
85+
matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber)))
8486
upload-conda:
8587
needs: [cpp-build, python-build]
8688
permissions:

.github/workflows/pr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,8 @@ jobs:
412412
build_type: pull-request
413413
build-datetime: ${{ needs.build-details.outputs.build-datetime }}
414414
script: ci/build_python.sh
415+
# Build a conda package for each CUDA x ARCH x minimum supported Python version
416+
matrix_filter: group_by({CUDA_VER, ARCH}) | map(min_by(.PY_VER | split(".") | map(tonumber)))
415417
conda-python-tests:
416418
needs: [conda-python-build, changed-files]
417419
permissions:

build.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,15 @@ fi
432432
if buildAll || hasArg cuopt; then
433433
cd "${REPODIR}"/python/cuopt
434434

435+
# Only 'cuopt' builds extension modules, so the stable ABI floor applies to it
436+
# alone. If 'RAPIDS_PY_VERSION' is set, use it as that floor.
437+
CUOPT_PYTHON_ARGS_FOR_INSTALL=("${PYTHON_ARGS_FOR_INSTALL[@]}")
438+
if [ -n "${RAPIDS_PY_VERSION:-}" ]; then
439+
CUOPT_PYTHON_ARGS_FOR_INSTALL+=(--config-settings "skbuild.wheel.py-api=cp${RAPIDS_PY_VERSION//./}")
440+
fi
441+
435442
SKBUILD_CMAKE_ARGS="-DCMAKE_PREFIX_PATH=${INSTALL_PREFIX};-DCMAKE_LIBRARY_PATH=${LIBCUOPT_BUILD_DIR};-DCMAKE_CUDA_ARCHITECTURES=${CUOPT_CMAKE_CUDA_ARCHITECTURES};$(IFS=';'; echo "${EXTRA_CMAKE_ARGS[*]}")" \
436-
python "${PYTHON_ARGS_FOR_INSTALL[@]}" .
443+
python "${CUOPT_PYTHON_ARGS_FOR_INSTALL[@]}" .
437444
fi
438445

439446
# Build and install the cuopt_server Python package

ci/build_docs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export RAPIDS_VERSION_MAJOR_MINOR
1818

1919
rapids-logger "Downloading artifacts from previous jobs"
2020
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuopt cuopt --cuda "$RAPIDS_CUDA_VERSION")")
21-
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --py "$RAPIDS_PY_VERSION" --cuda "$RAPIDS_CUDA_VERSION")")
21+
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --stable --cuda "$RAPIDS_CUDA_VERSION")")
2222

2323
rapids-logger "Generating conda environment YAML"
2424

ci/build_python.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,5 @@ rattler-build build --recipe conda/recipes/cuopt-sh-client \
6767
# tracked in https://github.com/prefix-dev/rattler-build/issues/1424
6868
rm -rf "$RAPIDS_CONDA_BLD_OUTPUT_DIR"/build_cache
6969

70-
RAPIDS_PACKAGE_NAME="$(rapids-artifact-name conda_python cuopt cuopt --py "$RAPIDS_PY_VERSION" --cuda "$RAPIDS_CUDA_VERSION")"
70+
RAPIDS_PACKAGE_NAME="$(rapids-artifact-name conda_python cuopt cuopt --stable --cuda "$RAPIDS_CUDA_VERSION")"
7171
export RAPIDS_PACKAGE_NAME

ci/test_notebooks.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ conda config --set channel_priority strict
1212

1313
rapids-logger "Downloading artifacts from previous jobs"
1414
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuopt cuopt --cuda "$RAPIDS_CUDA_VERSION")")
15-
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --py "$RAPIDS_PY_VERSION" --cuda "$RAPIDS_CUDA_VERSION")")
15+
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --stable --cuda "$RAPIDS_CUDA_VERSION")")
1616

1717
rapids-logger "Generate notebook testing dependencies"
1818

ci/test_python.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ conda config --set channel_priority strict
1212

1313
rapids-logger "Downloading artifacts from previous jobs"
1414
CPP_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_cpp libcuopt cuopt --cuda "$RAPIDS_CUDA_VERSION")")
15-
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --py "$RAPIDS_PY_VERSION" --cuda "$RAPIDS_CUDA_VERSION")")
15+
PYTHON_CHANNEL=$(rapids-download-from-github "$(rapids-artifact-name conda_python cuopt cuopt --stable --cuda "$RAPIDS_CUDA_VERSION")")
1616

1717
rapids-logger "Generate Python testing dependencies"
1818
rapids-dependency-file-generator \

conda/recipes/cuopt-server/recipe.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ schema_version: 1
55
context:
66
version: ${{ env.get("RAPIDS_PACKAGE_VERSION") }}
77
datetime_string: '${{ env.get("RAPIDS_DATETIME_STRING") }}'
8-
py_version: ${{ env.get("RAPIDS_PY_VERSION") }}
9-
py_buildstring: ${{ py_version | version_to_buildstring }}
108
head_rev: '${{ git.head_rev(".")[:8] }}'
119

1210
package:
@@ -17,7 +15,8 @@ source:
1715
path: ../../..
1816

1917
build:
20-
string: py${{ py_buildstring }}_${{ datetime_string }}_${{ head_rev }}
18+
noarch: python
19+
string: ${{ datetime_string }}_${{ head_rev }}
2120
script:
2221
content: |
2322
# We pass an explicit matrix-entry here along with `disable-cuda=true` to
@@ -28,7 +27,7 @@ build:
2827
requirements:
2928
host:
3029
- pip
31-
- python-gil =${{ py_version }}
30+
- python >=3.11
3231
- rapids-build-backend >=0.4.0,<0.5.0
3332
- setuptools>=77.0.0
3433
run:

conda/recipes/cuopt-sh-client/recipe.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ context:
66
version: ${{ env.get("RAPIDS_PACKAGE_VERSION") }}
77
minor_version: ${{ (version | split("."))[:2] | join(".") }}
88
datetime_string: '${{ env.get("RAPIDS_DATETIME_STRING") }}'
9-
py_version: ${{ env.get("RAPIDS_PY_VERSION") }}
10-
py_buildstring: ${{ py_version | version_to_buildstring }}
119
head_rev: '${{ git.head_rev(".")[:8] }}'
1210

1311
package:
@@ -18,15 +16,16 @@ source:
1816
path: ../../..
1917

2018
build:
21-
string: py${{ py_buildstring }}_${{ datetime_string }}_${{ head_rev }}
19+
noarch: python
20+
string: ${{ datetime_string }}_${{ head_rev }}
2221
script:
2322
content: |
2423
./build.sh cuopt_sh_client
2524
2625
requirements:
2726
host:
2827
- pip
29-
- python-gil =${{ py_version }}
28+
- python >=3.11
3029
- setuptools>=77.0.0
3130
run:
3231
- msgpack-python =1.2.1

conda/recipes/cuopt/recipe.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ context:
88
cuda_version: ${{ (env.get("RAPIDS_CUDA_VERSION") | split("."))[:2] | join(".") }}
99
cuda_major: '${{ (env.get("RAPIDS_CUDA_VERSION") | split("."))[0] }}'
1010
datetime_string: '${{ env.get("RAPIDS_DATETIME_STRING") }}'
11-
py_version: ${{ env.get("RAPIDS_PY_VERSION") }}
12-
py_buildstring: ${{ py_version | version_to_buildstring }}
11+
py_abi_min: ${{ env.get("RAPIDS_PY_VERSION") }}
12+
py_buildstring: ${{ py_abi_min | version_to_buildstring }}
13+
py_runtime_latest: "3.14"
1314
head_rev: '${{ git.head_rev(".")[:8] }}'
1415

1516
package:
@@ -20,7 +21,9 @@ source:
2021
path: ../../..
2122

2223
build:
23-
string: cuda${{ cuda_major }}_py${{ py_buildstring }}_${{ datetime_string }}_${{ head_rev }}
24+
python:
25+
version_independent: true
26+
string: cuda${{ cuda_major }}_cp${{ py_buildstring }}_abi3_${{ datetime_string }}_${{ head_rev }}
2427
dynamic_linking:
2528
overlinking_behavior: error
2629
prefix_detection:
@@ -42,6 +45,7 @@ build:
4245
CMAKE_GENERATOR: ${{ env.get("CMAKE_GENERATOR") }}
4346
NVCC_APPEND_FLAGS: ${{ env.get("NVCC_APPEND_FLAGS", default="") }}
4447
PARALLEL_LEVEL: ${{ env.get("PARALLEL_LEVEL", default="8") }}
48+
RAPIDS_PY_VERSION: ${{ py_abi_min }}
4549
SCCACHE_BUCKET: ${{ env.get("SCCACHE_BUCKET", default="") }}
4650
SCCACHE_DIST_AUTH_TYPE: ${{ env.get("SCCACHE_DIST_AUTH_TYPE", default="token") }}
4751
SCCACHE_DIST_FALLBACK_TO_LOCAL_COMPILE: ${{ env.get("SCCACHE_DIST_FALLBACK_TO_LOCAL_COMPILE", default="false") }}
@@ -71,11 +75,12 @@ requirements:
7175
- ${{ stdlib("c") }}
7276
host:
7377
- cuda-version =${{ cuda_version }}
74-
- cython >=3.0.0
78+
- cython >=3.2.2
7579
- libcuopt =${{ version }}
7680
- pip
7781
- pylibraft =${{ minor_version }}
78-
- python-gil =${{ py_version }}
82+
- python =${{ py_abi_min }}
83+
- python-abi3 ${{ py_abi_min }}.*
7984
- rapids-build-backend >=0.4.0,<0.5.0
8085
- rmm =${{ minor_version }}
8186
- scikit-build-core>=0.11.0
@@ -105,6 +110,7 @@ tests:
105110
- python:
106111
imports:
107112
- cuopt
113+
python_version: ${{ py_runtime_latest }}.*
108114
pip_check: false
109115

110116
about:

0 commit comments

Comments
 (0)