@@ -113,9 +113,9 @@ int ncmpi_diff(char *filename1, char *filename2)
113113
114114 str [0 ] = '\0' ;
115115 err = ncmpi_open (comm , filename1 , NC_NOWRITE , MPI_INFO_NULL , & ncid1 );
116- CHECK_ERR
116+ CHECK_ERROUT
117117 err = ncmpi_open (comm , filename2 , NC_NOWRITE , MPI_INFO_NULL , & ncid2 );
118- CHECK_ERR
118+ CHECK_ERROUT
119119
120120 /**
121121 * Inquire the dataset definitions of input dataset AND
@@ -295,6 +295,7 @@ int ncmpi_diff(char *filename1, char *filename2)
295295 err = ncmpi_close (ncid2 );
296296 CHECK_ERR
297297
298+ err_out :
298299 return nerrs ;
299300}
300301
@@ -402,6 +403,9 @@ int main(int argc, char **argv)
402403 bufcount *= length ;
403404 }
404405 MPI_Dims_create (nprocs , ndims , array_of_psizes );
406+ if (verbose )
407+ printf ("rank %d: array_of_psizes[3]=%d %d %d\n" ,
408+ rank ,array_of_psizes [0 ],array_of_psizes [1 ],array_of_psizes [2 ]);
405409
406410 /* subarray in each process is len x len x len */
407411 for (i = 0 ; i < ndims ; i ++ )
@@ -413,23 +417,26 @@ int main(int argc, char **argv)
413417 rank_dim [0 ] = rank / (array_of_psizes [2 ] * array_of_psizes [1 ]);
414418 if (verbose )
415419 printf ("rank %d: rank_dim[3]=%d %d %d\n" ,
416- rank ,rank_dim [0 ],rank_dim [2 ],rank_dim [2 ]);
420+ rank ,rank_dim [0 ],rank_dim [1 ],rank_dim [2 ]);
417421
418422 /* starting coordinates of the subarray in each dimension */
419423 for (i = 0 ; i < ndims ; i ++ )
420424 array_of_starts [i ] = length * rank_dim [i ];
425+ if (verbose )
426+ printf ("rank %d: array_of_starts[3]=%lld %lld %lld\n" ,
427+ rank ,array_of_starts [0 ],array_of_starts [1 ],array_of_starts [2 ]);
421428
422429 for (i = 0 ; i < nvars ; i ++ ) {
423430 for (j = 0 ; j < ndims ; j ++ ) {
424431 starts [i ][j ] = array_of_starts [j ];
425- counts [i ][j ] = length ;
432+ counts [i ][j ] = length ;
426433 }
427434 bufcounts [i ] = bufcount ;
428435 datatype_list [i ] = MPI_INT ;
429436 }
430437 if (verbose )
431438 printf ("rank %d: starts[0][3]=%lld %lld %lld counts[0][3]=%lld %lld %lld\n" ,
432- rank ,starts [0 ][0 ],starts [0 ][2 ],starts [0 ][2 ], counts [0 ][0 ],counts [0 ][1 ],counts [0 ][2 ]);
439+ rank ,starts [0 ][0 ],starts [0 ][1 ],starts [0 ][2 ], counts [0 ][0 ],counts [0 ][1 ],counts [0 ][2 ]);
433440
434441 buf [0 ] = (int * ) malloc (sizeof (int ) * bufcount * nvars );
435442 if (buf [0 ] == NULL ) {
0 commit comments