Skip to content

Commit

Permalink
continuing to add ndims to var_desc_t
Browse files Browse the repository at this point in the history
  • Loading branch information
edhartnett committed Sep 6, 2019
1 parent 3d941c9 commit 9c4257d
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -2347,6 +2347,7 @@ inq_file_metadata(file_desc_t *file, int ncid, int iotype, int *nvars,
if ((ret = nc_inq_var(ncid, v, NULL, &my_type, &var_ndims, NULL, NULL)))
return pio_err(NULL, file, ret, __FILE__, __LINE__);
(*pio_type)[v] = (int)my_type;
(*ndim)[v] = var_ndims;
if ((ret = nc_inq_type(ncid, (*pio_type)[v], NULL, &type_size)))
return check_netcdf(file, ret, __FILE__, __LINE__);
(*pio_type_size)[v] = type_size;
Expand Down Expand Up @@ -2609,18 +2610,21 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
ierr = nc_open(filename, mode, &file->fh);
#else
imode = mode | NC_MPIIO;
if ((ierr = nc_open_par(filename, imode, ios->io_comm, ios->info, &file->fh)))
if ((ierr = nc_open_par(filename, imode, ios->io_comm, ios->info,
&file->fh)))
break;

/* Check the vars for valid use of unlim dims. */
if ((ierr = check_unlim_use(file->fh)))
break;

if ((ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF4P, &nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type, &mpi_type_size, &ndim)))
if ((ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF4P,
&nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type,
&mpi_type_size, &ndim)))
break;
PLOG((2, "PIOc_openfile_retry:nc_open_par filename = %s mode = %d imode = %d ierr = %d",
filename, mode, imode, ierr));
PLOG((2, "PIOc_openfile_retry:nc_open_par filename = %s mode = %d "
"imode = %d ierr = %d", filename, mode, imode, ierr));
#endif
break;

Expand All @@ -2632,8 +2636,10 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
/* Check the vars for valid use of unlim dims. */
if ((ierr = check_unlim_use(file->fh)))
break;
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF4C, &nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type, &mpi_type_size, &ndim);
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF4C,
&nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type,
&mpi_type_size, &ndim);
}
break;
#endif /* _NETCDF4 */
Expand All @@ -2643,8 +2649,10 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
{
if ((ierr = nc_open(filename, mode, &file->fh)))
break;
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF, &nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type, &mpi_type_size, &ndim);
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF,
&nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type,
&mpi_type_size, &ndim);
}
break;

Expand All @@ -2656,14 +2664,17 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
if (ierr == PIO_NOERR && (mode & PIO_WRITE))
{
if (ios->iomaster == MPI_ROOT)
PLOG((2, "%d Setting IO buffer %ld", __LINE__, pio_buffer_size_limit));
PLOG((2, "%d Setting IO buffer %ld", __LINE__,
pio_buffer_size_limit));
ierr = ncmpi_buffer_attach(file->fh, pio_buffer_size_limit);
}
PLOG((2, "ncmpi_open(%s) : fd = %d", filename, file->fh));

if (!ierr)
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_PNETCDF, &nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type, &mpi_type_size, &ndim);
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_PNETCDF,
&nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type,
&mpi_type_size, &ndim);
break;
#endif

Expand Down Expand Up @@ -2693,8 +2704,10 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
{
ierr = nc_open(filename, mode, &file->fh);
if (ierr == PIO_NOERR)
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF, &nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type, &mpi_type_size, &ndim);
ierr = inq_file_metadata(file, file->fh, PIO_IOTYPE_NETCDF,
&nvars, &rec_var, &pio_type,
&pio_type_size, &mpi_type,
&mpi_type_size, &ndim);
}
else
file->do_io = 0;
Expand Down Expand Up @@ -2747,6 +2760,8 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(mpi_type_size = malloc(nvars * sizeof(int))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
if (!(ndim = malloc(nvars * sizeof(int))))
return pio_err(ios, file, PIO_ENOMEM, __FILE__, __LINE__);
}
if (nvars)
{
Expand All @@ -2760,6 +2775,8 @@ PIOc_openfile_retry(int iosysid, int *ncidp, int *iotype, const char *filename,
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Bcast(mpi_type_size, nvars, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
if ((mpierr = MPI_Bcast(ndim, nvars, MPI_INT, ios->ioroot, ios->my_comm)))
return check_mpi(NULL, file, mpierr, __FILE__, __LINE__);
}

/* With the netCDF integration layer, the ncid is assigned for PIO
Expand Down

0 comments on commit 9c4257d

Please sign in to comment.