Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Standalone build examples + testing workflow updates #15

Merged
merged 12 commits into from
May 31, 2022
52 changes: 46 additions & 6 deletions .github/workflows/ubuntu-focal-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ on:
branches: [ main, develop ]

env:
BUILD_TYPE: RelWithDebInfo
ELFUTILS_DOWNLOAD_VERSION: 0.183
OMNITRACE_VERBOSE: 1
OMNITRACE_CI: ON

Expand All @@ -19,7 +17,39 @@ jobs:
image: jrmadsen/omnitrace-ci:ubuntu-20.04
strategy:
matrix:
compiler: ['g++-7', 'g++-8', 'g++-9', 'g++-10']
compiler: ['g++-7', 'g++-8']
lto: ['OFF']
strip: ['OFF']
python: ['ON']
build-type: ['Release']
mpi-headers: ['OFF']
static-libgcc: ['OFF']
static-libstdcxx: ['OFF']
include:
- compiler: 'g++-9'
lto: 'OFF'
strip: 'ON'
python: 'OFF'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'ON'
- compiler: 'g++-10'
lto: 'OFF'
strip: 'ON'
python: 'ON'
build-type: 'RelWithDebInfo'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'OFF'
- compiler: 'g++-11'
lto: 'ON'
strip: 'ON'
python: 'OFF'
build-type: 'Release'
mpi-headers: 'ON'
static-libgcc: 'ON'
static-libstdcxx: 'OFF'

steps:
- uses: actions/checkout@v2
Expand All @@ -28,6 +58,10 @@ jobs:
timeout-minutes: 5
run:
apt-get update &&
apt-get install -y software-properties-common &&
add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
apt-get update &&
apt-get upgrade -y &&
apt-get install -y build-essential m4 autoconf libtool python3-pip libiberty-dev clang libomp-dev ${{ matrix.compiler }} &&
python3 -m pip install --upgrade pip &&
python3 -m pip install numpy &&
Expand All @@ -49,18 +83,24 @@ jobs:
cmake -B build
-DCMAKE_C_COMPILER=$(echo '${{ matrix.compiler }}' | sed 's/+/c/g')
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }}
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
-DCMAKE_INSTALL_PREFIX=/opt/omnitrace
-DOMNITRACE_BUILD_TESTING=ON
-DOMNITRACE_USE_MPI=OFF
-DOMNITRACE_USE_HIP=OFF
-DOMNITRACE_USE_OMPT=OFF
-DOMNITRACE_USE_PYTHON=ON
-DOMNITRACE_USE_PAPI=OFF
-DOMNITRACE_USE_PYTHON=${{ matrix.python }}
-DOMNITRACE_USE_MPI_HEADERS=${{ matrix.mpi-headers }}
-DOMNITRACE_STRIP_LIBRARIES=${{ matrix.strip }}
-DOMNITRACE_BUILD_LTO=${{ matrix.lto }}
-DOMNITRACE_BUILD_STATIC_LIBGCC=${{ matrix.static-libgcc }}
-DOMNITRACE_BUILD_STATIC_LIBSTDCXX=${{ matrix.static-libstdcxx }}
-DOMNITRACE_PYTHON_PREFIX=/opt/conda/envs
-DOMNITRACE_PYTHON_ENVS="py3.6;py3.7;py3.8;py3.9"

- name: Build
timeout-minutes: 45
timeout-minutes: 60
run:
cmake --build build --target all --parallel 2 -- VERBOSE=1

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.0
1.0.1
4 changes: 0 additions & 4 deletions cmake/BuildSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,6 @@ else()
target_link_options(omnitrace-lto INTERFACE -flto=thin)
endif()

if(OMNITRACE_BUILD_LTO)
target_link_libraries(omnitrace-compile-options INTERFACE omnitrace::omnitrace-lto)
endif()

omnitrace_restore_variables(FLTO VARIABLES CMAKE_CXX_FLAGS)

