Skip to content

Instantly share code, notes, and snippets.

@goodell
Created April 26, 2012 21:17
Show Gist options
  • Select an option

  • Save goodell/2503321 to your computer and use it in GitHub Desktop.

Select an option

Save goodell/2503321 to your computer and use it in GitHub Desktop.
static int
write_NC(NC *ncp)
{
int status, mpireturn, rank;
void *buf;
MPI_Offset hsz; /* header size with 0-padding if needed */
MPI_Status mpistatus;
assert(!NC_readonly(ncp));
MPI_Comm_rank(ncp->nciop->comm, &rank);
if (NC_dofill(ncp)) { /* hsz is the header size with zero padding */
/* we don't need this, as these paddings will never be accessed */
hsz = MIN(ncp->begin_var, ncp->begin_rec);
hsz = MAX(hsz, ncp->xsz);
}
else
hsz = ncp->xsz;
buf = NCI_Malloc(hsz); /* header buffer for I/O */
if (hsz > ncp->xsz)
memset((char*)buf+ncp->xsz, 0, hsz - ncp->xsz);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment