Skip to content

Commit 57cb172

Browse files
authored
GH-47371, GH-48281: [Python][CI] Fix Numba-CUDA interop (#48284)
### Rationale for this change The extra that specifies the CUDA version for Numba-CUDA is required for the CUDA Python bindings to be installed as a Numba-CUDA dependency. Presently the Numba-CUDA interop tests are skipped, and it would be preferable to enable them again and ensure the test suite doesn't skip them due to lack of dependencies. ### What changes are included in this PR? - Addition of the appropriate extra to the Numba-CUDA installation, so that the bindings will be installed in the CI environment. - Removal of the skip for the Numba-CUDA interop tests. ### Are these changes tested? Yes (assuming the CI setup works correctly again with these changes) ### Are there any user-facing changes? No. * GitHub Issue: #47371 * GitHub Issue: #48281 Authored-by: Graham Markall <[email protected]> Signed-off-by: Antoine Pitrou <[email protected]>
1 parent c66a9a2 commit 57cb172

File tree

4 files changed

+17
-11
lines changed

4 files changed

+17
-11
lines changed

ci/docker/linux-apt-python-3.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,10 @@ RUN python3 -m venv ${ARROW_PYTHON_VENV} && \
3333

3434
ARG numba
3535
ARG numba_cuda
36+
ARG cuda
3637
COPY ci/scripts/install_numba.sh /arrow/ci/scripts/
3738
RUN if [ "${numba}" != "" ]; then \
38-
/arrow/ci/scripts/install_numba.sh ${numba} ${numba_cuda} \
39+
/arrow/ci/scripts/install_numba.sh ${numba} ${numba_cuda} ${cuda} \
3940
; fi
4041

4142
ENV ARROW_ACERO=ON \

ci/scripts/install_numba.sh

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
set -e
2121

22-
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ]; then
23-
echo "Usage: $0 <numba version> [numba-cuda version]"
22+
if [ "$#" -ne 1 ] && [ "$#" -ne 2 ] && [ "$#" -ne 3 ]; then
23+
echo "Usage: $0 <numba version> [numba-cuda version] [CUDA version]"
2424
exit 1
2525
fi
2626

@@ -34,8 +34,6 @@ if [ -n "${ARROW_PYTHON_VENV:-}" ]; then
3434
. "${ARROW_PYTHON_VENV}/bin/activate"
3535
fi
3636

37-
# TODO: GH-47371 (install Python CUDA bindings explicitly)
38-
3937
if [ "${numba}" = "master" ]; then
4038
pip install https://github.com/numba/numba/archive/main.tar.gz#egg=numba
4139
elif [ "${numba}" = "latest" ]; then
@@ -50,10 +48,19 @@ fi
5048

5149
numba_cuda=$2
5250

51+
DEFAULT_CUDA_VERSION="12"
52+
53+
if [ "$#" -eq 3 ]; then
54+
# Extract the CUDA major version only
55+
cuda_version="${3%%.*}"
56+
else
57+
cuda_version="${DEFAULT_CUDA_VERSION}"
58+
fi
59+
5360
if [ "${numba_cuda}" = "master" ]; then
54-
pip install https://github.com/NVIDIA/numba-cuda/archive/main.tar.gz#egg=numba-cuda
61+
pip install "numba-cuda[cu${cuda_version}] @ https://github.com/NVIDIA/numba-cuda/archive/main.tar.gz"
5562
elif [ "${numba_cuda}" = "latest" ]; then
56-
pip install numba-cuda
63+
pip install "numba-cuda[cu${cuda_version}]"
5764
else
58-
pip install "numba-cuda==${numba_cuda}"
65+
pip install "numba-cuda[cu${cuda_version}]==${numba_cuda}"
5966
fi

compose.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,7 @@ services:
999999
base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cuda-${CUDA}-cpp
10001000
numba: ${NUMBA}
10011001
numba_cuda: ${NUMBA_CUDA}
1002+
cuda: ${CUDA}
10021003
shm_size: *shm-size
10031004
environment:
10041005
<<: [*common, *ccache, *sccache]

python/pyarrow/tests/test_cuda_numba_interop.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@
2222
except ImportError:
2323
pytestmark = pytest.mark.numpy
2424

25-
pytest.skip("Numba integration tests broken by Numba API changes, see GH-48265",
26-
allow_module_level=True)
27-
2825
dtypes = ['uint8', 'int16', 'float32']
2926
cuda = pytest.importorskip("pyarrow.cuda")
3027
nb_cuda = pytest.importorskip("numba.cuda")

0 commit comments

Comments
 (0)