Skip to content

Commit b41ffe8

Browse files
[BOLT] better support for in-tree build
The current LLVM project is maintained in a single repository. Although BOLT will be provided as a single repository, BOLT should work with the LLVM repository, too. This patch updates CMakefiles so that BOLT can be separately installed as "BOLT" in addition to the default LLVM OpenMP library. BOLT will be installed to bolt/ directory by default unless you set -DLIBOMP_USE_BOLT_DEFAULT=true. The original LLVM project does not recognize BOLT, so the user needs to modify its CMakefiles. This patch will be created in the future.
1 parent 958eacf commit b41ffe8

36 files changed

+305
-192
lines changed

CMakeLists.txt

+12-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
66
# llvm/runtimes/ will set OPENMP_STANDALONE_BUILD.
77
if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")
88
set(OPENMP_STANDALONE_BUILD TRUE)
9-
project(openmp C CXX)
9+
project(bolt C CXX)
1010

1111
# CMAKE_BUILD_TYPE was not set, default to Release.
1212
if (NOT CMAKE_BUILD_TYPE)
@@ -29,8 +29,17 @@ if (OPENMP_STANDALONE_BUILD OR "${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_S
2929
set(OPENMP_LLVM_TOOLS_DIR "" CACHE PATH "Path to LLVM tools for testing.")
3030
else()
3131
set(OPENMP_ENABLE_WERROR ${LLVM_ENABLE_WERROR})
32-
# If building in tree, we honor the same install suffix LLVM uses.
33-
set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
32+
set(LIBOMP_USE_BOLT_DEFAULT FALSE CACHE BOOL "Use BOLT as a default LLVM OpenMP?")
33+
if (${LIBOMP_USE_BOLT_DEFAULT})
34+
# If building in tree, we honor the same install suffix LLVM uses.
35+
set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}")
36+
else()
37+
# If building in tree, we put BOLT libraries in a special directory
38+
set(OPENMP_INSTALL_LIBDIR "lib${LLVM_LIBDIR_SUFFIX}/bolt")
39+
endif()
40+
# Place libraries in "lib/bolt"
41+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/bolt)
42+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/bolt)
3443

3544
if (NOT MSVC)
3645
set(OPENMP_TEST_C_COMPILER ${LLVM_RUNTIME_OUTPUT_INTDIR}/clang)

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,15 @@ Optional Features
187187
Align certain data structures on 4096-byte. This option is useful on
188188
multi-node systems where a small ``CACHE_LINE`` setting leads to false sharing.
189189

190-
**LIBOMP_OMPT_SUPPORT** = ``ON|OFF``
190+
**LIBBOLT_OMPT_SUPPORT** = ``ON|OFF``
191191
Include support for the OpenMP Tools Interface (OMPT).
192192
This option is supported and ``ON`` by default for x86, x86_64, AArch64,
193193
PPC64 and RISCV64 on Linux* and macOS*.
194194
This option is ``OFF`` if this feature is not supported for the platform.
195195

196196
**LIBOMP_OMPT_OPTIONAL** = ``ON|OFF``
197197
Include support for optional OMPT functionality. This option is ignored if
198-
**LIBOMP_OMPT_SUPPORT** is ``OFF``.
198+
**LIBBOLT_OMPT_SUPPORT** is ``OFF``.
199199

200200
**LIBOMP_STATS** = ``OFF|ON``
201201
Include stats-gathering code.

cmake/OpenMPTesting.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,5 @@ function(construct_check_openmp_target)
195195

