diff --git a/.github/actions/fetch_ctk/action.yml b/.github/actions/fetch_ctk/action.yml index 8365b3f2bf..18750c2d8b 100644 --- a/.github/actions/fetch_ctk/action.yml +++ b/.github/actions/fetch_ctk/action.yml @@ -146,5 +146,6 @@ runs: run: | CUDA_PATH=$(realpath "./cuda_toolkit") echo "CUDA_PATH=${CUDA_PATH}" >> $GITHUB_ENV + echo "CUDA_HOME=${CUDA_PATH}" >> $GITHUB_ENV echo "${CUDA_PATH}/bin" >> $GITHUB_PATH echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH:-}:${CUDA_PATH}/lib" >> $GITHUB_ENV diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index ff5041c85c..def159f50c 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -234,6 +234,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + env: + # we use self-hosted runners on which setup-python behaves weirdly... + AGENT_TOOLSDIRECTORY: "/opt/hostedtoolcache" - name: Set up mini CTK uses: ./.github/actions/fetch_ctk @@ -255,6 +258,13 @@ jobs: pushd ./cuda_bindings pip install -r requirements.txt pytest -rxXs tests/ - # TODO: enable cython tests - #pytest tests/cython + if [[ "${{ matrix.host-platform }}" == linux* ]]; then + # cython tests require gcc + apt install -y build-essential + bash tests_cython/build_tests.sh + elif [[ "${{ matrix.host-platform }}" == win* ]]; then + # TODO: enable this once win-64 runners are up + exit 1 + fi + pytest -rxXs tests_cython popd diff --git a/cuda_bindings/tests_cython/build_tests.sh b/cuda_bindings/tests_cython/build_tests.sh new file mode 100644 index 0000000000..d18a6aaa05 --- /dev/null +++ b/cuda_bindings/tests_cython/build_tests.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +cd "$(dirname "$0")" +CPLUS_INCLUDE_PATH=$CUDA_HOME/include:$CPLUS_INCLUDE_PATH cythonize -3 -i test_*.pyx diff --git a/cuda_bindings/tests_cython/test_ccuda.pyx b/cuda_bindings/tests_cython/test_ccuda.pyx index b216323e38..5b625ce48a 100644 --- a/cuda_bindings/tests_cython/test_ccuda.pyx +++ b/cuda_bindings/tests_cython/test_ccuda.pyx @@ -5,6 +5,9 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. + +# distutils: language=c++ + from libc.string cimport ( memset, memcmp @@ -53,4 +56,4 @@ def test_ccuda_memcpy(): err = ccuda.cuMemFree(dptr) assert(err == 0) err = ccuda.cuCtxDestroy(ctx) - assert(err == 0) \ No newline at end of file + assert(err == 0) diff --git a/cuda_bindings/tests_cython/test_ccudart.pyx b/cuda_bindings/tests_cython/test_ccudart.pyx index 0871da40d9..e57816989b 100644 --- a/cuda_bindings/tests_cython/test_ccudart.pyx +++ b/cuda_bindings/tests_cython/test_ccudart.pyx @@ -5,6 +5,9 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. + +# distutils: language=c++ + from libc.string cimport ( memset, memcmp diff --git a/cuda_bindings/tests_cython/test_interoperability_cython.pyx b/cuda_bindings/tests_cython/test_interoperability_cython.pyx index d5a045ed4c..8a42e6e334 100644 --- a/cuda_bindings/tests_cython/test_interoperability_cython.pyx +++ b/cuda_bindings/tests_cython/test_interoperability_cython.pyx @@ -5,6 +5,9 @@ # this software. Any use, reproduction, disclosure, or distribution of # this software and related documentation outside the terms of the EULA # is strictly prohibited. + +# distutils: language=c++ + import pytest import cuda.cuda as cuda import cuda.cudart as cudart