Skip to content

Commit 0977a75

Browse files
ENH: Migrate recipe to v1 format for rattler-build
1 parent 624ab39 commit 0977a75

5 files changed

Lines changed: 266 additions & 5 deletions

File tree

conda-forge.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ build_platform:
1010
linux_ppc64le: linux_64
1111
conda_build:
1212
pkg_format: '2'
13+
conda_build_tool: rattler-build
1314
conda_forge_output_validation: true
15+
conda_install_tool: pixi
1416
github:
1517
branch_name: main
1618
tooling_branch_name: main

recipe/build_output.bat

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
set "CUDA_HOME=%PREFIX%\\%SUBDIR%"
2+
set "LIB=%PREFIX%\\%SUBDIR%\\lib\\%TARGET_NAME%;%LIB%"
3+
14
set DIR_NAME=%PKG_NAME:-=_%
25
cd %DIR_NAME%
36
if "%DIR_NAME%"=="cuda_python" (

recipe/build_output.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
export CUDA_HOME="${PREFIX}/${SUBDIR}"
4+
35
DIR_NAME="$(echo $PKG_NAME | tr '-' '_')"
46
cd $DIR_NAME
57
if [[ ${DIR_NAME} == "cuda_python" || ${DIR_NAME} == "cuda_bindings" ]]; then

recipe/conda_build_config.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.

recipe/recipe.yaml

Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
# Have certain top-level requirements so conda-smithy can render the correct variants
2+
schema_version: 1
3+
4+
context:
5+
number: 1
6+
version: "12.9.7"
7+
sha256: 9df6ff7121e11b158730ef39350c111728c9d1a2450124f463f7f4026c89d42f
8+
bindings_major_version: ${{ (version | split("."))[0] | int }}
9+
bindings_minor_version: ${{ (version | split("."))[1] | int }}
10+
bindings_patch_version: ${{ (version | split("."))[2] | int }}
11+
target_name: ${{ "sbsa-linux" if aarch64 else 'x86_64-linux' if linux else "x64" if win else "" }}
12+
subdir: ${{ "targets/" ~ target_name if aarch64 or linux else "Library\\" if win else "" }}
13+
# libcufile only exists on ARM for CUDA 12.2+. We split into two ARM packages
14+
# with/without libcufile support.
15+
cufile_supported: aarch64
16+
17+
recipe:
18+
name: cuda-python-split
19+
version: 1
20+
21+
source:
22+
url: https://github.com/NVIDIA/cuda-python/releases/download/v${{ version }}/cuda-python-v${{ version }}.tar.gz
23+
sha256: ${{ sha256 }}
24+
25+
build:
26+
number: 0
27+
skip: match(python, "<3.10") or ppc64le or osx
28+
29+
outputs:
30+
- package:
31+
name: cuda-python
32+
version: ${{ version }}
33+
build:
34+
number: ${{ number }}
35+
skip: not linux64
36+
noarch: python
37+
# Deterministic build string so all variant.use_keys: [python] builds
38+
# produce the same artifact filename — required for upload-time dedupe
39+
# via hash collision (see `variant.use_keys` note below).
40+
string: py_min_${{ python_min | replace(".", "") }}_${{ number }}
41+
variant:
42+
# Ensures conda-smithy splits CI jobs per Python version. Without
43+
# this, the noarch output drops `python` from the intersection of
44+
# used loop vars (since CFEP-25 uses `python_min`), collapsing all
45+
# Python variants into a single serialized job. The redundant noarch
46+
# builds dedupe on upload via hash collision (the explicit `string`
47+
# above keeps the filename identical across variants).
48+
use_keys:
49+
- python
50+
script:
51+
env:
52+
SUBDIR: ${{ subdir }}
53+
TARGET_NAME: ${{ target_name }}
54+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
55+
requirements:
56+
host:
57+
- python ${{ python_min }}.*
58+
- pip
59+
- setuptools
60+
- setuptools-scm >=8
61+
run:
62+
- python >=${{ python_min }}
63+
- ${{ pin_subpackage('cuda-bindings', upper_bound='x.x') }}
64+
- cuda-core >=1.0.0,<1.1.0
65+
- if: not aarch64
66+
then: cuda-version >=12.0,<13.0a0
67+
- if: aarch64 and not cufile_supported
68+
then: cuda-version >=12.0,<12.2a0
69+
- if: aarch64 and cufile_supported
70+
then: cuda-version >=12.2,<13.0a0
71+
tests:
72+
- script:
73+
- python -c "import importlib.metadata; importlib.metadata.version('cuda-python')"
74+
# Imports depend on numpy
75+
- if: linux
76+
then: python -c "import cuda.bindings.cufile"
77+
- python -c "import cuda.bindings.nvml"
78+
- if: aarch64
79+
then: python -c "import cuda.bindings.cudla"
80+
requirements:
81+
run:
82+
# Range (not pinned to python_min) so the test env can use the
83+
# variant's Python, matching the locally-built cuda-bindings ABI.
84+
- python >=${{ python_min }}
85+
- numpy
86+
- python:
87+
imports:
88+
- cuda.bindings
89+
- cuda.bindings.driver
90+
- cuda.bindings.runtime
91+
- cuda.bindings.nvrtc
92+
- cuda.bindings.nvjitlink
93+
- cuda.bindings.nvvm
94+
- cuda.bindings.nvfatbin
95+
pip_check: false
96+
about:
97+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
98+
license_file: cuda_python/LICENSE
99+
summary: CUDA Python
100+
description: |
101+
CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python.
102+
homepage: https://nvidia.github.io/cuda-python/
103+
repository: https://github.com/NVIDIA/cuda-python
104+
documentation: https://nvidia.github.io/cuda-python/
105+
106+
- package:
107+
name: cuda-bindings
108+
version: ${{ version }}
109+
build:
110+
number: ${{ number }}
111+
script:
112+
env:
113+
SUBDIR: ${{ subdir }}
114+
TARGET_NAME: ${{ target_name }}
115+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
116+
requirements:
117+
build:
118+
- ${{ compiler('c') }}
119+
- ${{ compiler('cxx') }}
120+
- ${{ stdlib('c') }}
121+
- if: build_platform != target_platform
122+
then:
123+
- cross-python_${{ target_platform }}
124+
- python
125+
- cython
126+
host:
127+
# cuda.bindings needs to be built with the matching major.minor headers
128+
- cuda-version ==${{ bindings_major_version }}.${{ bindings_minor_version }}
129+
- cuda-crt-dev_${{ target_platform }}
130+
- cuda-cudart-dev
131+
- cuda-cudart-static
132+
- cuda-cudart
133+
- cuda-nvcc-impl
134+
- cuda-nvrtc
135+
- cuda-nvrtc-dev
136+
- cuda-profiler-api
137+
- if: linux and cufile_supported
138+
then:
139+
- libcufile
140+
- if: linux
141+
then:
142+
- libcufile-dev
143+
- cython
144+
- pip
145+
- pyclibrary
146+
- python
147+
- setuptools
148+
- setuptools-scm >=8
149+
- cuda-pathfinder >=1.5.5,<2
150+
run:
151+
- python
152+
- cuda-pathfinder >=1.5.5,<2
153+
- if: not aarch64
154+
then: ${{ pin_compatible('cuda-version', lower_bound='x', upper_bound='x') }}
155+
# cuda-python requires cuda-nvrtc from the same major version. We ignored
156+
# run-exports of cuda-nvrtc-dev and instead allow a looser pinning here.
157+
# Same for cuda-nvcc-impl.
158+
- if: aarch64 and not cufile_supported
159+
then: cuda-version >=12.0,<12.2a0
160+
- if: aarch64 and cufile_supported
161+
then: cuda-version >=12.2,<13.0a0
162+
- ${{ pin_compatible('cuda-nvcc-impl', lower_bound='x', upper_bound='x') }}
163+
- if: linux and cufile_supported
164+
then: ${{ pin_compatible('libcufile', lower_bound='x', upper_bound='x') }}
165+
- if: aarch64
166+
then: libcudla >=13.0,<14.0a0
167+
- libnvfatbin >=13.0,<14.0a0
168+
- libnvjitlink >=12.3,<13
169+
ignore_run_exports:
170+
from_package:
171+
# The run-exports from these dev packages are too tight, so we ignore them.
172+
# The cuda-python package supports CUDA Enhanced Compatibility through its
173+
# use of dlopen, so it is compatible with other CUDA minor versions.
174+
- cuda-nvcc-impl
175+
- cuda-cudart-dev
176+
- cuda-cudart-static
177+
- cuda-nvrtc-dev
178+
- if: linux
179+
then: libcufile-dev
180+
run_constraints:
181+
# cuda-cudart is not a hard dependency because cuda-python statically links to
182+
# cudart. This package is optionally dlopen'd for getting the local cudart
183+
# version with cuda.cudart.getLocalRuntimeVersion(). We ignored run-exports
184+
# of cuda-cudart-dev and instead allow a looser pinning here.
185+
- ${{ pin_compatible('cuda-cudart', lower_bound='x', upper_bound='x') }}
186+
tests:
187+
- script:
188+
- if: linux
189+
then: export C_INCLUDE_PATH="$CONDA_PREFIX/${{ subdir }}/include"
190+
- if: win
191+
then: set "CL=%CL% /I%CONDA_PREFIX%\${{ subdir }}\include"
192+
# Workaround for https://github.com/conda-forge/setuptools-feedstock/issues/399
193+
- pip install setuptools
194+
- cythonize -i -3 -Xfreethreading_compatible=True *.pyx
195+
- python -c "import test_cimport; test_cimport.test()"
196+
- python -c "import cuda.bindings; print(cuda.bindings.__version__)"
197+
# Imports depend on numpy
198+
- python -c "import cuda.bindings.nvml"
199+
- if: linux
200+
then: python -c "import cuda.bindings.cufile"
201+
- if: aarch64
202+
then: python -c "import cuda.bindings.cudla"
203+
requirements:
204+
run:
205+
- cuda-nvcc
206+
- cuda-nvrtc-dev
207+
- cuda-profiler-api
208+
- cython
209+
- pip
210+
- numpy
211+
files:
212+
recipe:
213+
- test_cimport.pyx
214+
- python:
215+
imports:
216+
- cuda
217+
- cuda.cuda
218+
- cuda.cudart
219+
- cuda.bindings
220+
- cuda.bindings.driver
221+
- cuda.bindings.runtime
222+
- cuda.bindings.nvrtc
223+
- cuda.bindings.nvjitlink
224+
- cuda.bindings.nvvm
225+
- cuda.bindings.nvfatbin
226+
pip_check: false
227+
about:
228+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
229+
license_file: cuda_bindings/LICENSE
230+
summary: CUDA Python Low-level Bindings
231+
description: |
232+
CUDA Python provides a standard set of low-level interfaces,
233+
providing full coverage of and access to the CUDA host APIs from Python.
234+
homepage: https://nvidia.github.io/cuda-python/cuda-bindings
235+
repository: https://github.com/NVIDIA/cuda-python
236+
documentation: https://nvidia.github.io/cuda-python/cuda-bindings
237+
238+
about:
239+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
240+
license_file: LICENSE.md
241+
summary: CUDA Python
242+
description: |
243+
CUDA Python is the home for accessing NVIDIA's CUDA platform from Python.
244+
homepage: https://nvidia.github.io/cuda-python/
245+
repository: https://github.com/NVIDIA/cuda-python
246+
documentation: https://nvidia.github.io/cuda-python/
247+
248+
extra:
249+
feedstock-name: cuda-python
250+
recipe-maintainers:
251+
- bdice
252+
- jakirkham
253+
- leofang
254+
- m3vaz
255+
- mmccarty
256+
- vyasr
257+
- vzhurba01
258+
- kkraus14
259+
- oleksandr-pavlyk

0 commit comments

Comments
 (0)