Skip to content

Commit 0eb8345

Browse files
committed
Update build system for failed images
- Ensure that tests requiring GCC 7 are only built when it is available - Add a default option (set to ON) to enable failed images support when the required experimental/proposed fault tolerant MPI features are detected.
1 parent d45aa2c commit 0eb8345

File tree

4 files changed

+76
-18
lines changed

4 files changed

+76
-18
lines changed

CMakeLists.txt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ function(add_mpi_test name num_mpi_proc path)
465465
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
466466
endfunction(add_mpi_test)
467467

468-
function(add_mpi_failable_test name num_mpi_proc path)
468+
function(add_fault_tolerant_mpi_test name num_mpi_proc path)
469469
if ( ((N LESS num_mpi_proc) OR (N EQUAL 0)) )
470470
message(STATUS "Test ${name} is oversubscribed: ${num_mpi_proc} ranks requested with ${N} system processor available.")
471471
if ( openmpi )
@@ -481,7 +481,7 @@ function(add_mpi_failable_test name num_mpi_proc path)
481481
set(test_parameters ${test_parameters} ${MPIEXEC_NUMPROC_FLAG} ${num_mpi_proc} -disable-auto-cleanup )
482482
add_test(NAME ${name} COMMAND ${MPIEXEC} ${test_parameters} "${path}")
483483
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
484-
endfunction(add_mpi_failable_test)
484+
endfunction(add_fault_tolerant_mpi_test)
485485

486486
set(tests_root ${CMAKE_CURRENT_BINARY_DIR}/src/tests)
487487

@@ -551,20 +551,22 @@ if(opencoarrays_aware_compiler)
551551
add_mpi_test(co_reduce_string 4 ${tests_root}/unit/collectives/co_reduce_string)
552552

553553
# IMAGE FAIL tests
554-
add_mpi_test(image_status_test_1 4 ${tests_root}/unit/fail_images/image_status_test_1)
555-
#ifdef WITH_FAIL_IMAGES
556-
# No other way to check that image_fail_test_1 passes.
557-
add_mpi_failable_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
558-
set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed")
559-
set_property(TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed")
560-
add_mpi_failable_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
561-
add_mpi_failable_test(image_fail_and_sync_test_2 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_2)
562-
add_mpi_failable_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
563-
add_mpi_failable_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
564-
add_mpi_failable_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
565-
add_mpi_failable_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
566-
add_mpi_failable_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
567-
#endif
554+
if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7)
555+
add_mpi_test(image_status_test_1 4 ${tests_root}/unit/fail_images/image_status_test_1)
556+
if(CAF_ENABLE_FAILED_IMAGES)
557+
# No other way to check that image_fail_test_1 passes.
558+
add_fault_tolerant_mpi_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
559+
set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed")
560+
set_property(TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed")
561+
add_fault_tolerant_mpi_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
562+
add_fault_tolerant_mpi_test(image_fail_and_sync_test_2 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_2)
563+
add_fault_tolerant_mpi_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
564+
add_fault_tolerant_mpi_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
565+
add_fault_tolerant_mpi_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
566+
add_fault_tolerant_mpi_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
567+
add_fault_tolerant_mpi_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
568+
endif()
569+
endif()
568570
else()
569571
add_test(co_sum_extension ${tests_root}/unit/extensions/test-co_sum-extension.sh)
570572
set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")

src/mpi/CMakeLists.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,60 @@ if(CAF_EXPOSE_INIT_FINALIZE)
2828
add_definitions(-DEXPOSE_INIT_FINALIZE)
2929
endif()
3030

31+
#----------------------------------------------------------------------
32+
# Test if MPI implementation provides features needed for failed images
33+
#----------------------------------------------------------------------
34+
set(NEEDED_SYMBOLS MPIX_ERR_PROC_FAILED;MPIX_ERR_REVOKED;MPIX_Comm_failure_ack;MPIX_Comm_failure_get_acked;MPIX_Comm_shrink;MPIX_Comm_agree)
35+
set(MPI_HAS_FAULT_TOL_EXT YES)
36+
set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}")
37+
if(CMAKE_REQUIRED_INCLUDES)
38+
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH})
39+
else()
40+
set(CMAKE_REQUIRED_INCLUDES ${MPI_C_INCLUDE_PATH})
41+
endif()
42+
set(old_cmake_required_flags "${CMAKE_REQUIRED_FLAGS}")
43+
if(CMAKE_REQUIRED_FLAGS)
44+
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS};${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS})
45+
else()
46+
set(CMAKE_REQUIRED_FLAGS ${MPI_C_COMPILE_FLAGS};${MPI_C_LINK_FLAGS})
47+
endif()
48+
set(old_cmake_required_libraries "${CMAKE_REQUIRED_LIBRARIES}")
49+
if(CMAKE_REQUIRED_LIBRARIES)
50+
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};${MPI_C_LIBRARIES})
51+
else()
52+
set(CMAKE_REQUIRED_LIBRARIES ${MPI_C_LIBRARIES})
53+
endif()
54+
55+
set(MPI_HEADERS mpi.h)
56+
CHECK_INCLUDE_FILE("mpi-ext.h" HAVE_MPI_EXT)
57+
if(HAVE_MPI_EXT)
58+
add_definitions(-DHAVE_MPI_EXT_H)
59+
set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h)
60+
endif()
61+
include(CheckSymbolExists)
62+
foreach(symbol ${NEEDED_SYMBOLS})
63+
CHECK_SYMBOL_EXISTS(${symbol} ${MPI_HEADERS} HAVE_${symbol})
64+
if(NOT HAVE_${symbol})
65+
message( STATUS "\${HAVE_${symbol}} = ${HAVE_${symbol}}")
66+
message( WARNING "Disabling Failed Image support due to lack of support in the current MPI implementation.")
67+
set(MPI_HAS_FAULT_TOL_EXT NO)
68+
break() # no need to keep looking
69+
endif()
70+
endforeach(symbol)
71+
set(CMAKE_REQUIRED_INCLUDES ${old_cmake_required_includes})
72+
set(CMAKE_REQUIRED_FLAGS ${old_cmake_required_flags})
73+
set(CMAKE_REQUIRED_LIBRARIES ${old_cmake_required_libraries})
74+
75+
if(MPI_HAS_FAULT_TOL_EXT)
76+
option(CAF_ENABLE_FAILED_IMAGES "Enable failed images support" TRUE)
77+
else()
78+
set(CAF_ENABLE_FAILED_IMAGES FALSE CACHE BOOL "Enable failed images support" FORCE)
79+
endif()
80+
81+
if(CAF_ENABLE_FAILED_IMAGES)
82+
add_definitions(-DUSE_FAILED_IMAGES)
83+
endif()
84+
3185
# Determine whether and how to include OpenCoarrays module based on if the Fortran MPI compiler:
3286
# - workds
3387
# - is compatible with the fortran compiler used to build the MPI implementation

src/mpi/mpi_caf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
4343
#include <pthread.h>
4444
#include <signal.h> /* For raise */
4545

46-
#ifdef MPI_NEEDS_MPI_EXT
46+
#ifdef HAVE_MPI_EXT_H
4747
#include <mpi-ext.h>
4848
#endif
4949
#ifdef USE_FAILED_IMAGES

src/tests/unit/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ if (${opencoarrays_aware_compiler})
44
add_subdirectory(init_register)
55
add_subdirectory(collectives)
66
add_subdirectory(sync)
7-
add_subdirectory(fail_images)
7+
if(NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7)
8+
add_subdirectory(fail_images)
9+
endif()
810
else()
911
add_subdirectory(extensions)
1012
endif()

0 commit comments

Comments
 (0)