From 38230b3293d03f023235bae572ecaecdb802d7b5 Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 9 Mar 2018 15:01:08 -0700 Subject: [PATCH] working now --- src/clib/pio_darray_int.c | 35 ++++++++++++++---------------- tests/cunit/test_async_multicomp.c | 10 ++++----- tests/cunit/test_darray.c | 2 +- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/clib/pio_darray_int.c b/src/clib/pio_darray_int.c index 5a1f7bc845b..12da1914d90 100644 --- a/src/clib/pio_darray_int.c +++ b/src/clib/pio_darray_int.c @@ -159,6 +159,11 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi { int sacount[fndims]; int sastart[fndims]; + for (int i=dim_offset; i< fndims; i++) + { + sacount[i-dim_offset] = (int) countlist[rc][i]; + sastart[i-dim_offset] = (int) startlist[rc][i]; + } if(gdim0 > 0) { unlimdimoffset = gdim0; @@ -166,15 +171,7 @@ int get_vard_mpidatatype(io_desc_t *iodesc, MPI_Offset gdim0, PIO_Offset unlimdi displacements[rc]=0; } else - { - sacount[0] = 1; displacements[rc] = unlimdimoffset * max(0, frame); - } - for (int i=dim_offset; i< fndims; i++) - { - sacount[i-dim_offset] = (int) countlist[rc][i]; - sastart[i-dim_offset] = (int) startlist[rc][i]; - } #if PIO_ENABLE_LOGGING for (int i=0; i< sa_ndims; i++) @@ -460,21 +457,11 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int * /* Get a pointer to the data. */ bufptr = (void *)((char *)iobuf + nv * iodesc->mpitype_size * llen); - if (vdesc->nreqs % PIO_REQUEST_ALLOC_CHUNK == 0) - { - if (!(vdesc->request = realloc(vdesc->request, sizeof(int) * - (vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK)))) - return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); - - for (int i = vdesc->nreqs; i < vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK; i++) - vdesc->request[i] = NC_REQ_NULL; - } - #if USE_VARD_WRITE LOG((3, "vard: call ncmpi_put_vard llen = %d %d", llen, iodesc->mpitype_size )); ierr = ncmpi_put_vard_all(file->fh, varids[nv], filetype, bufptr, llen, iodesc->mpitype); LOG((3, "vard: return ncmpi_put_vard ierr = %d", ierr)); - if(filetype != MPI_DATATYPE_NULL) + if(nv==nvars-1 && filetype != MPI_DATATYPE_NULL) { int mpierr; for(int i=0; inreqs % PIO_REQUEST_ALLOC_CHUNK == 0) + { + if (!(vdesc->request = realloc(vdesc->request, sizeof(int) * + (vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK)))) + return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__); + + for (int i = vdesc->nreqs; i < vdesc->nreqs + PIO_REQUEST_ALLOC_CHUNK; i++) + vdesc->request[i] = NC_REQ_NULL; + } + /* 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)); diff --git a/tests/cunit/test_async_multicomp.c b/tests/cunit/test_async_multicomp.c index 9822106fdd8..8d4a2e1f847 100644 --- a/tests/cunit/test_async_multicomp.c +++ b/tests/cunit/test_async_multicomp.c @@ -52,12 +52,12 @@ int main(int argc, char **argv) /* Initialize test. */ if ((ret = pio_test_init2(argc, argv, &my_rank, &ntasks, TARGET_NTASKS, TARGET_NTASKS, - -1, &test_comm))) + 3, &test_comm))) ERR(ERR_INIT); - /* Is the current process a computation task? */ + /* Is the current process a computation task? */ int comp_task = my_rank < NUM_IO_PROCS ? 0 : 1; - + /* Only do something on TARGET_NTASKS tasks. */ if (my_rank < TARGET_NTASKS) { @@ -90,7 +90,7 @@ int main(int argc, char **argv) int my_comp_idx = my_rank - 1; /* Index in iosysid array. */ int dim_len_2d[NDIM2] = {DIM_LEN2, DIM_LEN3}; int ioid = 0; - + if ((ret = create_decomposition_2d(NUM_COMP_PROCS, my_rank, iosysid[my_comp_idx], dim_len_2d, &ioid, PIO_SHORT))) ERR(ret); @@ -103,7 +103,7 @@ int main(int argc, char **argv) if ((ret = create_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx, filename, TEST_NAME, verbose, use_darray, ioid))) ERR(ret); - + /* Check the file for correctness. */ if ((ret = check_nc_sample_3(iosysid[my_comp_idx], iotype[i], my_rank, my_comp_idx, filename, verbose, 0, ioid))) diff --git a/tests/cunit/test_darray.c b/tests/cunit/test_darray.c index 0b6c9a033f9..aaca7d88d61 100644 --- a/tests/cunit/test_darray.c +++ b/tests/cunit/test_darray.c @@ -341,7 +341,7 @@ int main(int argc, char **argv) /* Initialize test. */ if ((ret = pio_test_init2(argc, argv, &my_rank, &ntasks, MIN_NTASKS, - MIN_NTASKS, 3, &test_comm))) + MIN_NTASKS, -1, &test_comm))) ERR(ERR_INIT); if ((ret = PIOc_set_iosystem_error_handling(PIO_DEFAULT, PIO_RETURN_ERROR, NULL)))