@@ -7524,6 +7524,8 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,
75247524 size *= dimextent ;
75257525 }
75267526
7527+ dprint ("Using mpi-datatype: 0x%x in co_broadcast (base_addr=%p, rank= %d).\n" ,
7528+ datatype , a -> base_addr , rank );
75277529 if (rank == 0 )
75287530 {
75297531 if ( datatype == MPI_BYTE )
@@ -7564,16 +7566,17 @@ PREFIX(co_broadcast) (gfc_descriptor_t *a, int source_image, int *stat,
75647566
75657567 for (i = 0 ; i < size ; ++ i )
75667568 {
7567- ptrdiff_t array_offset_sr = 0 , tot_ext = 1 , extent = 1 ;
7569+ ptrdiff_t array_offset = 0 , tot_ext = 1 , extent = 1 ;
75687570 for (j = 0 ; j < rank - 1 ; ++ j )
75697571 {
75707572 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 ;
75727574 tot_ext *= extent ;
75737575 }
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 );
75757578 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 ));
75777580
75787581 ierr = MPI_Bcast (sr , 1 , datatype , source_image - 1 , CAF_COMM_WORLD );
75797582 chk_err (ierr );
0 commit comments