# ----------------------------------------------------------------------------------------#
Expand Down
12 changes: 11 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(omnitrace-dyninst-examples LANGUAGES CXX)
project(omnitrace-examples LANGUAGES C CXX)

set(CMAKE_VISIBILITY_INLINES_HIDDEN OFF)
set(CMAKE_CXX_VISIBILITY_PRESET "default")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_CLANG_TIDY)

option(BUILD_SHARED_LIBS "Build dynamic libraries" ON)

if(CMAKE_PROJECT_NAME STREQUAL "omnitrace")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
endif()

add_subdirectory(transpose)
add_subdirectory(parallel-overhead)
add_subdirectory(code-coverage)
add_subdirectory(user-api)
add_subdirectory(openmp)
add_subdirectory(mpi)
add_subdirectory(python)
add_subdirectory(lulesh)
7 changes: 3 additions & 4 deletions examples/code-coverage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ string(REPLACE " " ";" _FLAGS "${CMAKE_CXX_FLAGS_DEBUG}")

find_package(Threads REQUIRED)
add_executable(code-coverage code-coverage.cpp)
target_link_libraries(code-coverage Threads::Threads)
target_link_libraries(code-coverage PRIVATE Threads::Threads)
target_compile_options(code-coverage PRIVATE ${_FLAGS})

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(code-coverage PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS code-coverage DESTINATION bin)
endif()
5 changes: 2 additions & 3 deletions examples/lulesh/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ add_executable(${PROJECT_NAME} ${sources} ${headers})
target_include_directories(${PROJECT_NAME} PRIVATE ${PROJECT_SOURCE_DIR}/includes)
target_link_libraries(${PROJECT_NAME} PRIVATE Kokkos::kokkos lulesh-mpi)

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
endif()
5 changes: 2 additions & 3 deletions examples/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ endif()

target_link_libraries(mpi-example PRIVATE MPI::MPI_CXX)

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(mpi-example PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS mpi-example DESTINATION bin)
endif()
45 changes: 28 additions & 17 deletions examples/openmp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(omnitrace-openmp LANGUAGES CXX)

