diff --git a/CMakeLists.txt b/CMakeLists.txt index 52ea6be811ac10fa826df6fc85e006e65a9e5ff1..3412f9103b36238d50a9f61f7b4ddf0b6c213278 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,10 +49,35 @@ endif() if(WITH_MPI) find_package(MPI REQUIRED COMPONENTS CXX) - target_link_libraries(${PROJECT_NAME} PUBLIC MPI::MPI_CXX) + target_link_libraries(${PROJECT_NAME} PRIVATE MPI::MPI_CXX) target_compile_definitions(nesmik PRIVATE "WITH_MPI") endif() +if(ENABLE_EXTRAE) + find_package(Extrae REQUIRED) + if(Extrae_FOUND) + target_include_directories(nesmik + PRIVATE ${Extrae_INCLUDE_DIRS}) + # We link publicy with seqtrace, as we need it to be in the right order to libc to find malloc with dlsym .. + target_link_libraries(nesmik PUBLIC ${Extrae_LIBRARIES}) + target_compile_definitions(nesmik PRIVATE "ENABLE_EXTRAE") + else() + message(FATAL_ERROR "Couldnt find Extrae") + endif() +endif() + +if(ENABLE_DLB) + find_package(DLB REQUIRED) + if(DLB_FOUND) + target_include_directories(nesmik + PRIVATE ${DLB_INCLUDE_DIRS}) + target_link_libraries(nesmik PRIVATE ${DLB_LIBRARIES}) + target_compile_definitions(nesmik PRIVATE "ENABLE_DLB") + else() + message(FATAL_ERROR "Couldnt find DLB") + endif() +endif() + include(FetchContent) diff --git a/src/backends/detection/detection.cpp b/src/backends/detection/detection.cpp index 4217fbca8b418839a313195ef7f999fac8edb9bb..a317a0c7aab7b8ed1df5299480c6067205e8218b 100644 --- a/src/backends/detection/detection.cpp +++ b/src/backends/detection/detection.cpp @@ -151,16 +151,15 @@ void DetectionStrategy::Finalize() noexcept { } } + + #ifdef WITH_MPI - if(mpi_helper_.IsRankNumber(0)){ - PMPI_Reduce(MPI_IN_PLACE,&has_been_called_from_threads,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - PMPI_Reduce(MPI_IN_PLACE,&has_errors,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - } - else{ - int localUnused; - PMPI_Reduce(&has_been_called_from_threads,&localUnused,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - PMPI_Reduce(&has_errors,&localUnused,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); - } + int local_has_been_called_from_threads = has_been_called_from_threads; + int local_has_errors = has_errors; + if(mpi_helper_.IsUsingMPI()){ + PMPI_Reduce(&local_has_been_called_from_threads,&has_been_called_from_threads,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); + PMPI_Reduce(&local_has_errors,&has_errors,1, MPI_INT, MPI_SUM,0,MPI_COMM_WORLD); + } #endif diff --git a/src/backends/dlb/CMakeLists.txt b/src/backends/dlb/CMakeLists.txt index 3a432c46e8aa7f5fd8c72cbb1af8c0564424d8dd..dad14ce6d306798521d1a2661721ad73532035da 100644 --- a/src/backends/dlb/CMakeLists.txt +++ b/src/backends/dlb/CMakeLists.txt @@ -1,10 +1,2 @@ -find_package(DLB REQUIRED) -if(DLB_FOUND) -target_include_directories(nesmik - PRIVATE ${DLB_INCLUDE_DIRS}) -target_link_libraries(nesmik PUBLIC ${DLB_LIBRARIES}) -target_compile_definitions(nesmik PRIVATE "ENABLE_DLB") - add_subdirectory(dlb) add_subdirectory(dlb_talp_tree) -endif() diff --git a/src/backends/extrae/CMakeLists.txt b/src/backends/extrae/CMakeLists.txt index 787ac74058ea233c7f22459e293b9f0ed088e571..319ef9c27d5508c01cc65f0459e4f3ff4b222c0a 100644 --- a/src/backends/extrae/CMakeLists.txt +++ b/src/backends/extrae/CMakeLists.txt @@ -1,9 +1 @@ -find_package(Extrae REQUIRED) target_sources(nesmik PRIVATE extrae_type_stack.cpp) -if(Extrae_FOUND) -target_include_directories(nesmik - PRIVATE ${Extrae_INCLUDE_DIRS}) -target_link_libraries(nesmik PUBLIC ${Extrae_LIBRARIES}) -target_compile_definitions(nesmik PRIVATE "ENABLE_EXTRAE") -endif() -