diff --git a/CMakeLists.txt b/CMakeLists.txt index f4e604a5c9..eea6e5c5e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,6 +330,11 @@ add_subdirectory("src/forcing") add_subdirectory("src/utilities/mdarray") add_subdirectory("src/utilities/mdframe") add_subdirectory("src/utilities/logging") +add_subdirectory("src/utilities/mpi") + +if(NGEN_WITH_MPI) + target_link_libraries(ngen PUBLIC NGen::MPI_Detour) +endif() target_link_libraries(ngen PUBLIC diff --git a/src/NGen.cpp b/src/NGen.cpp index 74817737db..d4f721da41 100644 --- a/src/NGen.cpp +++ b/src/NGen.cpp @@ -150,7 +150,7 @@ int main(int argc, char *argv[]) { } // if (mpi_rank == 0) #if NGEN_WITH_MPI - MPI_Finalize(); + PMPI_Finalize(); #endif exit(1); @@ -587,7 +587,7 @@ int main(int argc, char *argv[]) { } #ifdef NGEN_MPI_ACTIVE - MPI_Finalize(); + PMPI_Finalize(); #endif return 0; diff --git a/src/utilities/mpi/CMakeLists.txt b/src/utilities/mpi/CMakeLists.txt new file mode 100644 index 0000000000..6a60ce387b --- /dev/null +++ b/src/utilities/mpi/CMakeLists.txt @@ -0,0 +1,2 @@ +add_library(MPIDetour SHARED "${CMAKE_CURRENT_LIST_DIR}/MPIDetour.c") +add_library(NGen::MPI_Detour ALIAS MPIDetour) diff --git a/src/utilities/mpi/MPIDetour.c b/src/utilities/mpi/MPIDetour.c new file mode 100644 index 0000000000..57586826c4 --- /dev/null +++ b/src/utilities/mpi/MPIDetour.c @@ -0,0 +1,3 @@ +int MPI_Finalize() { + return 0; +}