Skip to content

Commit dca0738

Browse files
committed
Implement FAILED IMAGES support for gcc >= 7 and mpich >= 3.2.
Add testcases for failed images. Fixes #309. Fixes #354.
1 parent f1ed29e commit dca0738

15 files changed

+1010
-623
lines changed

CMakeLists.txt

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,24 @@ function(add_mpi_test name num_mpi_proc path)
384384
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
385385
endfunction(add_mpi_test)
386386

387+
function(add_mpi_failable_test name num_mpi_proc path)
388+
if ( ((N LESS num_mpi_proc) OR (N EQUAL 0)) )
389+
message(STATUS "Test ${name} is oversubscribed: ${num_mpi_proc} ranks requested with ${N} system processor available.")
390+
if ( openmpi )
391+
if ( N LESS 2 )
392+
set( num_mpi_proc 2 )
393+
set (test_parameters --oversubscribe)
394+
else()
395+
set ( num_mpi_proc ${N} )
396+
endif()
397+
message( STATUS "Open-MPI detected, over-riding oversubscribed test, ${name}, with ${num_mpi_proc} ranks." )
398+
endif()
399+
endif()
400+
set(test_parameters ${test_parameters} ${MPIEXEC_NUMPROC_FLAG} ${num_mpi_proc} -disable-auto-cleanup )
401+
add_test(NAME ${name} COMMAND ${MPIEXEC} ${test_parameters} "${path}")
402+
set_property(TEST ${name} PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")
403+
endfunction(add_mpi_failable_test)
404+
387405
set(tests_root ${CMAKE_CURRENT_BINARY_DIR}/src/tests)
388406

389407

@@ -447,7 +465,20 @@ if(opencoarrays_aware_compiler)
447465
add_mpi_test(co_reduce_string 4 ${tests_root}/unit/collectives/co_reduce_string)
448466

449467
# IMAGE FAIL tests
450-
add_mpi_test(image_status_test_1 4 ${tests_root}/unit/image_states/image_status_test_1)
468+
add_mpi_test(image_status_test_1 4 ${tests_root}/unit/fail_images/image_status_test_1)
469+
#ifdef WITH_FAIL_IMAGES
470+
# No other way to check that image_fail_test_1 passes.
471+
add_mpi_failable_test(image_fail_test_1 4 ${tests_root}/unit/fail_images/image_fail_test_1)
472+
set_property(TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed")
473+
set_property(TEST image_fail_test_1 PROPERTY PASS_REGULAR_EXPRESSION "Test passed")
474+
add_mpi_failable_test(image_fail_and_sync_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_1)
475+
add_mpi_failable_test(image_fail_and_sync_test_2 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_2)
476+
add_mpi_failable_test(image_fail_and_sync_test_3 4 ${tests_root}/unit/fail_images/image_fail_and_sync_test_3)
477+
add_mpi_failable_test(image_fail_and_status_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_status_test_1)
478+
add_mpi_failable_test(image_fail_and_failed_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_failed_images_test_1)
479+
add_mpi_failable_test(image_fail_and_stopped_images_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_stopped_images_test_1)
480+
add_mpi_failable_test(image_fail_and_get_test_1 4 ${tests_root}/unit/fail_images/image_fail_and_get_test_1)
481+
#endif
451482
else()
452483
add_test(co_sum_extension ${tests_root}/unit/extensions/test-co_sum-extension.sh)
453484
set_property(TEST co_sum_extension PROPERTY PASS_REGULAR_EXPRESSION "Test passed.")

src/libcaf.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,8 @@ void PREFIX (caf_send) (caf_token_t, size_t, int, gfc_descriptor_t *,
240240

241241
void PREFIX (caf_sendget) (caf_token_t, size_t, int, gfc_descriptor_t *,
242242
caf_vector_t *, caf_token_t, size_t, int,
243-
gfc_descriptor_t *, caf_vector_t *, int, int, bool);
243+
gfc_descriptor_t *, caf_vector_t *, int, int, bool,
244+
int *);
244245

245246
#ifdef GCC_GE_7
246247
void PREFIX(get_by_ref) (caf_token_t, int,
@@ -269,9 +270,16 @@ void PREFIX (sync_all) (int *, char *, int);
269270
void PREFIX (sync_images) (int, int[], int *, char *, int);
270271
void PREFIX (sync_memory) (int *, char *, int);
271272

273+
void PREFIX (stop_str) (const char *, int32_t) __attribute__ ((noreturn));
274+
void PREFIX (stop) (int32_t) __attribute__ ((noreturn));
272275
void PREFIX (error_stop_str) (const char *, int32_t)
273276
__attribute__ ((noreturn));
274277
void PREFIX (error_stop) (int32_t) __attribute__ ((noreturn));
278+
void PREFIX (fail_image) (void) __attribute__ ((noreturn));
279+
280+
int PREFIX (image_status) (int);
281+
void PREFIX (failed_images) (gfc_descriptor_t *, int, int *);
282+
void PREFIX (stopped_images) (gfc_descriptor_t *, int, int *);
275283

276284
void PREFIX (atomic_define) (caf_token_t, size_t, int, void *, int *, int, int);
277285
void PREFIX (atomic_ref) (caf_token_t, size_t, int, void *, int *, int, int);

0 commit comments

Comments
 (0)