Skip to content

Commit

Permalink
some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Apr 19, 2024
1 parent 7dfc7a1 commit a0d2a1c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
6 changes: 5 additions & 1 deletion src/clib/pio_darray_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,12 @@ write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *vari
start, count)))
return pio_err(ios, file, ierr, __FILE__, __LINE__);
size_t cnt = 1;
for(int i=0; i<fndims; i++)
for(int i=0; i<fndims; i++){
cnt *= count[i];
if(ios->io_rank==0){
printf("region %d dim %d count %lld\n",regioncnt,i,count[i]);
}
}
chkcnt2 += cnt;

/* IO tasks will run the netCDF/pnetcdf functions to write the data. */
Expand Down
17 changes: 3 additions & 14 deletions src/clib/pio_rearrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,6 @@ expand_region(int dim, const int *gdimlen, int maplen, const PIO_Offset *map,
int region_size, int region_stride, const int *max_size,
PIO_Offset *count)
{
/* Flag used to signal that we can no longer expand the region
along dimension dim. */
int expansion_done = 0;
/* Check inputs. */
pioassert(dim >= 0 && gdimlen && maplen >= 0 && map && region_size >= 0 &&
maplen >= region_size && region_stride >= 0 && max_size && count,
Expand All @@ -100,26 +97,18 @@ expand_region(int dim, const int *gdimlen, int maplen, const PIO_Offset *map,
Assuming monotonicity in the map, we could skip this for the
innermost dimension, but it's necessary past that because the
region does not necessarily comprise contiguous values. */
for (int j = 0; j < region_size; j++)
int test_idx = i * region_size;
for (int j = 0; j < region_size; j++, test_idx++)
{
int test_idx; /* Index we are testing. */

test_idx = j + i * region_size;

/* If we have exhausted the map, or the map no longer matches,
we are done, break out of both loops. */
//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));
if (test_idx >= maplen || map[test_idx] != map[j] + i * region_stride)
{
expansion_done = 1;
break;
return;
}
}
if (expansion_done)
break;

}
PLOG((3,"expansion_done = %d count[%d]=%ld",expansion_done, dim, count[dim]));
/* Move on to next outermost dimension if there are more left,
* else return. */
if (dim > 0)
Expand Down

0 comments on commit a0d2a1c

Please sign in to comment.