Skip to content

Commit 3de162f

Browse files
authored
[Offload] Fix using old deprecated CUDA root variable (#96307)
Summary: This variable isn't being set properly since we moved to the new way to find the CUDA directory. That means this variable was just unset the whole time. This patch adds it in by calculating it using the binary directory so it can be passed to `--cuda-path`.
1 parent f581d19 commit 3de162f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

offload/test/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ endif()
1616
# char into the lit command.
1717
string(REPLACE " " ";" LIBOMPTARGET_LIT_ARG_LIST "${LIBOMPTARGET_LIT_ARGS}")
1818

19+
find_package(CUDAToolkit QUIET)
20+
if(CUDAToolkit_FOUND)
21+
get_filename_component(CUDA_ROOT "${CUDAToolkit_BIN_DIR}" DIRECTORY ABSOLUTE)
22+
get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY)
23+
endif()
24+
1925
string(REGEX MATCHALL "([^\ ]+\ |[^\ ]+$)" SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}")
2026
foreach(CURRENT_TARGET IN LISTS SYSTEM_TARGETS)
2127
string(STRIP "${CURRENT_TARGET}" CURRENT_TARGET)
@@ -29,7 +35,6 @@ foreach(CURRENT_TARGET IN LISTS SYSTEM_TARGETS)
2935

3036
# Configure the lit.site.cfg.in file
3137
set(AUTO_GEN_COMMENT "## Autogenerated by libomptarget configuration.\n# Do not edit!")
32-
get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY)
3338
configure_file(lit.site.cfg.in ${CURRENT_TARGET}/lit.site.cfg @ONLY)
3439
endforeach()
3540

offload/test/lit.site.cfg.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ config.test_fortran_compiler="@OPENMP_TEST_Fortran_COMPILER@"
77
config.test_compiler_features = @OPENMP_TEST_COMPILER_FEATURES@
88
config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@"
99
config.test_extra_flags = "@OPENMP_TEST_FLAGS@"
10-
config.cuda_path = "@CUDA_TOOLKIT_ROOT_DIR@"
10+
config.cuda_path = "@CUDA_ROOT@"
1111
config.cuda_libdir = "@CUDA_LIBDIR@"
1212
config.cuda_test_arch = "@LIBOMPTARGET_DEP_CUDA_ARCH@"
1313
config.amdgpu_test_arch = "@LIBOMPTARGET_AMDGPU_DETECTED_ARCH_LIST@"

0 commit comments

Comments
 (0)