Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error in configuration test for MPI_IN_PLACE. #540

Merged
merged 2 commits into from
Aug 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
Loading