@@ -7524,6 +7524,8 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,
7524
7524
size *= dimextent ;
7525
7525
}
7526
7526
7527
+ dprint ("Using mpi-datatype: 0x%x in co_broadcast (base_addr=%p, rank= %d).\n" ,
7528
+ datatype , a -> base_addr , rank );
7527
7529
if (rank == 0 )
7528
7530
{
7529
7531
if ( datatype == MPI_BYTE )
@@ -7564,16 +7566,17 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,
7564
7566
7565
7567
for (i = 0 ; i < size ; ++ i )
7566
7568
{
7567
- ptrdiff_t array_offset_sr = 0 , tot_ext = 1 , extent = 1 ;
7569
+ ptrdiff_t array_offset = 0 , tot_ext = 1 , extent = 1 ;
7568
7570
for (j = 0 ; j < rank - 1 ; ++ j )
7569
7571
{
7570
7572
extent = a -> dim [j ]._ubound - a -> dim [j ].lower_bound + 1 ;
7571
- array_offset_sr += ((i / tot_ext ) % extent ) * a -> dim [j ]._stride ;
7573
+ array_offset += ((i / tot_ext ) % extent ) * a -> dim [j ]._stride ;
7572
7574
tot_ext *= extent ;
7573
7575
}
7574
- array_offset_sr += (i / tot_ext ) * a -> dim [rank - 1 ]._stride ;
7576
+ array_offset += (i / tot_ext ) * a -> dim [rank - 1 ]._stride ;
7577
+ dprint ("The array offset for element %d used in co_broadcast is %d\n" , i , array_offset );
7575
7578
void * sr = (void * )(
7576
- (char * )a -> base_addr + array_offset_sr * GFC_DESCRIPTOR_SIZE (a ));
7579
+ (char * )a -> base_addr + array_offset * GFC_DESCRIPTOR_SIZE (a ));
7577
7580
7578
7581
ierr = MPI_Bcast (sr , 1 , datatype , source_image - 1 , CAF_COMM_WORLD );
7579
7582
chk_err (ierr );
0 commit comments