196196
# We already added the testsuites themselves, no need to do that again.
197197
set(EXCLUDE_FROM_ALL True)
198-
add_openmp_testsuite(check-openmp "Running OpenMP tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
198+
add_openmp_testsuite(check-bolt-openmp "Running BOLT tests" ${OPENMP_LIT_TESTSUITES} DEPENDS ${OPENMP_LIT_DEPENDS})
199199
endfunction()

external/CMakeLists.txt

+18-6
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,25 @@ if(${LIBOMP_USE_BUILTIN_ARGOBOTS})
5353
BINARY_DIR ${ABT_BUILD_DIR}
5454
CONFIGURE_COMMAND ${ABT_CONFIGURE} --prefix=${ABT_INSTALL_DIR} CC=${CMAKE_C_COMPILER}
5555
)
56-
# FIXME: pkfconfig is not properly set since the built-in Argobots is
57-
# once installed to a different path. Temporarily pkgconfig is not installed.
58-
install(DIRECTORY ${ABT_INSTALL_DIR}/lib
59-
DESTINATION ${CMAKE_INSTALL_PREFIX}
56+
# Install libraries.
57+
if(${OPENMP_STANDALONE_BUILD})
58+
set(ABT_LIBS_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib)
59+
else()
60+
set(ABT_LIBS_INSTALL_PATH ${OPENMP_INSTALL_LIBDIR})
61+
endif()
62+
# pkgconfig is not installed.
63+
install(DIRECTORY ${ABT_INSTALL_DIR}/lib/
64+
DESTINATION ${ABT_LIBS_INSTALL_PATH}
6065
PATTERN pkgconfig EXCLUDE)
61-
install(DIRECTORY ${ABT_INSTALL_DIR}/include
62-
DESTINATION ${CMAKE_INSTALL_PREFIX})
66+
# Install headers. pkgconfig is not installed.
67+
if(${OPENMP_STANDALONE_BUILD})
68+
set(ABT_HEADERS_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/include)
69+
else()
70+
string(REGEX MATCH "[0-9]+\\.[0-9]+(\\.[0-9]+)?" CLANG_VERSION ${PACKAGE_VERSION})
71+
set(ABT_HEADERS_INSTALL_PATH "${OPENMP_INSTALL_LIBDIR}/clang/${CLANG_VERSION}/include")
72+
endif()
73+
install(FILES ${ABT_INSTALL_DIR}/include/abt.h
74+
DESTINATION ${ABT_HEADERS_INSTALL_PATH})
6375

6476
set(LIBOMP_ARGOBOTS_INSTALL_DIR ${ABT_INSTALL_DIR} PARENT_SCOPE)
6577
else()

libomptarget/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ set (LIBOMPTARGET_ALL_TARGETS "${LIBOMPTARGET_ALL_TARGETS} nvptx64-nvidia-cuda")
3838

3939
# Once the plugins for the different targets are validated, they will be added to
4040
# the list of supported targets in the current system.
41-
set (LIBOMPTARGET_SYSTEM_TARGETS "")
42-
set (LIBOMPTARGET_TESTED_PLUGINS "")
41+
set (LIBBOLTTARGET_SYSTEM_TARGETS "")
42+
set (LIBBOLTTARGET_TESTED_PLUGINS "")
4343

4444
# Check whether using debug mode. In debug mode, allow dumping progress
4545
# messages at runtime by default. Otherwise, it can be enabled
@@ -61,7 +61,7 @@ add_subdirectory(src)
6161

6262
# Retrieve the path to the resulting library so that it can be used for
6363
# testing.
64-
get_target_property(LIBOMPTARGET_LIBRARY_DIR omptarget LIBRARY_OUTPUT_DIRECTORY)
64+
get_target_property(LIBOMPTARGET_LIBRARY_DIR bolt-omptarget LIBRARY_OUTPUT_DIRECTORY)
6565
if(NOT LIBOMPTARGET_LIBRARY_DIR)
6666
set(LIBOMPTARGET_LIBRARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
6767
endif()

libomptarget/cmake/Modules/LibomptargetUtils.cmake

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
# void libomptarget_say(string message_to_user);
1212
# - prints out message_to_user
1313
macro(libomptarget_say message_to_user)
14-
message(STATUS "LIBOMPTARGET: ${message_to_user}")
14+
message(STATUS "BOLT-LIBOMPTARGET: ${message_to_user}")
1515
endmacro()
1616

1717
# void libomptarget_warning_say(string message_to_user);
1818
# - prints out message_to_user with a warning
1919
macro(libomptarget_warning_say message_to_user)
20-
message(WARNING "LIBOMPTARGET: ${message_to_user}")
20+
message(WARNING "BOLT-LIBOMPTARGET: ${message_to_user}")
2121
endmacro()
2222

2323
# void libomptarget_error_say(string message_to_user);
2424
# - prints out message_to_user with an error and exits cmake
2525
macro(libomptarget_error_say message_to_user)
26-
message(FATAL_ERROR "LIBOMPTARGET: ${message_to_user}")
26+
message(FATAL_ERROR "BOLT-LIBOMPTARGET: ${message_to_user}")
2727
endmacro()

libomptarget/deviceRTLs/amdgcn/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ endif()
3838

3939
libomptarget_say("Building AMDGCN device RTL. LLVM_COMPILER_PATH=${AOMP_BINDIR}")
4040

41-
project(omptarget-amdgcn)
41+
project(bolt-omptarget-amdgcn)
4242

43-
add_custom_target(omptarget-amdgcn ALL)
43+
add_custom_target(bolt-omptarget-amdgcn ALL)
4444

4545
#optimization level
4646
set(optimization_level 2)
@@ -131,7 +131,7 @@ macro(add_cuda_bc_library)
131131
list(APPEND bc_files linkout.cuda.${mcpu}.bc)
132132
endmacro()
133133

134-
set(libname "omptarget-amdgcn")
134+
set(libname "bolt-omptarget-amdgcn")
135135

136136
foreach(mcpu ${mcpus})
137137
set(bc_files)

libomptarget/deviceRTLs/nvptx/CMakeLists.txt

+20-7
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,26 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
9595
set(CUDA_SEPARABLE_COMPILATION ON)
9696
list(APPEND CUDA_NVCC_FLAGS -I${devicertl_base_directory}
9797
-I${devicertl_nvptx_directory}/src)
98-
cuda_add_library(omptarget-nvptx STATIC ${cuda_src_files} ${omp_data_objects}
98+
cuda_add_library(bolt-omptarget-nvptx STATIC ${cuda_src_files} ${omp_data_objects}
9999
OPTIONS ${CUDA_ARCH} ${CUDA_DEBUG})
100100

101101
# Install device RTL under the lib destination folder.
102-
install(TARGETS omptarget-nvptx ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
102+
install(TARGETS bolt-omptarget-nvptx ARCHIVE DESTINATION "${OPENMP_INSTALL_LIBDIR}")
103+
104+
# Install aliases
105+
get_target_property(BOLT_LIBOMPTARGET_LIBRARY_DIR bolt-omptarget-nvptx LIBRARY_OUTPUT_DIRECTORY)
106+
if(BOLT_LIBOMPTARGET_LIBRARY_DIR)
107+
add_custom_command(TARGET bolt-omptarget-nvptx POST_BUILD
108+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_STATIC_LIBRARY_PREFIX}bolt-omptarget-nvptx${CMAKE_STATIC_LIBRARY_SUFFIX}
109+
${CMAKE_STATIC_LIBRARY_PREFIX}omptarget-nvptx${CMAKE_STATIC_LIBRARY_SUFFIX}
110+
WORKING_DIRECTORY ${BOLT_LIBOMPTARGET_LIBRARY_DIR}
111+
)
112+
endif()
113+
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${CMAKE_STATIC_LIBRARY_PREFIX}bolt-omptarget-nvptx${CMAKE_STATIC_LIBRARY_SUFFIX}\"
114+
\"${CMAKE_STATIC_LIBRARY_PREFIX}omptarget-nvptx${CMAKE_STATIC_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
115+
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
103116

104-
target_link_libraries(omptarget-nvptx ${CUDA_LIBRARIES})
117+
target_link_libraries(bolt-omptarget-nvptx ${CUDA_LIBRARIES})
105118

106119

107120
# Check if we can create an LLVM bitcode implementation of the runtime library
@@ -146,7 +159,7 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
146159
endif()
147160

148161
# Create target to build all Bitcode libraries.
149-
add_custom_target(omptarget-nvptx-bc)
162+
add_custom_target(bolt-omptarget-nvptx-bc)
150163

151164
# Generate a Bitcode library for all the compute capabilities the user requested.
152165
foreach(sm ${nvptx_sm_list})
@@ -180,11 +193,11 @@ if(LIBOMPTARGET_DEP_CUDA_FOUND)
180193
)
181194
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES libomptarget-nvptx-sm_${sm}.bc)
182195

183-
add_custom_target(omptarget-nvptx-${sm}-bc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libomptarget-nvptx-sm_${sm}.bc)
184-
add_dependencies(omptarget-nvptx-bc omptarget-nvptx-${sm}-bc)
196+
add_custom_target(bolt-omptarget-nvptx-${sm}-bc ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/libomptarget-nvptx-sm_${sm}.bc)
197+
add_dependencies(bolt-omptarget-nvptx-bc bolt-omptarget-nvptx-${sm}-bc)
185198

186199
# Copy library to destination.
187-
add_custom_command(TARGET omptarget-nvptx-${sm}-bc POST_BUILD
200+
add_custom_command(TARGET bolt-omptarget-nvptx-${sm}-bc POST_BUILD
188201
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libomptarget-nvptx-sm_${sm}.bc
189202
$<TARGET_FILE_DIR:omptarget-nvptx>)
190203

libomptarget/deviceRTLs/nvptx/test/CMakeLists.txt

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ if(NOT OPENMP_TEST_COMPILER_ID STREQUAL "Clang")
33
return()
44
endif()
55

6-
set(deps omptarget-nvptx omptarget omp)
6+
set(deps bolt-omptarget-nvptx bolt-omptarget bolt-omp)
77
if(LIBOMPTARGET_NVPTX_ENABLE_BCLIB)
8-
set(deps ${deps} omptarget-nvptx-bc)
8+
set(deps ${deps} bolt-omptarget-nvptx-bc)
99
endif()
1010

1111
# Don't run by default.
1212
set(EXCLUDE_FROM_ALL True)
1313
# Run with only one thread to only launch one application to the GPU at a time.
14-
add_openmp_testsuite(check-libomptarget-nvptx
14+
add_openmp_testsuite(check-bolt-libomptarget-nvptx
1515
"Running libomptarget-nvptx tests" ${CMAKE_CURRENT_BINARY_DIR}
1616
DEPENDS ${deps} ARGS -j1)
1717

libomptarget/deviceRTLs/nvptx/test/lit.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def prepend_library_path(name, value, sep):
1616
config.environment[name] = value
1717

1818
# name: The name of this test suite.
19-
config.name = 'libomptarget-nvptx'
19+
config.name = 'bolt-libomptarget-nvptx'
2020

2121
# suffixes: A list of file extensions to treat as test files.
2222
config.suffixes = ['.c', '.cpp', '.cc']

libomptarget/plugins/CMakeLists.txt

+24-11
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,41 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "${tmachine}$")
3131
# Define macro with the ELF ID for this target.
3232
add_definitions("-DTARGET_ELF_ID=${elf_machine_id}")
3333

34-
add_library("omptarget.rtl.${tmachine_libname}" SHARED
34+
add_library("bolt-omptarget.rtl.${tmachine_libname}" SHARED
3535
${CMAKE_CURRENT_SOURCE_DIR}/../generic-elf-64bit/src/rtl.cpp)
3636

3737
# Install plugin under the lib destination folder.
38-
install(TARGETS "omptarget.rtl.${tmachine_libname}"
38+
install(TARGETS "bolt-omptarget.rtl.${tmachine_libname}"
3939
LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
40+
41+
# Install aliases
42+
get_target_property(BOLT_LIBOMPTARGET_LIBRARY_DIR "bolt-omptarget.rtl.${tmachine_libname}" LIBRARY_OUTPUT_DIRECTORY)
43+
if(BOLT_LIBOMPTARGET_LIBRARY_DIR)
44+
add_custom_command(TARGET "bolt-omptarget.rtl.${tmachine_libname}" POST_BUILD
45+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget.rtl.${tmachine_libname}${CMAKE_SHARED_LIBRARY_SUFFIX}
46+
${CMAKE_SHARED_LIBRARY_PREFIX}omptarget.rtl.${tmachine_libname}${CMAKE_SHARED_LIBRARY_SUFFIX}
47+
WORKING_DIRECTORY ${BOLT_LIBOMPTARGET_LIBRARY_DIR}
48+
)
49+
endif()
50+
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget.rtl.${tmachine_libname}${CMAKE_SHARED_LIBRARY_SUFFIX}\"
51+
\"${CMAKE_SHARED_LIBRARY_PREFIX}omptarget.rtl.${tmachine_libname}${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
52+
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
4053

4154
target_link_libraries(
42-
"omptarget.rtl.${tmachine_libname}"
55+
"bolt-omptarget.rtl.${tmachine_libname}"
4356
${LIBOMPTARGET_DEP_LIBFFI_LIBRARIES}
4457
${LIBOMPTARGET_DEP_LIBELF_LIBRARIES}
4558
dl
4659
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
4760

48-
list(APPEND LIBOMPTARGET_TESTED_PLUGINS
49-
"omptarget.rtl.${tmachine_libname}")
61+
list(APPEND LIBBOLTTARGET_TESTED_PLUGINS
62+
"bolt-omptarget.rtl.${tmachine_libname}")
5063

5164
# Report to the parent scope that we are building a plugin.
52-
set(LIBOMPTARGET_SYSTEM_TARGETS
53-
"${LIBOMPTARGET_SYSTEM_TARGETS} ${tmachine_triple}" PARENT_SCOPE)
54-
set(LIBOMPTARGET_TESTED_PLUGINS
55-
"${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
65+
set(LIBBOLTTARGET_SYSTEM_TARGETS
66+
"${LIBBOLTTARGET_SYSTEM_TARGETS} ${tmachine_triple}" PARENT_SCOPE)
67+
set(LIBBOLTTARGET_TESTED_PLUGINS
68+
"${LIBBOLTTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
5669

5770
else(LIBOMPTARGET_DEP_LIBFFI_FOUND)
5871
libomptarget_say("Not building ${tmachine_name} offloading plugin: libffi dependency not found.")
@@ -72,6 +85,6 @@ add_subdirectory(ppc64le)
7285
add_subdirectory(x86_64)
7386

7487
# Make sure the parent scope can see the plugins that will be created.
75-
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
76-
set(LIBOMPTARGET_TESTED_PLUGINS "${LIBOMPTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
88+
set(LIBBOLTTARGET_SYSTEM_TARGETS "${LIBBOLTTARGET_SYSTEM_TARGETS}" PARENT_SCOPE)
89+
set(LIBBOLTTARGET_TESTED_PLUGINS "${LIBBOLTTARGET_TESTED_PLUGINS}" PARENT_SCOPE)
7790

libomptarget/plugins/cuda/CMakeLists.txt

+17-4
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,28 @@ add_definitions(-DTARGET_NAME=CUDA)
3131
include_directories(${LIBOMPTARGET_DEP_CUDA_INCLUDE_DIRS})
3232
include_directories(${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIRS})
3333

34-
add_library(omptarget.rtl.cuda SHARED src/rtl.cpp)
34+
add_library(bolt-omptarget.rtl.cuda SHARED src/rtl.cpp)
3535

3636
# Install plugin under the lib destination folder.
37-
install(TARGETS omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
37+
install(TARGETS bolt-omptarget.rtl.cuda LIBRARY DESTINATION "${OPENMP_INSTALL_LIBDIR}")
3838

39-
target_link_libraries(omptarget.rtl.cuda
39+
# Install aliases
40+
get_target_property(BOLT_LIBOMPTARGET_LIBRARY_DIR bolt-omptarget.rtl.cuda LIBRARY_OUTPUT_DIRECTORY)
41+
if(BOLT_LIBOMPTARGET_LIBRARY_DIR)
42+
add_custom_command(TARGET bolt-omptarget.rtl.cuda POST_BUILD
43+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget.rtl.cuda${CMAKE_SHARED_LIBRARY_SUFFIX}
44+
${CMAKE_SHARED_LIBRARY_PREFIX}omptarget.rtl.cuda${CMAKE_SHARED_LIBRARY_SUFFIX}
45+
WORKING_DIRECTORY ${BOLT_LIBOMPTARGET_LIBRARY_DIR}
46+
)
47+
endif()
48+
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget.rtl.cuda${CMAKE_SHARED_LIBRARY_SUFFIX}\"
49+
\"${CMAKE_SHARED_LIBRARY_PREFIX}omptarget.rtl.cuda${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
50+
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")
51+
52+
target_link_libraries(bolt-omptarget.rtl.cuda
4053
${LIBOMPTARGET_DEP_CUDA_DRIVER_LIBRARIES}
4154
${LIBOMPTARGET_DEP_LIBELF_LIBRARIES}
4255
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/../exports")
4356

4457
# Report to the parent scope that we are building a plugin for CUDA.
45-
set(LIBOMPTARGET_SYSTEM_TARGETS "${LIBOMPTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda" PARENT_SCOPE)
58+
set(LIBBOLTTARGET_SYSTEM_TARGETS "${LIBBOLTTARGET_SYSTEM_TARGETS} nvptx64-nvidia-cuda" PARENT_SCOPE)

libomptarget/src/CMakeLists.txt

+16-3
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,24 @@ set(src_files
2121
)
2222

2323
# Build libomptarget library with libdl dependency.
24-
add_library(omptarget SHARED ${src_files})
25-
target_link_libraries(omptarget
24+
add_library(bolt-omptarget SHARED ${src_files})
25+
target_link_libraries(bolt-omptarget
2626
${CMAKE_DL_LIBS}
2727
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
2828

2929
# Install libomptarget under the lib destination folder.
30-
install(TARGETS omptarget LIBRARY COMPONENT omptarget
30+
install(TARGETS bolt-omptarget LIBRARY COMPONENT omptarget
3131
DESTINATION "${OPENMP_INSTALL_LIBDIR}")
32+
33+
# Install aliases
34+
get_target_property(BOLT_LIBOMPTARGET_LIBRARY_DIR bolt-omptarget LIBRARY_OUTPUT_DIRECTORY)
35+
if(BOLT_LIBOMPTARGET_LIBRARY_DIR)
36+
add_custom_command(TARGET bolt-omptarget POST_BUILD
37+
COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget${CMAKE_SHARED_LIBRARY_SUFFIX}
38+
${CMAKE_SHARED_LIBRARY_PREFIX}omptarget${CMAKE_SHARED_LIBRARY_SUFFIX}
39+
WORKING_DIRECTORY ${BOLT_LIBOMPTARGET_LIBRARY_DIR}
40+
)
41+
endif()
42+
install(CODE "execute_process(COMMAND \"\${CMAKE_COMMAND}\" -E create_symlink \"${CMAKE_SHARED_LIBRARY_PREFIX}bolt-omptarget${CMAKE_SHARED_LIBRARY_SUFFIX}\"
43+
\"${CMAKE_SHARED_LIBRARY_PREFIX}omptarget${CMAKE_SHARED_LIBRARY_SUFFIX}\" WORKING_DIRECTORY
44+
\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/${OPENMP_INSTALL_LIBDIR})")

libomptarget/test/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ else()
1212
set(LIBOMPTARGET_DEBUG False)
1313
endif()
1414

15-
add_openmp_testsuite(check-libomptarget "Running libomptarget tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS omptarget omp ${LIBOMPTARGET_TESTED_PLUGINS})
15+
add_openmp_testsuite(check-bolt-libomptarget "Running libomptarget tests" ${CMAKE_CURRENT_BINARY_DIR} DEPENDS bolt-omptarget bolt-omp ${LIBBOLTTARGET_TESTED_PLUGINS})
1616

1717
# Configure the lit.site.cfg.in file
1818
set(AUTO_GEN_COMMENT "## Autogenerated by libomptarget configuration.\n# Do not edit!")

libomptarget/test/lit.cfg

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def append_dynamic_library_path(name, value, sep):
1616
config.environment[name] = value
1717

1818
# name: The name of this test suite.
19-
config.name = 'libomptarget'
19+
config.name = 'bolt-libomptarget'
2020

2121
# suffixes: A list of file extensions to treat as test files.
2222
config.suffixes = ['.c', '.cpp', '.cc']

libomptarget/test/lit.site.cfg.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ config.operating_system = "@CMAKE_SYSTEM_NAME@"
1313
config.using_abt = @LIBOMP_TEST_USE_ARGOBOTS@
1414
config.libabt_dir = "@LIBOMP_ARGOBOTS_INSTALL_DIR@"
1515
config.libomptarget_all_targets = "@LIBOMPTARGET_ALL_TARGETS@".split()
16-
config.libomptarget_system_targets = "@LIBOMPTARGET_SYSTEM_TARGETS@".split()
16+
config.libomptarget_system_targets = "@LIBBOLTTARGET_SYSTEM_TARGETS@".split()
1717
config.libomptarget_filecheck = "@OPENMP_FILECHECK_EXECUTABLE@"
1818
config.libomptarget_debug = @LIBOMPTARGET_DEBUG@
1919

0 commit comments

Comments
 (0)