Skip to content

Commit

Permalink
working on put issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Jun 10, 2016
1 parent 985ba72 commit 82d9faa
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 15 deletions.
19 changes: 11 additions & 8 deletions src/clib/pio_nc_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,9 +664,9 @@ int PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
mpierr = MPI_Bcast(&dimids_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm);
if (!mpierr)
mpierr = MPI_Bcast(&natts_present, 1, MPI_CHAR, ios->compmaster, ios->intercomm);
LOG((2, "PIOc_inq_var name_present = %d xtype_present = %d ndims_present = %d "
"dimids_present = %d, natts_present = %d nattsp = %d",
name_present, xtype_present, ndims_present, dimids_present, natts_present, nattsp));
LOG((2, "PIOc_inq_var name_present = %d xtype_present = %d ndims_present = %d "
"dimids_present = %d, natts_present = %d nattsp = %d",
name_present, xtype_present, ndims_present, dimids_present, natts_present, nattsp));
}

/* Handle MPI errors. */
Expand Down Expand Up @@ -698,12 +698,13 @@ int PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,
}

if (ndimsp)
LOG((2, "PIOc_inq_var ndims = %d", *ndimsp));
LOG((2, "PIOc_inq_var ndims = %d ierr = %d", *ndimsp, ierr));

/* Broadcast and check the return code. */
if ((mpierr = MPI_Bcast(&ierr, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
check_netcdf(file, ierr, __FILE__, __LINE__);
if (ierr)
return check_netcdf(file, ierr, __FILE__, __LINE__);

/* Broadcast the results for non-null pointers. */
if (!ierr)
Expand All @@ -724,9 +725,11 @@ int PIOc_inq_var(int ncid, int varid, char *name, nc_type *xtypep, int *ndimsp,

if (ndimsp)
{
if (ios->ioroot)
LOG((2, "PIOc_inq_var about to Bcast ndims = %d ios->ioroot = %d", *ndimsp, ios->ioroot));
if ((mpierr = MPI_Bcast(ndimsp, 1, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
file->varlist[varid].ndims = (*ndimsp);
file->varlist[varid].ndims = *ndimsp;
LOG((2, "PIOc_inq_var Bcast ndims = %d", *ndimsp));
}
if (dimidsp)
Expand Down Expand Up @@ -2110,9 +2113,9 @@ int PIOc_get_att(int ncid, int varid, const char *name, void *ip)
/* Broadcast values currently only known on computation tasks to IO tasks. */
LOG((2, "PIOc_get_att bcast from comproot = %d attlen = %d typelen = %d", ios->comproot, attlen, typelen));
if ((mpierr = MPI_Bcast(&attlen, 1, MPI_OFFSET, ios->comproot, ios->my_comm)))
check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Bcast(&typelen, 1, MPI_OFFSET, ios->comproot, ios->my_comm)))
check_mpi(file, mpierr, __FILE__, __LINE__);
return check_mpi(file, mpierr, __FILE__, __LINE__);
LOG((2, "PIOc_get_att bcast complete attlen = %d typelen = %d", attlen, typelen));
}

Expand Down
13 changes: 6 additions & 7 deletions src/clib/pio_put_nc_async.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
/* 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__);
Expand Down Expand Up @@ -176,6 +169,12 @@ int PIOc_put_vars_tc(int ncid, int varid, const PIO_Offset *start, const PIO_Off
if (mpierr)
check_mpi(file, mpierr, __FILE__, __LINE__);
LOG((2, "PIOc_put_vars_tc checked mpierr = %d", mpierr));

/* Broadcast values currently only known on computation tasks to IO tasks. */
LOG((2, "PIOc_put_vars_tc bcast from comproot"));
if ((mpierr = MPI_Bcast(&ndims, 1, MPI_INT, ios->comproot, ios->my_comm)))
return check_mpi(file, mpierr, __FILE__, __LINE__);
LOG((2, "PIOc_put_vars_tc complete bcast from comproot ndims = %d", ndims));
}

/* If this is an IO task, then call the netCDF function. */
Expand Down

0 comments on commit 82d9faa

Please sign in to comment.