Skip to content

Commit b43dcc8

Browse files
authored
ci: replace conda testing with pixi (#554)
1 parent 03cc289 commit b43dcc8

File tree

8 files changed

+5190
-1341
lines changed

8 files changed

+5190
-1341
lines changed

.github/workflows/conda-python-tests.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@ jobs:
113113
- name: Setup proxy cache
114114
uses: nv-gha-runners/setup-proxy-cache@main
115115
continue-on-error: true
116+
- name: Compute pixi environment name
117+
run: |
118+
set -euo pipefail
119+
PIXI_ENV="cu-$(cut -d. -f1-2 <<< "${{ matrix.CUDA_VER }}" | tr . -)"
120+
echo "PIXI_ENV=${PIXI_ENV}" >> "${GITHUB_ENV}"
121+
- name: Setup pixi
122+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293
123+
with:
124+
environments: ${{ env.PIXI_ENV }}
116125
- name: Python tests
117126
run: ${{ inputs.script }}
118127
env:

.github/workflows/simulator-test.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ jobs:
101101
echo "RAPIDS_NIGHTLY_DATE=${{ inputs.date }}" >> "${GITHUB_ENV}"
102102
- name: Setup proxy cache
103103
uses: nv-gha-runners/setup-proxy-cache@main
104+
- name: Compute pixi environment name
105+
run: |
106+
set -euo pipefail
107+
PIXI_ENV="cu-$(cut -d. -f1-2 <<< "${{ matrix.CUDA_VER }}" | tr . -)"
108+
echo "PIXI_ENV=${PIXI_ENV}" >> "${GITHUB_ENV}"
109+
- name: Setup pixi
110+
uses: prefix-dev/setup-pixi@fef5c9568ca6c4ff7707bf840ab0692ba3f08293
111+
with:
112+
environments: ${{ env.PIXI_ENV }}
104113
- name: Python tests
105114
run: ${{ inputs.script }}
106115
env:

ci/test_conda.sh

Lines changed: 10 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@
44

55
set -euo pipefail
66

7-
. /opt/conda/etc/profile.d/conda.sh
8-
9-
CTK_PACKAGE_DEPENDENCIES=(
10-
"cuda-cccl"
11-
"cuda-nvcc-impl"
12-
"cuda-nvrtc"
13-
"libcurand-dev"
14-
"cuda-cuobjdump"
15-
)
16-
177
DISTRO=`cat /etc/os-release | grep "^ID=" | awk 'BEGIN {FS="="} { print $2 }'`
188

199
if [ "$DISTRO" = "ubuntu" ]; then
@@ -22,67 +12,30 @@ if [ "$DISTRO" = "ubuntu" ]; then
2212
apt remove --purge `dpkg --get-selections | grep cuda-nvrtc | awk '{print $1}'` -y
2313
fi
2414

25-
rapids-logger "Install testing dependencies"
26-
# TODO: Replace with rapids-dependency-file-generator
27-
DEPENDENCIES=(
28-
"c-compiler"
29-
"cxx-compiler"
30-
"${CTK_PACKAGE_DEPENDENCIES[@]}"
31-
"cuda-python"
32-
"cuda-version=${CUDA_VER%.*}"
33-
"make"
34-
"numba-cuda"
35-
"psutil"
36-
"pytest"
37-
"pytest-xdist"
38-
"pytest-benchmark"
39-
"cffi"
40-
"ml_dtypes"
41-
"python=${RAPIDS_PY_VERSION}"
42-
)
4315
# Constrain oldest supported dependencies for testing
4416
if [ "${RAPIDS_DEPENDENCIES:-}" = "oldest" ]; then
45-
DEPENDENCIES+=("numba==0.60.0")
17+
# add to the default environment's dependencies
18+
pixi add "numba=0.60.0"
4619
fi
4720

48-
rapids-mamba-retry create \
49-
-n test \
50-
--strict-channel-priority \
51-
--channel "`pwd`/conda-repo" \
52-
--channel conda-forge \
53-
"${DEPENDENCIES[@]}"
54-
55-
# Temporarily allow unbound variables for conda activation.
56-
set +u
57-
conda activate test
58-
set -u
59-
60-
pip install filecheck
61-
62-
rapids-print-env
63-
6421
rapids-logger "Check GPU usage"
6522
nvidia-smi
6623

67-
rapids-logger "Build test binaries"
68-
export NUMBA_CUDA_TEST_BIN_DIR=`pwd`/testing
69-
pushd $NUMBA_CUDA_TEST_BIN_DIR
70-
make -j $(nproc)
71-
72-
rapids-logger "Show Numba system info"
73-
python -m numba --sysinfo
74-
7524
EXITCODE=0
7625
trap "EXITCODE=1" ERR
7726
set +e
7827

28+
rapids-logger "Show Numba system info"
29+
pixi run -e "${PIXI_ENV}" python -m numba --sysinfo
30+
7931
rapids-logger "Test importing numba.cuda"
80-
python -c "from numba import cuda"
32+
pixi run -e "${PIXI_ENV}" python -c "from numba import cuda"
8133

8234
rapids-logger "Run Tests"
83-
pytest -v
84-
85-
popd
35+
pixi run -e "${PIXI_ENV}" test -n auto \
36+
--dist loadscope \
37+
--loadscope-reorder \
38+
-v
8639

8740
rapids-logger "Test script exiting with value: $EXITCODE"
8841
exit ${EXITCODE}

ci/test_simulator.sh

Lines changed: 10 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,56 +4,21 @@
44

55
set -euo pipefail
66

7-
. /opt/conda/etc/profile.d/conda.sh
8-
9-
rapids-logger "Install testing dependencies"
10-
# TODO: Replace with rapids-dependency-file-generator
11-
DEPENDENCIES=(
12-
"psutil"
13-
"pytest"
14-
"pytest-xdist"
15-
"pytest-benchmark"
16-
"cffi"
17-
"ml_dtypes"
18-
"python=${RAPIDS_PY_VERSION}"
19-
"numba-cuda"
20-
)
21-
rapids-mamba-retry create \
22-
-n test \
23-
--strict-channel-priority \
24-
--channel "`pwd`/conda-repo" \
25-
--channel conda-forge \
26-
"${DEPENDENCIES[@]}"
27-
28-
# Temporarily allow unbound variables for conda activation.
29-
set +u
30-
conda activate test
31-
set -u
32-
33-
pip install filecheck
34-
35-
rapids-print-env
36-
37-
# The simulator doesn't actually use the test binaries, but we move into the
38-
# test binaries folder so that we're not in the root of the repo, and therefore
39-
# numba-cuda code from the installed package will be tested, instead of the
40-
# code in the source repo.
41-
rapids-logger "Move to test binaries folder"
42-
export NUMBA_CUDA_TEST_BIN_DIR=`pwd`/testing
43-
pushd $NUMBA_CUDA_TEST_BIN_DIR
44-
45-
rapids-logger "Show Numba system info"
46-
python -m numba --sysinfo
47-
487
EXITCODE=0
498
trap "EXITCODE=1" ERR
509
set +e
5110

52-
rapids-logger "Run Tests"
53-
export NUMBA_ENABLE_CUDASIM=1
54-
pytest -v
11+
rapids-logger "Show Numba system info"
12+
pixi run -e "${PIXI_ENV}" python -m numba --sysinfo
13+
14+
rapids-logger "Test importing numba.cuda"
15+
pixi run -e "${PIXI_ENV}" python -c "from numba import cuda"
5516

56-
popd
17+
rapids-logger "Run Tests"
18+
pixi run -e "${PIXI_ENV}" simtest -n auto \
19+
--dist loadscope \
20+
--loadscope-reorder \
21+
-v
5722

5823
rapids-logger "Test script exiting with value: $EXITCODE"
5924
exit ${EXITCODE}

numba_cuda/numba/cuda/tests/cudadrv/test_deallocations.py

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818

1919
@skip_on_cudasim("not supported on CUDASIM")
20-
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
2120
class TestDeallocation(CUDATestCase):
21+
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
2222
def test_max_pending_count(self):
2323
# get deallocation manager and flush it
2424
deallocs = cuda.current_context().memory_manager.deallocations
@@ -32,6 +32,7 @@ def test_max_pending_count(self):
3232
cuda.to_device(np.arange(1))
3333
self.assertEqual(len(deallocs), 0)
3434

35+
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
3536
def test_max_pending_bytes(self):
3637
# get deallocation manager and flush it
3738
ctx = cuda.current_context()
@@ -73,11 +74,8 @@ def test_max_pending_bytes(self):
7374
# restore old ratio
7475
config.CUDA_DEALLOCS_RATIO = old_ratio
7576

76-
77-
@skip_on_cudasim("defer_cleanup has no effect in CUDASIM")
78-
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
79-
class TestDeferCleanup(CUDATestCase):
80-
def test_basic(self):
77+
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
78+
def test_defer_cleanup(self):
8179
harr = np.arange(5)
8280
darr1 = cuda.to_device(harr)
8381
deallocs = cuda.current_context().memory_manager.deallocations
@@ -95,7 +93,8 @@ def test_basic(self):
9593
deallocs.clear()
9694
self.assertEqual(len(deallocs), 0)
9795

98-
def test_nested(self):
96+
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
97+
def test_nested_defer_cleanup(self):
9998
harr = np.arange(5)
10099
darr1 = cuda.to_device(harr)
101100
deallocs = cuda.current_context().memory_manager.deallocations
@@ -116,6 +115,7 @@ def test_nested(self):
116115
deallocs.clear()
117116
self.assertEqual(len(deallocs), 0)
118117

118+
@skip_if_external_memmgr("Deallocation specific to Numba memory management")
119119
def test_exception(self):
120120
harr = np.arange(5)
121121
darr1 = cuda.to_device(harr)
@@ -141,64 +141,50 @@ class CustomError(Exception):
141141
deallocs.clear()
142142
self.assertEqual(len(deallocs), 0)
143143

144-
145-
class TestDeferCleanupAvail(CUDATestCase):
146-
def test_context_manager(self):
147-
# just make sure the API is available
148-
with cuda.defer_cleanup():
149-
pass
150-
151-
152-
@skip_on_cudasim("not supported on CUDASIM")
153-
class TestDel(CUDATestCase):
154-
"""
155-
Ensure resources are deleted properly without ignored exception.
156-
"""
157-
158144
@contextmanager
159145
def check_ignored_exception(self, ctx):
160146
with captured_stderr() as cap:
161147
yield
162148
ctx.deallocations.clear()
163149
self.assertFalse(cap.getvalue())
164150

165-
def test_stream(self):
151+
def test_del_stream(self):
166152
ctx = cuda.current_context()
167153
stream = ctx.create_stream()
168154
with self.check_ignored_exception(ctx):
169155
del stream
170156

171-
def test_event(self):
157+
def test_del_event(self):
172158
ctx = cuda.current_context()
173159
event = ctx.create_event()
174160
with self.check_ignored_exception(ctx):
175161
del event
176162

177-
def test_pinned_memory(self):
163+
def test_del_pinned_memory(self):
178164
ctx = cuda.current_context()
179165
mem = ctx.memhostalloc(32)
180166
with self.check_ignored_exception(ctx):
181167
del mem
182168

183-
def test_mapped_memory(self):
169+
def test_del_mapped_memory(self):
184170
ctx = cuda.current_context()
185171
mem = ctx.memhostalloc(32, mapped=True)
186172
with self.check_ignored_exception(ctx):
187173
del mem
188174

189-
def test_device_memory(self):
175+
def test_del_device_memory(self):
190176
ctx = cuda.current_context()
191177
mem = ctx.memalloc(32)
192178
with self.check_ignored_exception(ctx):
193179
del mem
194180

195-
def test_managed_memory(self):
181+
def test_del_managed_memory(self):
196182
ctx = cuda.current_context()
197183
mem = ctx.memallocmanaged(32)
198184
with self.check_ignored_exception(ctx):
199185
del mem
200186

201-
def test_pinned_contextmanager(self):
187+
def test_del_pinned_contextmanager(self):
202188
# Check that temporarily pinned memory is unregistered immediately,
203189
# such that it can be re-pinned at any time
204190
class PinnedException(Exception):
@@ -227,7 +213,7 @@ class PinnedException(Exception):
227213
with cuda.pinned(arr):
228214
pass
229215

230-
def test_mapped_contextmanager(self):
216+
def test_del_mapped_contextmanager(self):
231217
# Check that temporarily mapped memory is unregistered immediately,
232218
# such that it can be re-mapped at any time
233219
class MappedException(Exception):

0 commit comments

Comments
 (0)