Skip to content

Commit

Permalink
merged ejh_bug_fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Mar 24, 2019
2 parents 31c64d0 + f70ce39 commit 7b9cc47
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 19 deletions.
2 changes: 0 additions & 2 deletions src/clib/pio_darray_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,6 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
/* Write, in non-blocking fashion, a list of subarrays. */
LOG((3, "about to call ncmpi_iput_varn() varids[%d] = %d rrcnt = %d, llen = %d",
nv, varids[nv], rrcnt, llen));
for (int i=0; i< rrcnt; i++)
LOG((3, "i %d start %ld count %ld start %ld count %ld\n",i,startlist[i][0], countlist[i][0],startlist[i][1], countlist[i][1]));
ierr = ncmpi_iput_varn(file->fh, varids[nv], rrcnt, startlist, countlist,
bufptr, llen, iodesc->mpitype, &vdesc->request[vdesc->nreqs]);

Expand Down
3 changes: 2 additions & 1 deletion src/clib/pioc.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,8 @@ int PIOc_InitDecomp(int iosysid, int pio_type, int ndims, const int *gdimlen, in
break;
}
}
if (iodesc->needssort){
if (iodesc->needssort)
{
struct sort_map *tmpsort;

if (!(tmpsort = malloc(sizeof(struct sort_map) * maplen)))
Expand Down
3 changes: 3 additions & 0 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,9 @@ int PIOc_freedecomp(int iosysid, int ioid)
/* Free the dimlens. */
free(iodesc->dimlen);

if (iodesc->remap)
free(iodesc->remap);

LOG((3, "freeing rfrom, rtype"));
if (iodesc->rfrom)
free(iodesc->rfrom);
Expand Down
9 changes: 0 additions & 9 deletions tests/cunit/test_darray_multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
int ncid2; /* The ncid of the re-opened netCDF file. */
int varid[NVAR]; /* The IDs of the netCDF varables. */
int other_varid; /* The IDs of a var of different type. */
int wrong_varid[NVAR]; /* These will not work. */
PIO_Offset arraylen = 4; /* Amount of data from each task. */
void *fillvalue; /* Pointer to fill value. */
void *test_data; /* Pointer to test data we will write. */
Expand Down Expand Up @@ -279,14 +278,6 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
int frame[NVAR] = {0, 0, 0};
int flushtodisk = test_multi;

/* This will not work, because we mix var types. */
wrong_varid[0] = varid[0];
wrong_varid[1] = varid[1];
wrong_varid[0] = other_varid;
// if (PIOc_write_darray_multi(ncid, wrong_varid, ioid, NVAR, arraylen, test_data, frame,
// fillvalue, flushtodisk) != PIO_EINVAL)
// ERR(ERR_WRONG);

/* Write the data with the _multi function. */
if ((ret = PIOc_write_darray_multi(ncid, varid, ioid, NVAR, arraylen, test_data, frame,
fillvalue, flushtodisk)))
Expand Down
11 changes: 7 additions & 4 deletions tests/cunit/test_darray_multivar3.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ int test_multivar_darray(int iosysid, int ioid, int num_flavors, int *flavor,
ERR(ret);

int *fvp_int = NULL;
float *fvp_float = NULL;
/* float *fvp_float = NULL; */
if (use_fv)
{
fvp_int = &custom_fillvalue_int;
fvp_float = &custom_fillvalue_float;
/* fvp_float = &custom_fillvalue_float; */
}

/* Write the data. */
Expand All @@ -148,13 +148,16 @@ int test_multivar_darray(int iosysid, int ioid, int num_flavors, int *flavor,
fvp_int)))
ERR(ret);

/* This should not work since we cannot mix record and not record vars */
/* This should not work since we cannot mix record and not
* record vars. */
int frame[NUM_VAR] = {0, 0, 0};

if (PIOc_write_darray_multi(ncid, varid, ioid, NUM_VAR, arraylen * NUM_VAR, test_data_float,
frame, NULL, 0) != PIO_EVARDIMMISMATCH)
ERR(ERR_WRONG);
/* This should work since int and float are the same size and both are record vars */

/* This should work since int and float are the same size
* and both are record vars. */
if ((ret = PIOc_write_darray_multi(ncid, varid+1, ioid, NUM_VAR-1, arraylen * (NUM_VAR-1), test_data_float,
frame, NULL, 0)))
ERR(ret);
Expand Down
5 changes: 2 additions & 3 deletions tests/cunit/test_perf2.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,9 +219,8 @@ int test_darray(int iosysid, int ioid, int num_flavors, int *flavor, int my_rank
startt = (1000000 * starttime.tv_sec) + starttime.tv_usec;
endt = (1000000 * endtime.tv_sec) + endtime.tv_usec;
delta = (endt - startt)/NUM_TIMESTEPS;
/* if (!my_rank) */
/* printf("%d\t%d\t%d\t%d\t%lld\n", rearranger, fmt, pio_type, test_multi, */
/* delta); */
if (!my_rank)
printf("%d\t%lld\n", fmt, delta);

/* Reopen the file. */
if ((ret = PIOc_openfile(iosysid, &ncid2, &flavor[fmt], filename, PIO_NOWRITE)))
Expand Down

0 comments on commit 7b9cc47

Please sign in to comment.