file(GLOB common_source ${CMAKE_CURRENT_SOURCE_DIR}/common/*.cpp)
add_library(openmp-common OBJECT ${common_source})
Expand All @@ -11,20 +11,31 @@ add_executable(openmp-cg ${CMAKE_CURRENT_SOURCE_DIR}/CG/cg.cpp
add_executable(openmp-lu ${CMAKE_CURRENT_SOURCE_DIR}/LU/lu.cpp
$<TARGET_OBJECTS:openmp-common>)

find_program(CLANGXX_EXECUTABLE NAMES clang++)
find_library(
LIBOMP_LIBRARY
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5)
if(CLANGXX_EXECUTABLE AND LIBOMP_LIBRARY)
target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp)
target_compile_options(openmp-cg PRIVATE -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-cg PRIVATE ${LIBOMP_LIBRARY})
target_compile_options(openmp-lu PRIVATE -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-lu PRIVATE ${LIBOMP_LIBRARY})
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-common)
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-cg)
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu)
else()
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
find_package(OpenMP REQUIRED)
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
else()
find_program(CLANGXX_EXECUTABLE NAMES clang++)
find_library(
LIBOMP_LIBRARY
NAMES omp omp5 ${CMAKE_SHARED_LIBRARY_PREFIX}omp${CMAKE_SHARED_LIBRARY_SUFFIX}.5)
if(CLANGXX_EXECUTABLE
AND LIBOMP_LIBRARY
AND COMMAND omnitrace_custom_compilation)
target_compile_options(openmp-common PUBLIC -W -Wall -fopenmp=libomp)
target_compile_options(openmp-cg PRIVATE -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-cg PRIVATE ${LIBOMP_LIBRARY})
target_compile_options(openmp-lu PRIVATE -W -Wall -fopenmp=libomp)
target_link_libraries(openmp-lu PRIVATE ${LIBOMP_LIBRARY})
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-common)
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-cg)
omnitrace_custom_compilation(COMPILER ${CLANGXX_EXECUTABLE} TARGET openmp-lu)
else()
find_package(OpenMP REQUIRED)
target_link_libraries(openmp-common PUBLIC OpenMP::OpenMP_CXX)
endif()
endif()

if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS openmp-cg openmp-lu DESTINATION bin)
endif()
Empty file removed examples/openmp/openmp.cpp
Empty file.
11 changes: 4 additions & 7 deletions examples/parallel-overhead/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,12 @@ project(omnitrace-parallel-overhead LANGUAGES CXX)
set(CMAKE_BUILD_TYPE "Release")
find_package(Threads REQUIRED)
add_executable(parallel-overhead parallel-overhead.cpp)
target_link_libraries(parallel-overhead Threads::Threads)
target_link_libraries(parallel-overhead PRIVATE Threads::Threads)

add_executable(parallel-overhead-locks parallel-overhead.cpp)
target_link_libraries(parallel-overhead-locks Threads::Threads)
target_link_libraries(parallel-overhead-locks PRIVATE Threads::Threads)
target_compile_definitions(parallel-overhead-locks PRIVATE USE_LOCKS=1)

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(parallel-overhead PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
set_target_properties(parallel-overhead-locks PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS parallel-overhead parallel-overhead-locks DESTINATION bin)
endif()
17 changes: 17 additions & 0 deletions examples/python/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)

project(omnitrace-python)

set(PYTHON_FILES builtin.py external.py source.py)

if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
find_package(Python3 COMPONENTS Interpreter)
if(Python3_FOUND)
set(PYTHON_EXECUTABLE "${Python3_EXECUTABLE}")
foreach(_FILE ${PYTHON_FILES})
configure_file(${PROJECT_SOURCE_DIR}/${_FILE} ${PROJECT_BINARY_DIR}/${_FILE}
@ONLY)
install(PROGRAMS ${PROJECT_BINARY_DIR}/${_FILE} DESTINATION bin)
endforeach()
endif()
endif()
20 changes: 13 additions & 7 deletions examples/transpose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ if(NOT HIPCC_EXECUTABLE)
return()
endif()

if(NOT CMAKE_CXX_COMPILER_IS_HIPCC
AND HIPCC_EXECUTABLE
AND NOT COMMAND omnitrace_custom_compilation)
message(AUTHOR_WARNING "transpose target could not be built")
return()
endif()

option(TRANSPOSE_USE_MPI "Enable MPI support in transpose exe" ${TIMEMORY_USE_MPI})

if(TRANSPOSE_USE_MPI)
Expand All @@ -29,12 +36,11 @@ if(TRANSPOSE_USE_MPI)
target_link_libraries(transpose PRIVATE MPI::MPI_C)
endif()

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(transpose PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
# defined in MacroUtilities.cmake
omnitrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose)
endif()

if(NOT CMAKE_CXX_COMPILER_IS_HIPCC AND HIPCC_EXECUTABLE)
# defined in MacroUtilities.cmake
omnitrace_custom_compilation(COMPILER ${HIPCC_EXECUTABLE} TARGET transpose)
endif()
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS transpose DESTINATION bin)
endif()
8 changes: 5 additions & 3 deletions examples/user-api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ project(omnitrace-user-api LANGUAGES CXX)

set(CMAKE_BUILD_TYPE "Debug")
find_package(Threads REQUIRED)
if(NOT TARGET omnitrace::omnitrace-user-library)
find_package(omnitrace REQUIRED COMPONENTS user)
endif()
add_executable(user-api user-api.cpp)
target_link_libraries(user-api PRIVATE Threads::Threads omnitrace::omnitrace-user-library)

if(NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set_target_properties(user-api PROPERTIES RUNTIME_OUTPUT_DIRECTORY
${CMAKE_BINARY_DIR})
if(NOT CMAKE_PROJECT_NAME STREQUAL "omnitrace")
install(TARGETS user-api DESTINATION bin)
endif()
Loading