Skip to content

Commit 84c575a

Browse files
authored
Merge pull request #436 from sourceryinstitute/issue-435-MS-MPI
Fix bug & improve Windows support -Fixes #435
2 parents f7a5f2e + 111d775 commit 84c575a

File tree

2 files changed

+37
-3
lines changed

2 files changed

+37
-3
lines changed

src/mpi/CMakeLists.txt

+36-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,32 @@ endif()
3838
#----------------------------------------------------------------------
3939
# Test if MPI implementation provides features needed for failed images
4040
#----------------------------------------------------------------------
41-
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)
4241
set(MPI_HAS_FAULT_TOL_EXT YES)
42+
43+
CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H)
44+
if (NOT HAVE_SIGNAL_H)
45+
set(MPI_HAS_FAULT_TOL_EXT NO)
46+
message( FATAL_ERROR "Currently, OpenCoarrays cannot build without signal.h")
47+
endif()
48+
49+
include(CheckSymbolExists)
50+
CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
51+
if(NOT HAVE_SIGKILL) # try -D_POSIX, needed for mingw-w64, maybe others, see #435
52+
# https://github.com/sourceryinstitute/OpenCoarrays/issues/435#issuecomment-323592433
53+
list( APPEND CMAKE_REQUIRED_DEFINITIONS -D_POSIX)
54+
CHECK_SYMBOL_EXISTS(SIGKILL "signal.h" HAVE_SIGKILL)
55+
if(HAVE_SIGKILL)
56+
add_definitions(-D_POSIX)
57+
endif()
58+
endif()
59+
60+
if (NOT HAVE_SIGKILL)
61+
set(MPI_HAS_FAULT_TOL_EXT NO)
62+
message (FATAL_ERROR "Currently, OpenCoarrays cannot build without SIGKILL from signal.h")
63+
endif()
64+
65+
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)
66+
4367
set(old_cmake_required_includes "${CMAKE_REQUIRED_INCLUDES}")
4468
if(CMAKE_REQUIRED_INCLUDES)
4569
set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES};${MPI_C_INCLUDE_PATH})
@@ -65,7 +89,7 @@ if(HAVE_MPI_EXT)
6589
add_definitions(-DHAVE_MPI_EXT_H)
6690
set(MPI_HEADERS ${MPI_HEADERS};mpi-ext.h)
6791
endif()
68-
include(CheckSymbolExists)
92+
6993
foreach(symbol ${NEEDED_SYMBOLS})
7094
CHECK_SYMBOL_EXISTS(${symbol} ${MPI_HEADERS} HAVE_${symbol})
7195
if(NOT HAVE_${symbol})
@@ -89,6 +113,16 @@ if(CAF_ENABLE_FAILED_IMAGES)
89113
add_definitions(-DUSE_FAILED_IMAGES)
90114
endif()
91115

116+
#---------------------------------------------------
117+
# Windows Intel MPI compatibility, see GH issue #435
118+
#---------------------------------------------------
119+
CHECK_SYMBOL_EXISTS(I_MPI_VERSION mpi.h HAVE_Intel_MPI)
120+
if(HAVE_Intel_MPI AND WIN32)
121+
add_definitions(-DUSE_GCC)
122+
endif()
123+
124+
125+
92126
# Determine whether and how to include OpenCoarrays module based on if the Fortran MPI compiler:
93127
# - workds
94128
# - is compatible with the fortran compiler used to build the MPI implementation

src/mpi/mpi_caf.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -4136,7 +4136,7 @@ static void \
41364136
redux_char_by_reference_adapter (void *invec, void *inoutvec, int *len,
41374137
MPI_Datatype *datatype)
41384138
{
4139-
long int string_len;
4139+
MPI_Aint string_len;
41404140
MPI_Type_extent(*datatype, &string_len);
41414141
for(int i = 0; i < *len; i++)
41424142
{

0 commit comments

Comments
 (0)