Skip to content

Commit

Permalink
Merge pull request ESMCI#1358 from jedwards4b/type_size_fix
Browse files Browse the repository at this point in the history
Type size fix
  • Loading branch information
jedwards4b authored Mar 14, 2019
2 parents 6a9a3ff + 65c08f6 commit fdd9b6e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/clib/pio_nc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2045,10 +2045,13 @@ int PIOc_def_var(int ncid, const char *name, nc_type xtype, int ndims,
/* Get the MPI type corresponding with the PIO type. */
if ((ierr = find_mpi_type(xtype, &mpi_type, NULL)))
return pio_err(ios, NULL, ierr, __FILE__, __LINE__);

/* Get the size of the MPI type. */
if ((mpierr = MPI_Type_size(mpi_type, &mpi_type_size)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
if(mpi_type == MPI_DATATYPE_NULL)
mpi_type_size = 0;
else
if ((mpierr = MPI_Type_size(mpi_type, &mpi_type_size)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);

/* How many unlimited dims are present in the file? */
if ((ierr = PIOc_inq_unlimdims(ncid, &nunlimdims, NULL)))
Expand Down
8 changes: 5 additions & 3 deletions src/clib/pio_rearrange.c
Original file line number Diff line number Diff line change
Expand Up @@ -2047,9 +2047,11 @@ void performance_tune_rearranger(iosystem_desc_t *ios, io_desc_t *iodesc)
int mpierr; /* Return code for MPI calls. */

assert(iodesc);

if ((mpierr = MPI_Type_size(iodesc->mpitype, &tsize)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
if(iodesc->mpitype == MPI_DATATYPE_NULL)
tsize = 0;
else
if ((mpierr = MPI_Type_size(iodesc->mpitype, &tsize)))
return check_mpi(NULL, mpierr, __FILE__, __LINE__);
cbuf = NULL;
ibuf = NULL;
if (iodesc->ndof > 0)
Expand Down
14 changes: 10 additions & 4 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,8 +691,11 @@ int malloc_iodesc(iosystem_desc_t *ios, int piotype, int ndims,
(*iodesc)->mpitype = mpi_type;

/* Get the size of the type. */
if ((mpierr = MPI_Type_size((*iodesc)->mpitype, &(*iodesc)->mpitype_size)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);
if (mpi_type == MPI_DATATYPE_NULL)
(*iodesc)->mpitype_size = 0;
else
if ((mpierr = MPI_Type_size((*iodesc)->mpitype, &(*iodesc)->mpitype_size)))
return check_mpi2(ios, NULL, mpierr, __FILE__, __LINE__);

/* Initialize some values in the struct. */
(*iodesc)->maxregions = 1;
Expand Down Expand Up @@ -2077,8 +2080,11 @@ int inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars, int *
return pio_err(NULL, file, ret, __FILE__, __LINE__);

/* Get the size of the MPI type. */
if ((mpierr = MPI_Type_size((*mpi_type)[v], &(*mpi_type_size)[v])))
return check_mpi2(NULL, file, mpierr, __FILE__, __LINE__);
if ((*mpi_type)[v] == MPI_DATATYPE_NULL)
(*mpi_type_size)[v] = 0;
else
if ((mpierr = MPI_Type_size((*mpi_type)[v], &(*mpi_type_size)[v])))
return check_mpi2(NULL, file, mpierr, __FILE__, __LINE__);

/* What are the dimids associated with this var? */
if (var_ndims)
Expand Down

0 comments on commit fdd9b6e

Please sign in to comment.