Skip to content

Commit

Permalink
Add more debug output for co_broadcast
Browse files Browse the repository at this point in the history
  • Loading branch information
vehre committed Feb 14, 2022
1 parent 5a092eb commit fb165fd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/mpi/mpi_caf.c
Original file line number Diff line number Diff line change
Expand Up @@ -7524,6 +7524,8 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,
size *= dimextent;
}

dprint("Using mpi-datatype: 0x%x in co_broadcast (base_addr=%p, rank= %d).\n",
datatype, a->base_addr, rank);
if (rank == 0)
{
if( datatype == MPI_BYTE)
Expand Down Expand Up @@ -7564,16 +7566,17 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,

for (i = 0; i < size; ++i)
{
ptrdiff_t array_offset_sr = 0, tot_ext = 1, extent = 1;
ptrdiff_t array_offset = 0, tot_ext = 1, extent = 1;
for (j = 0; j < rank - 1; ++j)
{
extent = a->dim[j]._ubound - a->dim[j].lower_bound + 1;
array_offset_sr += ((i / tot_ext) % extent) * a->dim[j]._stride;
array_offset += ((i / tot_ext) % extent) * a->dim[j]._stride;
tot_ext *= extent;
}
array_offset_sr += (i / tot_ext) * a->dim[rank - 1]._stride;
array_offset += (i / tot_ext) * a->dim[rank - 1]._stride;
dprint("The array offset for element %d used in co_broadcast is %d\n", i, array_offset);
void *sr = (void *)(
(char *)a->base_addr + array_offset_sr * GFC_DESCRIPTOR_SIZE(a));
(char *)a->base_addr + array_offset * GFC_DESCRIPTOR_SIZE(a));

ierr = MPI_Bcast(sr, 1, datatype, source_image - 1, CAF_COMM_WORLD);
chk_err(ierr);
Expand Down

0 comments on commit fb165fd

Please sign in to comment.