Skip to content

Commit b636af7

Browse files
ENH: Migrate recipe to v1 format for rattler-build
1 parent 370a12f commit b636af7

3 files changed

Lines changed: 233 additions & 0 deletions

File tree

recipe/build_output.bat

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
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%
6+
IF "%DIR_NAME%"=="cuda_bindings" (
7+
REM The upstream setup.py calls get_version() without dist_name
8+
REM so only the generic SETUPTOOLS_SCM_PRETEND_VERSION is honored.
9+
set SETUPTOOLS_SCM_PRETEND_VERSION=%PKG_VERSION%
10+
)
311
%PYTHON% -m pip install . --no-deps -vv

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" ]]; then

recipe/recipe.yaml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
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: "13.2.0"
7+
sha256: 6899b7684ccaf3249d521cc092768baeae390780375bb115bcd80350b65b1dff
8+
is_freethreading: environ | get("is_freethreading", False)
9+
bindings_major_version: ${{ (version | split("."))[0] | int }}
10+
bindings_minor_version: ${{ (version | split("."))[1] | int }}
11+
bindings_patch_version: ${{ (version | split("."))[2] | int }}
12+
target_name: ${{ 'x86_64-linux' if linux else "sbsa-linux" if aarch64 else "win64" if win else "" }}
13+
subdir: ${{ "targets/" ~ target_name if linux or aarch64 else "Library\\" if win else "" }}
14+
15+
recipe:
16+
name: cuda-python-split
17+
version: 1
18+
19+
source:
20+
url: https://github.com/NVIDIA/cuda-python/releases/download/v${{ version }}/cuda-python-v${{ version }}.tar.gz
21+
sha256: ${{ sha256 }}
22+
23+
build:
24+
number: 0
25+
skip: match(python, "<3.9") or ppc64le or osx
26+
27+
outputs:
28+
- package:
29+
name: cuda-python
30+
version: ${{ version }}
31+
build:
32+
number: ${{ number }}
33+
skip: not linux64
34+
noarch: python
35+
script:
36+
env:
37+
SUBDIR: ${{ subdir }}
38+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
39+
requirements:
40+
host:
41+
- python ${{ python_min }}.*
42+
- pip
43+
- setuptools
44+
- setuptools-scm >=8
45+
run:
46+
- python >=${{ python_min }}
47+
- ${{ pin_subpackage('cuda-bindings', upper_bound='x.x') }}
48+
- cuda-version >=13.0,<14.0a0
49+
tests:
50+
- script:
51+
- python -c "import importlib.metadata; importlib.metadata.version('cuda-python')"
52+
# Imports depend on numpy
53+
- if: linux
54+
then: python -c "import cuda.bindings.cufile"
55+
- python -c "import cuda.bindings.nvml"
56+
requirements:
57+
run:
58+
- python >=${{ python_min }}
59+
- numpy
60+
- python:
61+
imports:
62+
- cuda.bindings
63+
- cuda.bindings.driver
64+
- cuda.bindings.runtime
65+
- cuda.bindings.nvrtc
66+
- cuda.bindings.nvjitlink
67+
- cuda.bindings.nvvm
68+
- cuda.bindings.nvfatbin
69+
pip_check: false
70+
# TODO: add support for v1
71+
# python_version: >=${{ python_min }}
72+
about:
73+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
74+
license_file: cuda_python/LICENSE
75+
summary: CUDA Python
76+
description: |
77+
CUDA Python is the home for accessing NVIDIA’s CUDA platform from Python.
78+
homepage: https://nvidia.github.io/cuda-python/
79+
repository: https://github.com/NVIDIA/cuda-python
80+
documentation: https://nvidia.github.io/cuda-python/
81+
82+
- package:
83+
name: cuda-bindings
84+
version: ${{ version }}
85+
build:
86+
number: ${{ number }}
87+
script:
88+
env:
89+
SUBDIR: ${{ subdir }}
90+
file: ${{ 'build_output.bat' if win else 'build_output.sh' if linux else '' }}
91+
requirements:
92+
build:
93+
- ${{ compiler('c') }}
94+
- ${{ compiler('cxx') }}
95+
- ${{ stdlib('c') }}
96+
- if: build_platform != target_platform
97+
then:
98+
- cross-python_${{ target_platform }}
99+
- python
100+
- cython
101+
host:
102+
# cuda.bindings needs to be built with the matching major.minor headers
103+
- cuda-version ==${{ bindings_major_version }}.${{ bindings_minor_version }}
104+
- cuda-crt-dev_${{ target_platform }}
105+
- cuda-cudart-dev
106+
- cuda-cudart-static
107+
- cuda-cudart
108+
- cuda-nvvm-impl
109+
- cuda-nvrtc
110+
- cuda-nvrtc-dev
111+
- cuda-profiler-api
112+
- if: linux
113+
then:
114+
- libcufile
115+
- libcufile-dev
116+
- cython
117+
- pip
118+
- pyclibrary
119+
- python
120+
- setuptools
121+
- setuptools-scm >=8
122+
run:
123+
- python
124+
- cuda-pathfinder >=1.1.0,<2
125+
- ${{ pin_compatible('cuda-version', lower_bound='x', upper_bound='x') }}
126+
# cuda-python requires cuda-nvrtc from the same major version. We ignored
127+
# run-exports of cuda-nvrtc-dev and instead allow a looser pinning here.
128+
# Same for cuda-nvvm-impl.
129+
- ${{ pin_compatible('cuda-nvrtc', lower_bound='x', upper_bound='x') }}
130+
- ${{ pin_compatible('cuda-nvvm-impl', lower_bound='x', upper_bound='x') }}
131+
# TODO: add support for v1
132+
# - skip: false linux
133+
# then: ${{ pin_compatible('libcufile', lower_bound='x', upper_bound='x') }}
134+
# - ${{ pin_compatible('libnvfatbin', lower_bound='x', upper_bound='x') }}
135+
- libnvjitlink >=13.0,<14.0a0
136+
ignore_run_exports:
137+
from_package:
138+
- cuda-nvvm-impl
139+
- cuda-cudart-dev
140+
- cuda-cudart-static
141+
- cuda-nvrtc-dev
142+
# TODO: add support for v1
143+
# - skip: false linux
144+
# then: libcufile-dev
145+
run_constraints:
146+
- ${{ pin_compatible('cuda-cudart', lower_bound='x', upper_bound='x') }}
147+
# Rattler-build thinks this introduces circular dependency
148+
# - ${{ pin_subpackage('cuda-python', upper_bound='x.x') }}
149+
tests:
150+
- script:
151+
- if: linux
152+
then: export C_INCLUDE_PATH="$CONDA_PREFIX/${{ subdir }}/include"
153+
- if: win
154+
then: set "CL=%CL% /I%CONDA_PREFIX%\${{ subdir }}\include"
155+
- pip install setuptools
156+
- cythonize -i -3 -Xfreethreading_compatible=True *.pyx
157+
- python -c "import test_cimport; test_cimport.test()"
158+
- python -c "import cuda.bindings; print(cuda.bindings.__version__)"
159+
# Imports depend on numpy
160+
- python -c "import cuda.bindings.nvml"
161+
requirements:
162+
run:
163+
- ${{ compiler('c') }}
164+
- ${{ compiler('cxx') }}
165+
- cuda-nvcc
166+
- cuda-nvrtc-dev
167+
- cuda-profiler-api
168+
- cython
169+
- pip
170+
- numpy
171+
files:
172+
recipe:
173+
- test_cimport.pyx
174+
- python:
175+
imports:
176+
- cuda
177+
- cuda.bindings
178+
- cuda.bindings.driver
179+
- cuda.bindings.runtime
180+
# TODO: add support for v1
181+
# - skip: false linux
182+
# then: cuda.bindings.cufile
183+
- cuda.bindings.nvrtc
184+
- cuda.bindings.nvjitlink
185+
- cuda.bindings.nvvm
186+
- cuda.bindings.nvfatbin
187+
pip_check: false
188+
about:
189+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
190+
license_file: cuda_bindings/LICENSE
191+
summary: CUDA Python Low-level Bindings
192+
description: |
193+
CUDA Python provides a standard set of low-level interfaces,
194+
providing full coverage of and access to the CUDA host APIs from Python.
195+
homepage: https://nvidia.github.io/cuda-python/cuda-bindings
196+
repository: https://github.com/NVIDIA/cuda-python
197+
documentation: https://nvidia.github.io/cuda-python/cuda-bindings
198+
199+
about:
200+
license: LicenseRef-NVIDIA-SOFTWARE-LICENSE
201+
license_file: LICENSE.md
202+
summary: CUDA Python
203+
description: |
204+
CUDA Python is the home for accessing NVIDIA's CUDA platform from Python.
205+
homepage: https://nvidia.github.io/cuda-python/
206+
repository: https://github.com/NVIDIA/cuda-python
207+
documentation: https://nvidia.github.io/cuda-python/
208+
209+
extra:
210+
feedstock-name: cuda-python
211+
recipe-maintainers:
212+
- rwgk
213+
- rparolin
214+
- cpcloud
215+
- bdice
216+
- jakirkham
217+
- leofang
218+
- m3vaz
219+
- mmccarty
220+
- vyasr
221+
- vzhurba01
222+
- kkraus14
223+
- oleksandr-pavlyk

0 commit comments

Comments
 (0)