@@ -584,15 +584,16 @@ add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
584
584
#---------------------------------------------------------------------------------------
585
585
586
586
# Determine if we're using Open MPI
587
+ cmake_host_system_information (RESULT N_CPU QUERY NUMBER_OF_LOGICAL_CORES )
588
+ cmake_host_system_information (RESULT HOST_NAME QUERY HOSTNAME )
587
589
execute_process (COMMAND ${MPIEXEC} --version
588
590
OUTPUT_VARIABLE mpi_version_out )
589
591
if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]" )
590
592
message ( STATUS "OpenMPI detected" )
591
593
set ( openmpi true )
594
+ # Write out a host file because OMPI's mpiexec is dumb
595
+ file (APPEND ${CMAKE_BINARY_DIR} /hostfile "${HOST_NAME} slots=${N_CPU} \n " )
592
596
endif ()
593
-
594
- include ( ProcessorCount )
595
- ProcessorCount (N_CPU )
596
597
function (add_caf_test name num_caf_img test_target )
597
598
# Function to add MPI tests.
598
599
if (TARGET ${test_target} )
@@ -605,6 +606,10 @@ function(add_caf_test name num_caf_img test_target)
605
606
message ( FATAL_ERROR "Test ${name} requires ${min_test_imgs} but was only given ${num_caf_images} " )
606
607
endif ()
607
608
endif ()
609
+ # Add a host file for OMPI
610
+ if ( openmpi )
611
+ set (test_parameters --hostfile ${CMAKE_BINARY_DIR} /hostfile )
612
+ endif ()
608
613
if ( ((N_CPU LESS num_caf_img ) OR (N_CPU EQUAL 0 )) )
609
614
message (STATUS "Test ${name} is oversubscribed: ${num_caf_img} CAF images requested with ${N_CPU} system processor available." )
610
615
if ( openmpi )
@@ -613,7 +618,7 @@ function(add_caf_test name num_caf_img test_target)
613
618
elseif ( N_CPU LESS 2 )
614
619
set ( num_caf_img 2 )
615
620
endif ()
616
- set (test_parameters --oversubscribe )
621
+ set (test_parameters ${test_parameters} --oversubscribe )
617
622
message ( STATUS "Open-MPI back end detected, passing --oversubscribe for oversubscribed test, ${name} , with ${num_caf_img} ranks/images." )
618
623
endif ()
619
624
endif ()
@@ -755,8 +760,8 @@ if(opencoarrays_aware_compiler)
755
760
756
761
# IMAGE FAIL tests
757
762
if (NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 7.0.0 )
758
- add_caf_test (image_status_test_1 4 image_status_test_1 )
759
763
if (CAF_ENABLE_FAILED_IMAGES )
764
+ add_caf_test (image_status_test_1 4 image_status_test_1 )
760
765
if ((NOT DEFINED ENV{TRAVIS} ) OR (CAF_RUN_DEVELOPER_TESTS OR $ENV{OPENCOARRAYS_DEVELOPER} ))
761
766
add_caf_test (image_fail_test_1 4 image_fail_test_1 )
762
767
set_property (TEST image_fail_test_1 PROPERTY FAIL_REGULAR_EXPRESSION "Test failed." )
0 commit comments