Skip to content

Commit

Permalink
Fix CMake opemMPI check for MPI_COMM_SHARED_TYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
maelk3 committed Jul 16, 2024
1 parent 7062e83 commit 9d85f30
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions cmake/check_mpicommshared.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include(CheckCSourceCompiles)
function(check_mpicommshared)

set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C)

check_c_source_compiles(
"
#include <mpi.h>
int main(void) {
int temp = MPI_COMM_TYPE_SHARED;
return 0;
}
"
SC_ENABLE_MPICOMMSHARED)

endfunction()

check_mpicommshared()
3 changes: 2 additions & 1 deletion cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9d85f30

Please sign in to comment.