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/CMakeLists.txt b/openmp/libomptarget/test/CMakeLists.txt --- a/openmp/libomptarget/test/CMakeLists.txt +++ b/openmp/libomptarget/test/CMakeLists.txt @@ -20,7 +20,8 @@ # Configure the lit.site.cfg.in file set(AUTO_GEN_COMMENT "## Autogenerated by libomptarget configuration.\n# Do not edit!") + get_filename_component(CUDA_LIBDIR "${CUDA_cudart_static_LIBRARY}" DIRECTORY) configure_file(lit.site.cfg.in ${CURRENT_TARGET}/lit.site.cfg @ONLY) endforeach() add_openmp_testsuite(check-libomptarget "Running libomptarget tests" ${LIBOMPTARGET_LIT_TESTSUITES} EXCLUDE_FROM_CHECK_ALL DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS}) \ No newline at end of file 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 @@ -73,6 +73,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, ":") @@ -140,9 +142,9 @@ libomptarget_target, \ "%not --crash %t")) 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: @@ -180,5 +182,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@/@CURRENT_TARGET@" config.library_dir = "@LIBOMPTARGET_LIBRARY_DIR@" config.omp_header_directory = "@LIBOMPTARGET_OPENMP_HEADER_FOLDER@"