Description
Native Win64 CAF solution using OpenCoarrays-2.0.0/MSYS2/gfortran/Intel-MPI.
- OpenCoarrays Version: 2.0.0
- Fortran Compiler: GNU Fortran (Rev2, Built by MSYS2 project) 7.3.0
- C compiler used for building lib: gcc.exe (Rev2, Built by MSYS2 project) 7.3.0
- Installation method: install.sh (with one change to FindMPI.cmake and -G"MSYS Makefiles" in build_opencoarrays.sh)
- Output of
uname -a
: MINGW64_NT-6.1 PE-MGR-LAPTOP 2.10.0(0.325/5/3) 2018-02-09 15:25 x86_64 Msys - MPI library being used: Intel(R) MPI Library for Windows* OS, Version 2018 Update 2 Build 20180125
- Machine architecture and number of physical cores: Intel Haswell i7, 4 cores
- Version of CMake: 3.11.1
Observed Behavior
Cmake running on Win64 under the MSYS2 bash prompt is a native Win64 application, and as such uses the default windows cmake generator (looking for the MS compiler), unless the -G"MSYS Makefiles" cmake command line option is used; which causes cmake to use gcc, gfortran, and ar correctly.
Expected Behavior
Introspection with CMAKE variable MSYS, or output from uname (output of "uname -o" is "Msys") would allow application of the -G"MSYS Makefiles" cmake command line option to select the correct cmake generator when executing cmake from build_opencoarrays.sh
Steps to Reproduce
Allows success with install.sh.
- Build an import library, libmpi.a, interfacing to the Intel-MPI impi.dll. This is done using the gendef (tools-git package), and dlltool (binutils package) utilities.
- Set up mpifort, mpicc bash scripts modified from MPICH 3.2 and a simple mpirun script, so that gcc, gfortran, and the Intel-MPI mpiexec.exe work from the msys2 bash prompt the same way as on linux to build and execute MPI programs.
- Edit FindMPI.cmake to allow execution of the bash scripts under the bash shell.
$ diff -Nu FindMPI.cmake.orig FindMPI.cmake
--- FindMPI.cmake.orig 2018-05-17 16:29:45.352467900 -0500
+++ FindMPI.cmake 2018-05-20 14:58:14.090710500 -0500
@@ -337,7 +337,7 @@
separate_arguments(_MPI_COMPILER_WRAPPER_OPTIONS NATIVE_COMMAND "${MPI_COMPILER_FLAGS}")
endif()
execute_process(
- COMMAND ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG}
+ COMMAND "bash" ${MPI_${LANG}_COMPILER} ${_MPI_COMPILER_WRAPPER_OPTIONS} ${QUERY_FLAG}
OUTPUT_VARIABLE WRAPPER_OUTPUT OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE WRAPPER_OUTPUT ERROR_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE WRAPPER_RETURN)
A workaround not requiring any edit to FindMPI.cmake might be to prepend "bash " to the MPI_${LANG}_COMPILER variable if the cmake variable MSYS is used for introspection?
- Edit OpenCoarrays-2.0.0/prerequisites/install-functions/build_opencoarrays.sh to include the -G"MSYS Makefiles" cmake command line option (done manually rather than via introspection here).
$ diff -Nu build_opencoarrays.sh.orig build_opencoarrays.sh
--- build_opencoarrays.sh.orig 2018-05-21 12:38:25.164838800 -0500
+++ build_opencoarrays.sh 2018-05-21 12:38:46.151258600 -0500
@@ -38,7 +38,7 @@
fi
info "Configuring OpenCoarrays in ${PWD} with the command:"
info "CC=\"${CC}\" FC=\"${FC}\" $CMAKE \"${opencoarrays_src_dir}\" \"${WDEVFLAG}\" -DCMAKE_INSTALL_PREFIX=\"${install_path}\" -DMPIEXEC=\"${MPIEXEC}\" -DMPI_C_COMPILER=\"${MPICC}\" -DMPI_Fortran_COMPILER=\"${MPIFC}\""
- CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" "${WDEVFLAG}" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPIEXEC="${MPIEXEC}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
+ CC="${CC}" FC="${FC}" $CMAKE "${opencoarrays_src_dir}" "${WDEVFLAG}" -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX="${install_path}" -DMPIEXEC="${MPIEXEC}" -DMPI_C_COMPILER="${MPICC}" -DMPI_Fortran_COMPILER="${MPIFC}"
info "Building OpenCoarrays in ${PWD} with the command make -j${num_threads}"
make "-j${num_threads}"
if [[ ! -z ${SUDO:-} ]]; then
- install.sh and ctest demonstrate building and execution of CAF programs, with all tests passed except for those with failed images. Note that -DUSE_FAILED_IMAGES was turned on when building the libcaf_mpi.a and libcaf_mpi.dll libraries (verified from output of make clean; make VERBOSE=1).
Excerpt from install.sh.
-- Looking for signal.h
-- Looking for signal.h - found
-- Looking for SIGKILL
-- Looking for SIGKILL - not found
-- Looking for SIGKILL
-- Looking for SIGKILL - found
-- Looking for include files mpi.h, mpi-ext.h
-- Looking for include files mpi.h, mpi-ext.h - not found
-- Looking for MPIX_ERR_PROC_FAILED
-- Looking for MPIX_ERR_PROC_FAILED - found
-- Looking for MPIX_ERR_REVOKED
-- Looking for MPIX_ERR_REVOKED - found
-- Looking for MPIX_Comm_failure_ack
-- Looking for MPIX_Comm_failure_ack - found
-- Looking for MPIX_Comm_failure_get_acked
-- Looking for MPIX_Comm_failure_get_acked - found
-- Looking for MPIX_Comm_shrink
-- Looking for MPIX_Comm_shrink - found
-- Looking for MPIX_Comm_agree
-- Looking for MPIX_Comm_agree - found
-- Looking for include file mpi.h
-- Looking for include file mpi.h - found
-- Looking for I_MPI_VERSION
-- Looking for I_MPI_VERSION - found
Excerpt from ctest output, where all tests passed, except:
Start 64: image_fail_test_1
64/72 Test #64: image_fail_test_1 ......................***Failed Required regular expression not found.Regex=[Test passed.
] 0.23 sec
Start 65: image_fail_and_sync_test_1
65/72 Test #65: image_fail_and_sync_test_1 .............***Failed Required regular expression not found.Regex=[Test passed.
] 0.23 sec
Start 66: image_fail_and_sync_test_2
66/72 Test #66: image_fail_and_sync_test_2 .............***Failed Required regular expression not found.Regex=[Test passed.
] 0.24 sec
Start 67: image_fail_and_sync_test_3
67/72 Test #67: image_fail_and_sync_test_3 .............***Failed Required regular expression not found.Regex=[Test passed.
] 0.22 sec
Start 68: image_fail_and_status_test_1
68/72 Test #68: image_fail_and_status_test_1 ...........***Failed Required regular expression not found.Regex=[Test passed.
] 0.23 sec
Start 69: image_fail_and_failed_images_test_1
69/72 Test #69: image_fail_and_failed_images_test_1 ....***Failed Required regular expression not found.Regex=[Test passed.
] 0.22 sec
Start 70: image_fail_and_stopped_images_test_1
70/72 Test #70: image_fail_and_stopped_images_test_1 ...***Failed Required regular expression not found.Regex=[Test passed.
] 0.23 sec
Start 71: image_fail_and_get_test_1
71/72 Test #71: image_fail_and_get_test_1 ..............***Failed Required regular expression not found.Regex=[Test passed.
] 0.23 sec
$ caf image_fail_test_1.f90
$ cafrun -n 4 ./a.exe
mpiexec.exe -n 4 --disable-auto-cleanup ./a.exe
IMAGE FAILED!
Do the "found" messages (from searching mpi.h) that turn on -DUSE_FAILED_IMAGES not mean that failed images are supported in the MPI implementation? I seem to recall that MPICH 3.2 had the functions defined in mpi.h, but also did not work with failed images.