diff --git a/openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg b/openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg --- a/openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg +++ b/openmp/libomptarget/deviceRTLs/nvptx/test/lit.cfg @@ -44,6 +44,8 @@ prepend_library_path('LIBRARY_PATH', config.library_dir, ":") prepend_library_path('LD_LIBRARY_PATH', config.library_dir, ":") prepend_library_path('LD_LIBRARY_PATH', config.omp_host_rtl_directory, ":") +if config.cuda_libdir: + prepend_library_path('LD_LIBRARY_PATH', config.cuda_libdir, ":") # Forbid fallback to host. config.environment["OMP_TARGET_OFFLOAD"] = "MANDATORY" @@ -57,13 +59,17 @@ config.substitutions.append(("%compile-and-run", "%compile && %run")) config.substitutions.append(("%compilexx", - "%clangxx %openmp_flags %flags %s -o %t")) + "%clangxx %openmp_flags %cuda_flags %flags %s -o %t")) config.substitutions.append(("%compile", - "%clang %openmp_flags %flags %s -o %t")) + "%clang %openmp_flags %cuda_flags %flags %s -o %t")) config.substitutions.append(("%clangxx", config.test_cxx_compiler)) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flags", config.test_openmp_flags)) +if config.cuda_path: + config.substitutions.append(("%cuda_flags", "--cuda-path=" + config.cuda_path)) +else: + config.substitutions.append(("%cuda_flags", "")) config.substitutions.append(("%flags", config.test_flags)) config.substitutions.append(("%run", "%t")) diff --git a/openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in b/openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in --- a/openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in +++ b/openmp/libomptarget/deviceRTLs/nvptx/test/lit.site.cfg.in @@ -4,6 +4,8 @@ config.test_cxx_compiler = "@OPENMP_TEST_CXX_COMPILER@" config.test_openmp_flags = "@LIBOMPTARGET_NVPTX_TEST_OPENMP_FLAGS@" config.test_extra_flags = "@LIBOMPTARGET_NVPTX_TEST_FLAGS@" +config.cuda_path = "@CUDA_TOOLKIT_ROOT_DIR@" +config.cuda_libdir = "@CUDA_LIBDIR@" config.binary_dir = "@CMAKE_CURRENT_BINARY_DIR@" config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@" config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@" diff --git a/openmp/libomptarget/test/lit.cfg b/openmp/libomptarget/test/lit.cfg --- a/openmp/libomptarget/test/lit.cfg +++ b/openmp/libomptarget/test/lit.cfg @@ -71,6 +71,8 @@ append_dynamic_library_path('LD_LIBRARY_PATH', config.library_dir, ":") append_dynamic_library_path('LD_LIBRARY_PATH', \ config.omp_host_rtl_directory, ":") + if config.cuda_libdir: + append_dynamic_library_path('LD_LIBRARY_PATH', config.cuda_libdir, ":") append_dynamic_library_path('LIBRARY_PATH', config.library_dir, ":") append_dynamic_library_path('LIBRARY_PATH', \ config.omp_host_rtl_directory, ":") @@ -116,9 +118,9 @@ libomptarget_target, \ "%not --crash %t-" + libomptarget_target)) config.substitutions.append(("%clangxx-" + libomptarget_target, \ - "%clangxx %openmp_flags %flags -fopenmp-targets=" + libomptarget_target)) + "%clangxx %openmp_flags %cuda_flags %flags -fopenmp-targets=" + libomptarget_target)) config.substitutions.append(("%clang-" + libomptarget_target, \ - "%clang %openmp_flags %flags -fopenmp-targets=" + libomptarget_target)) + "%clang %openmp_flags %cuda_flags %flags -fopenmp-targets=" + libomptarget_target)) config.substitutions.append(("%fcheck-" + libomptarget_target, \ config.libomptarget_filecheck + " %s")) else: @@ -156,5 +158,9 @@ config.substitutions.append(("%clangxx", config.test_cxx_compiler)) config.substitutions.append(("%clang", config.test_c_compiler)) config.substitutions.append(("%openmp_flags", config.test_openmp_flags)) +if config.cuda_path: + config.substitutions.append(("%cuda_flags", "--cuda-path=" + config.cuda_path)) +else: + config.substitutions.append(("%cuda_flags", "")) config.substitutions.append(("%flags", config.test_flags)) config.substitutions.append(("%not", config.libomptarget_not)) diff --git a/openmp/libomptarget/test/lit.site.cfg.in b/openmp/libomptarget/test/lit.site.cfg.in --- a/openmp/libomptarget/test/lit.site.cfg.in +++ b/openmp/libomptarget/test/lit.site.cfg.in @@ -5,6 +5,8 @@ config.test_compiler_features = @OPENMP_TEST_COMPILER_FEATURES@ config.test_openmp_flags = "@OPENMP_TEST_OPENMP_FLAGS@" config.test_extra_flags = "@OPENMP_TEST_FLAGS@" +config.cuda_path = "@CUDA_TOOLKIT_ROOT_DIR@" +config.cuda_libdir = "@CUDA_LIBDIR@" config.libomptarget_obj_root = "@CMAKE_CURRENT_BINARY_DIR@" config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@" config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"