From 9d85f304df74de5e397419ae59de72ed4de2ffc1 Mon Sep 17 00:00:00 2001 From: maelk3 Date: Tue, 16 Jul 2024 12:13:29 +0200 Subject: [PATCH 1/4] Fix CMake opemMPI check for MPI_COMM_SHARED_TYPE --- cmake/check_mpicommshared.cmake | 18 ++++++++++++++++++ cmake/config.cmake | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 cmake/check_mpicommshared.cmake diff --git a/cmake/check_mpicommshared.cmake b/cmake/check_mpicommshared.cmake new file mode 100644 index 00000000..e5870526 --- /dev/null +++ b/cmake/check_mpicommshared.cmake @@ -0,0 +1,18 @@ +include(CheckCSourceCompiles) +function(check_mpicommshared) + + set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C) + + check_c_source_compiles( + " + #include + int main(void) { + int temp = MPI_COMM_TYPE_SHARED; + return 0; + } + " + SC_ENABLE_MPICOMMSHARED) + +endfunction() + +check_mpicommshared() diff --git a/cmake/config.cmake b/cmake/config.cmake index 6c36a433..0578fed1 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -106,7 +106,8 @@ if(NOT SC_ENABLE_MPI EQUAL CACHE{SC_ENABLE_MPI}) endif() if( SC_ENABLE_MPI ) - check_symbol_exists(MPI_COMM_TYPE_SHARED mpi.h SC_ENABLE_MPICOMMSHARED) + # perform check to set SC_ENABLE_MPICOMMSHARED + include(cmake/check_mpicommshared.cmake) # perform check to set SC_ENABLE_MPIIO include(cmake/check_mpiio.cmake) check_symbol_exists(MPI_Init_thread mpi.h SC_ENABLE_MPITHREAD) From 9361e608f3ec1c8733fcb1d5cd4298e210fa5540 Mon Sep 17 00:00:00 2001 From: maelk3 Date: Thu, 18 Jul 2024 15:41:58 +0200 Subject: [PATCH 2/4] Added BSD license statement --- doc/author_karembe.txt | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 doc/author_karembe.txt diff --git a/doc/author_karembe.txt b/doc/author_karembe.txt new file mode 100644 index 00000000..4a28ba0f --- /dev/null +++ b/doc/author_karembe.txt @@ -0,0 +1,2 @@ +I place my contributions to libsc under the FreeBSD license. +Mael Karembe (mael.karembe@dlr.de) From 8c2987fc25607ef1176444458582748bb1000055 Mon Sep 17 00:00:00 2001 From: maelk3 Date: Thu, 18 Jul 2024 15:51:07 +0200 Subject: [PATCH 3/4] Update release_notes.txt --- doc/release_notes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/release_notes.txt b/doc/release_notes.txt index b565f0f9..e3ab179e 100644 --- a/doc/release_notes.txt +++ b/doc/release_notes.txt @@ -51,6 +51,7 @@ There have been breaking changes, very strictly speaking. - Add CMake option to run tests with Valgrind. - Warn if configuring MPI on and MPI I/O off. - Renaming of CMake build system variables + - Make MPI checking functionality more robust in CMake. ### Functionality From 309ae0dbd8c527c3bb689f4980b5bee14ebc44d5 Mon Sep 17 00:00:00 2001 From: maelk3 Date: Thu, 18 Jul 2024 15:58:52 +0200 Subject: [PATCH 4/4] Switched CMake checks for SC_ENABLE_MPI{THREAD,WINSHARED} to check_c_source_compiles --- cmake/check_mpithread.cmake | 19 +++++++++++++++++++ cmake/check_mpiwinshared.cmake | 20 ++++++++++++++++++++ cmake/config.cmake | 6 ++++-- 3 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 cmake/check_mpithread.cmake create mode 100644 cmake/check_mpiwinshared.cmake diff --git a/cmake/check_mpithread.cmake b/cmake/check_mpithread.cmake new file mode 100644 index 00000000..f88d1a7e --- /dev/null +++ b/cmake/check_mpithread.cmake @@ -0,0 +1,19 @@ +include(CheckCSourceCompiles) +function(check_mpithread) + + set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C) + + check_c_source_compiles( + " + #include + int main(int argc, char** argv) { + int thread_support_provided; + MPI_Init_thread(&argc, &argv, MPI_THREAD_MULTIPLE, &thread_support_provided); + return 0; + } + " + SC_ENABLE_MPITHREAD) + +endfunction() + +check_mpithread() diff --git a/cmake/check_mpiwinshared.cmake b/cmake/check_mpiwinshared.cmake new file mode 100644 index 00000000..925c9851 --- /dev/null +++ b/cmake/check_mpiwinshared.cmake @@ -0,0 +1,20 @@ +include(CheckCSourceCompiles) +function(check_mpiwinshared) + + set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C) + + check_c_source_compiles( + " + #include + int main(void) { + int* window_buffer; + MPI_Win window; + MPI_Win_allocate_shared(sizeof(int), sizeof(int), MPI_INFO_NULL, MPI_COMM_WORLD, &window_buffer, &window); + return 0; + } + " + SC_ENABLE_MPIWINSHARED) + +endfunction() + +check_mpiwinshared() diff --git a/cmake/config.cmake b/cmake/config.cmake index 0578fed1..02b9d85a 100644 --- a/cmake/config.cmake +++ b/cmake/config.cmake @@ -110,8 +110,10 @@ if( SC_ENABLE_MPI ) include(cmake/check_mpicommshared.cmake) # perform check to set SC_ENABLE_MPIIO include(cmake/check_mpiio.cmake) - check_symbol_exists(MPI_Init_thread mpi.h SC_ENABLE_MPITHREAD) - check_symbol_exists(MPI_Win_allocate_shared mpi.h SC_ENABLE_MPIWINSHARED) + # perform check to set SC_ENABLE_MPITHREAD + include(cmake/check_mpithread.cmake) + # perform check to set SC_ENABLE_MPIWINSHARED + include(cmake/check_mpiwinshared.cmake) endif()