1 # - Define macro to check if MPI_IN_PLACE exists
3 # GMX_TEST_MPI_IN_PLACE(VARIABLE)
5 # VARIABLE will be set to true if MPI_IN_PLACE exists
8 include(CheckCSourceCompiles)
9 MACRO(GMX_TEST_MPI_IN_PLACE VARIABLE)
10 if(NOT DEFINED MPI_IN_PLACE_COMPILE_OK)
11 MESSAGE(STATUS "Checking for MPI_IN_PLACE")
13 set(CMAKE_REQUIRED_DEFINITIONS ${MPI_COMPILE_FLAGS})
14 set(CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH})
15 set(CMAKE_REQUIRED_LIBRARIES ${MPI_LIBRARIES})
16 check_c_source_compiles(
20 MPI_Allreduce(MPI_IN_PLACE, buf, 10, MPI_FLOAT, MPI_SUM, MPI_COMM_WORLD);
21 }" MPI_IN_PLACE_COMPILE_OK)
23 if(MPI_IN_PLACE_COMPILE_OK)
24 MESSAGE(STATUS "Checking for MPI_IN_PLACE - yes")
25 else(MPI_IN_PLACE_COMPILE_OK)
26 MESSAGE(STATUS "Checking for MPI_IN_PLACE - no")
27 endif(MPI_IN_PLACE_COMPILE_OK)
28 set(MPI_IN_PLACE_COMPILE_OK "${MPI_IN_PLACE_COMPILE_OK}" CACHE INTERNAL "Result of mpi_in_place check")
29 set(CMAKE_REQUIRED_DEFINITIONS)
30 set(CMAKE_REQUIRED_INCLUDES)
31 set(CMAKE_REQUIRED_LIBRARIES)
33 if (MPI_IN_PLACE_COMPILE_OK)
34 set(${VARIABLE} ${MPI_IN_PLACE_COMPILE_OK}
35 "Result of test for MPI_IN_PLACE")
37 ENDMACRO(GMX_TEST_MPI_IN_PLACE VARIABLE)