@@ -430,14 +430,19 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari
430430
431431 ierr = ncmpi_wait_all (file -> fh , NC_REQ_ALL , NULL , NULL );
432432#endif /* _PNETCDF */
433-
433+ MPI_Offset chkcnt2 = 0 ;
434434 /* Process each region of data to be written. */
435435 for (int regioncnt = 0 ; regioncnt < num_regions ; regioncnt ++ )
436436 {
437437 /* Fill the start/count arrays. */
438438 if ((ierr = find_start_count (iodesc -> ndims , fndims , vdesc , region , frame ,
439439 start , count )))
440440 return pio_err (ios , file , ierr , __FILE__ , __LINE__ );
441+ size_t cnt = 1 ;
442+ for (int i = 0 ; i < fndims ; i ++ ){
443+ cnt *= count [i ];
444+ }
445+ chkcnt2 += cnt ;
441446
442447 /* IO tasks will run the netCDF/pnetcdf functions to write the data. */
443448 switch (file -> iotype )
@@ -490,10 +495,10 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari
490495 for (int i = 0 ; i < fndims ; i ++ )
491496 {
492497 startlist [rrcnt ][i ] = start [i ];
493- countlist [rrcnt ][i ] = count [i ];
494- PLOG ((3 , "startlist[%d][%d] = %d countlist[%d][%d] = %d " , rrcnt , i ,
498+ countlist [rrcnt ][i ] = count [i ];
499+ PLOG ((3 , "startlist[%d][%d] = %lld countlist[%d][%d] = %lld " , rrcnt , i ,
495500 startlist [rrcnt ][i ], rrcnt , i , countlist [rrcnt ][i ]));
496- }
501+ }
497502 rrcnt ++ ;
498503 }
499504
@@ -645,11 +650,22 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari
645650 else /* don't flush yet, accumulate the request size */
646651 vard_llen += llen ;
647652#else
648-
649653 ierr = ncmpi_iput_varn (file -> fh , varids [nv ], rrcnt , startlist , countlist ,
650- bufptr , llen , iodesc -> mpitype , NULL );
651-
652-
654+ bufptr , chkcnt2 , iodesc -> mpitype , NULL );
655+ // bufptr, llen, iodesc->mpitype, NULL);
656+
657+
658+ if (ierr ){
659+ MPI_Offset chksize = 0 ;
660+ for (int j = 0 ; j < rrcnt ; j ++ )
661+ {
662+ /* printf("%d: nv=%d startlist[%d][%d] = %lld countlist[%d][%d] = %lld\n", ios->io_rank, nv, j, i,
663+ startlist[j][i], j, i, countlist[j][i]);
664+ */
665+ chksize += countlist [j ][0 ]* countlist [j ][1 ]* countlist [j ][2 ];
666+ }
667+ printf ("llen = %lld chksize = %lld chkcnt2 = %lld\n" ,llen , chksize , chkcnt2 );
668+ }
653669 vdesc -> nreqs ++ ;
654670#endif
655671 }
0 commit comments