Skip to content

Commit

Permalink
Revert "Fix sending data to self."
Browse files Browse the repository at this point in the history
  • Loading branch information
rouson authored Oct 11, 2024
1 parent 1243b17 commit b843def
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
27 changes: 11 additions & 16 deletions src/runtime-libraries/mpi/mpi_caf.c
Original file line number Diff line number Diff line change
Expand Up @@ -2026,30 +2026,25 @@ copy_char_to_self(void *src, int src_type, int src_size, int src_kind,

static void
copy_to_self(gfc_descriptor_t *src, int src_kind,
gfc_descriptor_t *dst, int dst_kind, size_t elem_size, int *stat)
gfc_descriptor_t *dest, int dst_kind, size_t size, int *stat)
{
const int src_size = GFC_DESCRIPTOR_SIZE(src),
dst_size = GFC_DESCRIPTOR_SIZE(dst);
const int src_type = GFC_DESCRIPTOR_TYPE(src),
dst_type = GFC_DESCRIPTOR_TYPE(dst);
const int src_rank = GFC_DESCRIPTOR_RANK(src),
dst_rank = GFC_DESCRIPTOR_RANK(dst);
#ifdef GFC_CAF_CHECK
if (dst_type == BT_CHARACTER || src_type == BT_CHARACTER)
if (GFC_DESCRIPTOR_TYPE(dest) == BT_CHARACTER
|| GFC_DESCRIPTOR_TYPE(src) == BT_CHARACTER)
caf_runtime_error("internal error: copy_to_self() for char types called.");
#endif
/* The address of dest passed by the compiler points on the right
* memory location. No offset summation is needed. Use the convert with
* strides when src is a scalar. */
if (dst_kind == src_kind && dst_size == src_size && dst_type == src_type
&& src_rank == dst_rank)
memmove(dst->base_addr, src->base_addr, elem_size * dst_size);
* memory location. No offset summation is needed. */
if (dst_kind == src_kind)
memmove(dest->base_addr, src->base_addr, size * GFC_DESCRIPTOR_SIZE(dest));
else
/* When the rank is 0 then a scalar is copied to a vector and the stride
* is zero. */
convert_with_strides(dst->base_addr, dst_type, dst_kind,
dst_size, src->base_addr, src_type, src_kind,
src_rank > 0 ? src_size : 0, elem_size, stat);
convert_with_strides(dest->base_addr, GFC_DESCRIPTOR_TYPE(dest), dst_kind,
GFC_DESCRIPTOR_SIZE(dest), src->base_addr,
GFC_DESCRIPTOR_TYPE(src), src_kind,
(GFC_DESCRIPTOR_RANK(src) > 0)
? GFC_DESCRIPTOR_SIZE(src) : 0, size, stat);
}

/* token: The token of the array to be written to.
Expand Down
2 changes: 1 addition & 1 deletion src/tests/unit/send-get/send_convert_nums.f90
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ program send_convert_nums
& call print_and_register( 'send strided int kind=1 to kind=1 self failed.')

co_int_k4 = -1
co_int_k4(::2)[1] = int_k4(1:3)
co_int_k4(::2)[1] = int_k4
print *, co_int_k4
if (any(co_int_k4 /= [int_k4(1), -1, int_k4(2), -1, int_k4(3)])) &
call print_and_register( 'send strided int kind=4 to kind=4 self failed.')
Expand Down

0 comments on commit b843def

Please sign in to comment.