Skip to content

Commit

Permalink
more log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 10, 2016
1 parent be9af21 commit 985ba72
Showing 1 changed file with 24 additions and 10 deletions.
34 changes: 24 additions & 10 deletions src/clib/pio_put_nc_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
char start_present = start ? true : false; /* Is start non-NULL? */
char count_present = count ? true : false; /* Is count non-NULL? */
char stride_present = stride ? true : false; /* Is stride non-NULL? */
PIO_Offset *rstart, *rcount, *rstride;
var_desc_t *vdesc;
PIO_Offset usage;
int *request;
Expand All @@ -66,13 +67,20 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
* non-IO tasks if async is in use. */
if (!ios->async_interface || !ios->ioproc)
{
/* Get the length of the data type. */
if ((ierr = PIOc_inq_type(ncid, xtype, NULL, &typelen)))
return check_netcdf(file, ierr, __FILE__, __LINE__);

/* Get the number of dims for this var. */
if ((ierr = PIOc_inq_varndims(ncid, varid, &ndims)))
return check_netcdf(file, ierr, __FILE__, __LINE__);
}

/* Broadcase the number of dimensions to all tasks. */

/* Run these on all tasks if async is not in use, but only on
* non-IO tasks if async is in use. */
if (!ios->async_interface || !ios->ioproc)
{
/* Get the length of the data type. */
if ((ierr = PIOc_inq_type(ncid, xtype, NULL, &typelen)))
return check_netcdf(file, ierr, __FILE__, __LINE__);

PIO_Offset dimlen[ndims];

Expand All @@ -93,9 +101,16 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
return check_netcdf(file, ierr, __FILE__, __LINE__);
}

/* Allocate memory for these arrays, now that we know ndims. */
if (!(rstart = malloc(ndims * sizeof(PIO_Offset))))
return check_netcdf(file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(rcount = malloc(ndims * sizeof(PIO_Offset))))
return check_netcdf(file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(rstride = malloc(ndims * sizeof(PIO_Offset))))
return check_netcdf(file, PIO_ENOMEM, __FILE__, __LINE__);

/* Figure out the real start, count, and stride arrays. (The
* user may have passed in NULLs.) */
PIO_Offset rstart[ndims], rcount[ndims], rstride[ndims];
for (int vd = 0; vd < ndims; vd++)
{
rstart[vd] = start ? start[vd] : 0;
Expand Down Expand Up @@ -174,11 +189,10 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
if (!stride_present)
{
LOG((2, "stride not present"));
/* if (!(fake_stride = malloc(ndims * sizeof(PIO_Offset)))) */
/* return PIO_ENOMEM; */
/* for (int d = 0; d < ndims; d++) */
/* fake_stride[d] = 1; */
fake_stride = (PIO_Offset *)stride;
if (!(fake_stride = malloc(ndims * sizeof(PIO_Offset))))
return PIO_ENOMEM;
for (int d = 0; d < ndims; d++)
fake_stride[d] = 1;
}
else
fake_stride = (PIO_Offset *)stride;
Expand Down

0 comments on commit 985ba72

Please sign in to comment.