Skip to content

Commit

Permalink
working now
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Mar 12, 2018
1 parent 3189787 commit 38230b3
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
35 changes: 16 additions & 19 deletions src/clib/pio_darray_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,19 @@ 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;
sastart[0] = max(0, frame);
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++)
Expand Down Expand Up @@ -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; i<rrcnt; i++)
Expand All @@ -485,6 +472,16 @@ int write_darray_multi_par(file_desc_t *file, int nvars, int fndims, const int *
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
}
#else
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;
}

/* 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));
Expand Down
10 changes: 5 additions & 5 deletions tests/cunit/test_async_multicomp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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);
Expand All @@ -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)))
Expand Down
2 changes: 1 addition & 1 deletion tests/cunit/test_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit 38230b3

Please sign in to comment.