Skip to content

Commit

Permalink
some mpis dont allow MPI_DATATYPE_NULL in MPI_Type_size
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Mar 13, 2019
1 parent f28f46f commit ed8b6e4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ env:
- CPPFLAGS='-I/usr/include'
- CFLAGS='-std=c99'
- LDFLAGS='-L/usr/lib'

script:
- autoreconf -i
- ./configure
- make -j distcheck


branch:
- master
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 ed8b6e4

Please sign in to comment.