Skip to content

Commit 96bb3f4

Browse files
authored
[SYCL][E2E] Add CUDA SDK autodetection (#16896)
Add autodetection of the CUDA SDK using CMake's builtin `find_package`. I didn't remove the LIT params or handling in lit.py as to not break anyone who may want to use a custom install. Confirmed working [here](https://github.com/intel/llvm/actions/runs/13166519697/job/36748743079?pr=16896) as `Adapters/cuda_queue_priority.cpp` passed. Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
1 parent 7e2f297 commit 96bb3f4

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

devops/actions/run-tests/e2e/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ runs:
5555
if: inputs.testing_mode != 'run-only'
5656
shell: bash
5757
run: |
58-
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DCMAKE_CXX_COMPILER="${{ inputs.cxx_compiler || '$(which clang++)'}}" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" -DCUDA_LIBS_DIR=/usr/local/cuda/lib64 -DCUDA_INCLUDE=/usr/local/cuda/include ${{ steps.cmake_opts.outputs.opts }}
58+
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DCMAKE_CXX_COMPILER="${{ inputs.cxx_compiler || '$(which clang++)'}}" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" ${{ steps.cmake_opts.outputs.opts }}
5959
- name: SYCL End-to-end tests
6060
shell: bash {0}
6161
env:

sycl/test-e2e/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ endif()
6969

7070
set(SYCL_E2E_CLANG_CXX_FLAGS "${SYCL_E2E_CLANG_CXX_FLAGS} -Werror")
7171

72+
find_package(CUDAToolkit)
73+
74+
if(CUDAToolkit_FOUND)
75+
set(CUDA_LIBS_DIR "${CUDAToolkit_LIBRARY_DIR}")
76+
set(CUDA_INCLUDE "${CUDAToolkit_INCLUDE_DIRS}")
77+
endif()
78+
7279
if(SYCL_TEST_E2E_STANDALONE)
7380
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in"
7481
"${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py")

sycl/test-e2e/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ at the full path specified by this variable.
180180
181181
***LEVEL_ZERO_LIBS_DIR*** - path to Level Zero libraries.
182182
183-
***CUDA_INCLUDE*** - path to CUDA headers.
183+
***CUDA_INCLUDE*** - path to CUDA headers (autodetected).
184184
185-
***CUDA_LIBS_DIR*** - path to CUDA libraries.
185+
***CUDA_LIBS_DIR*** - path to CUDA libraries (autodetected).
186186
187187
***AMD_ARCH*** - flag may be set for when using HIP AMD triple. For example it
188188
may be set to "gfx906". Otherwise must be provided via the ***amd_arch*** LIT
@@ -288,9 +288,9 @@ configure specific single test execution in the command line:
288288
* **level_zero_libs_dir** - directory containing Level_Zero native libraries,
289289
can be also set by CMake variable LEVEL_ZERO_LIBS_DIR.
290290
* **cuda_include** - directory containing CUDA SDK headers, can be also set by
291-
CMake variable CUDA_INCLUDE.
291+
CMake variable CUDA_INCLUDE (autodetected).
292292
* **cuda_libs_dir** - directory containing CUDA SDK libraries, can be also set
293-
by CMake variable CUDA_LIBS_DIR.
293+
by CMake variable CUDA_LIBS_DIR (autodetected).
294294
* **run_launcher** - part of `%{run*}` expansion/substitution to alter execution
295295
of the test by, e.g., running it through Valgrind.
296296

0 commit comments

Comments
 (0)