Skip to content

Commit 09dcc06

Browse files
authored
Merge pull request #1990 from NCAR/fix/largedof
Fix/largedof
2 parents 6539ef0 + 7f659a3 commit 09dcc06

File tree

2 files changed

+27
-22
lines changed

2 files changed

+27
-22
lines changed

src/clib/pio_darray_int.c

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

src/clib/pio_rearrange.c

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ expand_region(int dim, const int *gdimlen, int maplen, const PIO_Offset *map,
8080
int region_size, int region_stride, const int *max_size,
8181
PIO_Offset *count)
8282
{
83-
/* Flag used to signal that we can no longer expand the region
84-
along dimension dim. */
85-
int expansion_done = 0;
8683
/* Check inputs. */
8784
pioassert(dim >= 0 && gdimlen && maplen >= 0 && map && region_size >= 0 &&
8885
maplen >= region_size && region_stride >= 0 && max_size && count,
@@ -100,26 +97,18 @@ expand_region(int dim, const int *gdimlen, int maplen, const PIO_Offset *map,
10097
Assuming monotonicity in the map, we could skip this for the
10198
innermost dimension, but it's necessary past that because the
10299
region does not necessarily comprise contiguous values. */
103-
for (int j = 0; j < region_size; j++)
100+
int test_idx = i * region_size;
101+
for (int j = 0; j < region_size; j++, test_idx++)
104102
{
105-
int test_idx; /* Index we are testing. */
106-
107-
test_idx = j + i * region_size;
108-
109103
/* If we have exhausted the map, or the map no longer matches,
110104
we are done, break out of both loops. */
111105
//PLOG((3,"dim=%d maplen = %d map[%d]=%d map[%d]=%d i=%d region_stride=%d",dim, maplen, test_idx, map[test_idx], j, map[j],i,region_stride));
112106
if (test_idx >= maplen || map[test_idx] != map[j] + i * region_stride)
113107
{
114-
expansion_done = 1;
115-
break;
108+
return;
116109
}
117110
}
118-
if (expansion_done)
119-
break;
120-
121111
}
122-
PLOG((3,"expansion_done = %d count[%d]=%ld",expansion_done, dim, count[dim]));
123112
/* Move on to next outermost dimension if there are more left,
124113
* else return. */
125114
if (dim > 0)

0 commit comments

Comments
 (0)