Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions src/runtime-libraries/mpi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,6 @@ set(HOST_NAME ${HOST_NAME} PARENT_SCOPE)
execute_process(COMMAND ${MPIEXEC_EXECUTABLE} --version
OUTPUT_VARIABLE mpi_version_out)
if (mpi_version_out MATCHES "[Oo]pen[ -][Mm][Pp][Ii]")
if ( gfortran_compiler AND ( NOT CMAKE_Fortran_COMPILER_VERSION VERSION_LESS 14.0.0 ) )
# OpenMPI uses addresses for windows instead of identical ids on all images for the same token.
# Therefore we can't use it (yet; and probably never).
message( FATAL_ERROR "OpenMPI is incompatible with gfortran's coarray implementation from gfortran version 15 on. Please use a different MPI implementation!")
endif ()
message( STATUS "OpenMPI detected")
set_property(GLOBAL PROPERTY openmpi true)
# Write out a host file because OMPI's mpiexec is dumb
Expand Down
27 changes: 18 additions & 9 deletions src/runtime-libraries/mpi/mpi_caf.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ static char *caf_ref_type_str[] = {
"CAF_REF_STATIC_ARRAY",
};

static inline MPI_Win CAF_idx2win(int idx) {
return MPI_Win_f2c(idx);
}

static inline int CAF_win2idx(MPI_Win win) {
return MPI_Win_c2f(win);
}

#ifndef EXTRA_DEBUG_OUTPUT
#define dprint(...)
#define chk_err(...)
Expand Down Expand Up @@ -310,7 +318,7 @@ typedef struct
int flags;
size_t transfer_size;
size_t opt_charlen;
MPI_Win win;
int win;
int dest_image;
int dest_tag;
int accessor_index;
Expand Down Expand Up @@ -942,7 +950,7 @@ handle_transfer_message(ct_msg_t *msg, void *baseptr)
{
int flag;
dprint("ct: self handling message of size %zd.\n", send_size);
ierr = MPI_Win_get_attr(send_msg->win, MPI_WIN_BASE, &baseptr, &flag);
ierr = MPI_Win_get_attr(CAF_idx2win(send_msg->win), MPI_WIN_BASE, &baseptr, &flag);
chk_err(ierr);
handle_send_message(send_msg, baseptr);
}
Expand Down Expand Up @@ -970,9 +978,10 @@ handle_incoming_message(MPI_Status *status_in, MPI_Message *msg_han,
dprint("ct: Received request of size %d (sizeof(ct_msg) = %zd).\n", cnt,
sizeof(ct_msg_t));

if (msg->win != MPI_WIN_NULL)
MPI_Win win = CAF_idx2win(msg->win);
if (win != MPI_WIN_NULL)
{
ierr = MPI_Win_get_attr(msg->win, MPI_WIN_BASE, &baseptr, &flag);
ierr = MPI_Win_get_attr(win, MPI_WIN_BASE, &baseptr, &flag);
chk_err(ierr);
}
else
Expand Down Expand Up @@ -5600,7 +5609,7 @@ PREFIX(get_from_remote)(caf_token_t token, const gfc_descriptor_t *opt_src_desc,
msg->cmd = remote_command_get;
msg->transfer_size = dst_size;
msg->opt_charlen = opt_src_charlen ? *opt_src_charlen : 0;
msg->win = *TOKEN(token);
msg->win = CAF_win2idx(*TOKEN(token));
msg->dest_image = mpi_this_image;
msg->dest_tag = CAF_CT_TAG + 1;
msg->dest_opt_charlen = opt_dst_charlen ? *opt_dst_charlen : 1;
Expand Down Expand Up @@ -5786,7 +5795,7 @@ PREFIX(is_present_on_remote)(caf_token_t token, const int image_index,
msg->cmd = remote_command_present;
msg->transfer_size = 1;
msg->opt_charlen = 0;
msg->win = *TOKEN(token);
msg->win = CAF_win2idx(*TOKEN(token));
msg->dest_image = mpi_this_image;
msg->dest_tag = CAF_CT_TAG + 1;
msg->dest_opt_charlen = 0;
Expand Down Expand Up @@ -6001,7 +6010,7 @@ PREFIX(send_to_remote)(caf_token_t token, gfc_descriptor_t *opt_dst_desc,
msg->cmd = remote_command_send;
msg->transfer_size = src_size;
msg->opt_charlen = opt_src_charlen ? *opt_src_charlen : 0;
msg->win = *TOKEN(token);
msg->win = CAF_win2idx(*TOKEN(token));
msg->dest_image = mpi_this_image;
msg->dest_tag = CAF_CT_TAG + 1;
msg->dest_opt_charlen = opt_dst_charlen ? *opt_dst_charlen : 1;
Expand Down Expand Up @@ -6264,7 +6273,7 @@ PREFIX(transfer_between_remotes)(
full_msg->cmd = remote_command_transfer;
full_msg->transfer_size = src_size;
full_msg->opt_charlen = opt_src_charlen ? *opt_src_charlen : 0;
full_msg->win = *TOKEN(src_token);
full_msg->win = CAF_win2idx(*TOKEN(src_token));
full_msg->dest_image = dst_remote_image;
full_msg->dest_tag = CAF_CT_TAG;
full_msg->dest_opt_charlen = opt_dst_charlen ? *opt_dst_charlen : 1;
Expand All @@ -6280,7 +6289,7 @@ PREFIX(transfer_between_remotes)(
dst_msg->cmd = remote_command_send;
dst_msg->transfer_size = src_size;
dst_msg->opt_charlen = opt_src_charlen ? *opt_src_charlen : 0;
dst_msg->win = *TOKEN(dst_token);
dst_msg->win = CAF_win2idx(*TOKEN(dst_token));
dst_msg->dest_image = mpi_this_image;
dst_msg->dest_tag = CAF_CT_TAG + 1;
dst_msg->dest_opt_charlen = opt_dst_charlen ? *opt_dst_charlen : 1;
Expand Down