From 75b943e06c429c2811f2c5e4c75757a4d8bc5b11 Mon Sep 17 00:00:00 2001 From: Marco Clemencic <marco.clemencic@cern.ch> Date: Fri, 12 Jun 2020 14:22:42 +0200 Subject: [PATCH 1/3] Do not set CMAKE_BUILD_TYPE when building on top of Gaudi --- CMakeLists.txt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5e844a229ef..0cae25e5db7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,10 +36,12 @@ set(CMAKE_EXE_LINKER_FLAGS "-lpthread") set(TARGET_DEVICE CPU CACHE STRING "Target architecture of the device") set_property(CACHE TARGET_DEVICE PROPERTY STRINGS CPU CUDA HIP CUDACLANG) -# Build type -set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type") -set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS RelWithDebInfo Release Debug) -message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE}) +# Build type (builds based on Gaudi are setting CMAKE_BUILD_TYPE in gaudi_project) +if(STANDALONE) + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Build type") + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS RelWithDebInfo Release Debug) + message(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE}) +endif() # CUDA compute capability set(CUDA_ARCH COMPATIBILITY CACHE STRING "CUDA target architecture") -- GitLab From 4c2f78c4753f02b9d871e0a5e22ae21349204c38 Mon Sep 17 00:00:00 2001 From: Daniel Campora <dcampora@cern.ch> Date: Wed, 17 Jun 2020 17:50:28 +0200 Subject: [PATCH 2/3] Converted FLAGS options into CACHE STRING options. Properly added Threads library. Removed spurious prints, and leftover warning in PVCheckerHistos. --- CMakeLists.txt | 12 +++++++----- checker/pv/src/PVCheckerHistos.cpp | 2 ++ main/src/Allen.cpp | 4 ---- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cae25e5db7..60e5e44404c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,10 +23,9 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) # for find_package set(CMAKE_POSITION_INDEPENDENT_CODE ON) # Allows making a shared object set(CMAKE_CXX_EXTENSIONS OFF) # Generate -std=c++17 instead of -std=gnu++17 set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG") -set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG") -set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DALLEN_DEBUG") -set(CMAKE_EXE_LINKER_FLAGS "-lpthread") +set(CMAKE_CXX_FLAGS_RELWITHDEBINFO CACHE STRING "-O3 -g -DNDEBUG") +set(CMAKE_CXX_FLAGS_RELEASE CACHE STRING "-O3 -DNDEBUG") +set(CMAKE_CXX_FLAGS_DEBUG CACHE STRING "-O0 -g -DALLEN_DEBUG") # ----------------------- # Multiple-choice options @@ -639,6 +638,8 @@ else() allen_add_device_library(AllenLib SHARED ${allen_lib_sources}) endif() +find_package(Threads REQUIRED) + target_link_libraries(AllenLib PUBLIC Stream Common @@ -649,7 +650,8 @@ target_link_libraries(AllenLib PUBLIC SelChecking AllenMonitoring NonEventData - AllenZMQ) + AllenZMQ + Threads::Threads) if (USE_MPI AND MPI_FOUND) get_filename_component(MPI_LIBRARY_DIR ${MPI_mpi_LIBRARY} DIRECTORY) diff --git a/checker/pv/src/PVCheckerHistos.cpp b/checker/pv/src/PVCheckerHistos.cpp index f0dbddbd5d8..e52f23682c0 100644 --- a/checker/pv/src/PVCheckerHistos.cpp +++ b/checker/pv/src/PVCheckerHistos.cpp @@ -1,8 +1,10 @@ #include "PVCheckerHistos.h" +#ifdef WITH_ROOT namespace { float binomial_error(float k, float N) { return sqrtf(k * (1 - k / N)) / N; } } // namespace +#endif PVCheckerHistos::PVCheckerHistos(CheckerInvoker const* invoker, std::string const& root_file) { diff --git a/main/src/Allen.cpp b/main/src/Allen.cpp index f8d8a76822a..452d9b4f7d6 100644 --- a/main/src/Allen.cpp +++ b/main/src/Allen.cpp @@ -427,8 +427,6 @@ extern "C" int allen( // Register all consumers register_consumers(updater, constants); - printf("2"); - // Run all registered produces and consumers updater->update(0); @@ -447,8 +445,6 @@ extern "C" int allen( stream_wrapper.initialize_streams_host_buffers_manager(buffer_manager.get()); - printf("3"); - if (print_status) { buffer_manager->printStatus(); } -- GitLab From 0bd6fd1684e68073887ff555e988166fe359b0bc Mon Sep 17 00:00:00 2001 From: Daniel Campora <dcampora@cern.ch> Date: Wed, 17 Jun 2020 18:11:08 +0200 Subject: [PATCH 3/3] Add Threads include to MDF tests. --- mdf/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mdf/CMakeLists.txt b/mdf/CMakeLists.txt index 070e9188c29..196c11f2e40 100644 --- a/mdf/CMakeLists.txt +++ b/mdf/CMakeLists.txt @@ -75,11 +75,13 @@ function(test_program) cmake_parse_arguments(PARSED_ARGS "" "NAME" "" ${ARGN}) add_executable(${PARSED_ARGS_NAME} test/${PARSED_ARGS_NAME}.cpp) + find_package(Threads REQUIRED) + target_include_directories(${PARSED_ARGS_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/mdf/include ${CMAKE_SOURCE_DIR}/main/include) - target_link_libraries(${PARSED_ARGS_NAME} PRIVATE MdfTestCommon) + target_link_libraries(${PARSED_ARGS_NAME} PRIVATE MdfTestCommon Threads::Threads) if (USE_MPI AND MPI_FOUND) target_compile_definitions(${PARSED_ARGS_NAME} PRIVATE HAVE_MPI) -- GitLab