Skip to content

Commit

Permalink
Merge pull request #540 from mmuetzel/msmpi
Browse files Browse the repository at this point in the history
Fix error in configuration test for MPI_IN_PLACE.
  • Loading branch information
raback authored Aug 28, 2024
2 parents 2042b36 + c8e0aec commit 7b74eda
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions cmake/Modules/testMPIcapabilities.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@

if(CMAKE_CROSSCOMPILING)
# assume it is working
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${CMAKE_Fortran_COMPILER} -- assuming yes")
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${MPI_Fortran_COMPILER} -- assuming yes")
set(CHECK_MPI_IN_PLACE_RUN_ERROR OFF)
set(CHECK_MPI_IN_PLACE_COMPILE ON)
else()

set(save_CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER})
set(CMAKE_Fortran_COMPILER ${MPI_Fortran_COMPILER})
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${CMAKE_Fortran_COMPILER}")
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${MPI_Fortran_COMPILER}")

file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testMPI_IN_PLACE.f90
"
Expand All @@ -27,7 +26,7 @@ else()
PRINT *, \"test1 =\", test1
CALL MPI_Init(ierr)
CALL MPI_Allreduce(MPI_IN_PLACE, test1, 3, MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_WORLD)
CALL MPI_Allreduce(MPI_IN_PLACE, test1, 3, MPI_DOUBLE_PRECISION, MPI_SUM, MPI_COMM_WORLD, ierr)
CALL MPI_Finalize(ierr)
PRINT *, \"test1 =\", test1
Expand All @@ -38,17 +37,14 @@ else()
END PROGRAM TEST_MPI_IN_PLACE
")
try_run(CHECK_MPI_IN_PLACE_RUN_ERROR CHECK_MPI_IN_PLACE_COMPILE ${CMAKE_BINARY_DIR}
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testMPI_IN_PLACE.f90)
SOURCES ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testMPI_IN_PLACE.f90
LINK_LIBRARIES MPI::MPI_Fortran)
endif()

if(CHECK_MPI_IN_PLACE_RUN_ERROR)
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${CMAKE_Fortran_COMPILER} -- no")
if(CHECK_MPI_IN_PLACE_RUN_ERROR OR NOT CHECK_MPI_IN_PLACE_COMPILE)
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${MPI_Fortran_COMPILER} -- no")
set(ELMER_BROKEN_MPI_IN_PLACE ON CACHE INTERNAL "")
else()
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${CMAKE_Fortran_COMPILER} -- yes")
message(STATUS "Checking whether MPI_IN_PLACE is supported with ${MPI_Fortran_COMPILER} -- yes")
set(ELMER_BROKEN_MPI_IN_PLACE OFF CACHE INTERNAL "")
endif()

if(NOT CMAKE_CROSSCOMPILING)
set(CMAKE_Fortran_COMPILER ${save_CMAKE_Fortran_COMPILER})
endif()

0 comments on commit 7b74eda

Please sign in to comment.