Merge pull request #1293 from Unidata/pr-aggregation.wif

Y.A.A. (Yet Another Another Aggregation)
This commit is contained in:
Ward Fisher 2019-01-24 16:41:11 -07:00 committed by GitHub
commit 9b073894fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 141 additions and 133 deletions

View File

@ -750,7 +750,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4)
SET(H5_USE_16_API 0)
ENDIF()
FIND_PATH(HAVE_HDF5_H hdf5.h)
FIND_PATH(HAVE_HDF5_H hdf5.h PATHS ${HDF5_INCLUDE_DIR})
IF(NOT HAVE_HDF5_H)
MESSAGE(FATAL_ERROR "Compiling a test with hdf5 failed. Either hdf5.h cannot be found, or the log messages should be checked for another reason.")
ELSE(NOT HAVE_HDF5_H)

View File

@ -4,7 +4,6 @@
* See COPYRIGHT notice in top-level directory.
*
*********************************************************************/
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This example shows how to use nc_put_vara_int() to write a 2D 4-byte integer
* array in parallel and read it back using the same array partitioning pattern.
@ -81,7 +80,7 @@ int main(int argc, char** argv)
{
extern int optind;
char filename[128];
int i, j, rank, nprocs, verbose=1, err;
int i, j, rank, nprocs, err;
int ncid, cmode, omode, varid, dimid[2], buf[NY][NX];
char str_att[128];
float float_att[100];
@ -94,8 +93,7 @@ int main(int argc, char** argv)
/* get command-line arguments */
while ((i = getopt(argc, argv, "hq")) != EOF)
switch(i) {
case 'q': verbose = 0;
break;
case 'q': break;
case 'h':
default: if (rank==0) usage(argv[0]);
MPI_Finalize();

View File

@ -104,7 +104,7 @@ int hdf5_set_log_level();
/* These functions deal with HDF5 dimension scales. */
int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid);
int delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim);
int delete_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim);
/* Write metadata. */
int nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order);

View File

@ -153,7 +153,6 @@ nc4_get_att_special(NC_FILE_INFO_T* h5, const char* name,
int
NC4_HDF5_rename_att(int ncid, int varid, const char *name, const char *newname)
{
NC *nc;
NC_GRP_INFO_T *grp;
NC_FILE_INFO_T *h5;
NC_VAR_INFO_T *var = NULL;
@ -174,9 +173,9 @@ NC4_HDF5_rename_att(int ncid, int varid, const char *name, const char *newname)
return NC_EMAXNAME;
/* Find info for this file, group, and h5 info. */
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &h5)))
return retval;
assert(h5 && grp && h5);
assert(h5 && grp);
/* If the file is read-only, return an error. */
if (h5->no_write)

View File

@ -206,7 +206,6 @@ NC4_inq_dim(int ncid, int dimid, char *name, size_t *lenp)
int
NC4_rename_dim(int ncid, int dimid, const char *name)
{
NC *nc;
NC_GRP_INFO_T *grp;
NC_DIM_INFO_T *dim;
NC_HDF5_DIM_INFO_T *hdf5_dim;
@ -222,9 +221,9 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
dimid, name));
/* Find info for this file and group, and set pointer to each. */
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &h5)))
return retval;
assert(nc && h5 && grp);
assert(h5 && grp);
/* Trying to write to a read-only file? No way, Jose! */
if (h5->no_write)
@ -251,7 +250,7 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
LOG((3, "dim %s is a dim without variable", dim->hdr.name));
/* Delete the dimscale-only dataset. */
if ((retval = delete_existing_dimscale_dataset(grp, dimid, dim)))
if ((retval = delete_dimscale_dataset(grp, dimid, dim)))
return retval;
}
@ -262,8 +261,9 @@ NC4_rename_dim(int ncid, int dimid, const char *name)
if (!(dim->hdr.name = strdup(norm_name)))
return NC_ENOMEM;
LOG((3, "dim is now named %s", dim->hdr.name));
dim->hdr.hashkey = NC_hashmapkey(dim->hdr.name,strlen(dim->hdr.name)); /* Fix hash key */
/* Fix hash key and rebuild index. */
dim->hdr.hashkey = NC_hashmapkey(dim->hdr.name,strlen(dim->hdr.name));
if (!ncindexrebuild(grp->dim))
return NC_EINTERNAL;

View File

@ -539,7 +539,7 @@ NC4_enddef(int ncid)
LOG((1, "%s: ncid 0x%x", __func__, ncid));
/* Find pointer to group and nc4_info. */
if ((retval = nc4_find_nc_grp_h5(ncid, NULL, &grp, &nc4_info)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &nc4_info)))
return retval;
/* When exiting define mode, mark all variable written. */
@ -650,7 +650,6 @@ int
NC4_close(int ncid, void* params)
{
NC_GRP_INFO_T *grp;
NC *nc;
NC_FILE_INFO_T *h5;
int retval;
int inmemory;
@ -659,10 +658,10 @@ NC4_close(int ncid, void* params)
LOG((1, "%s: ncid 0x%x", __func__, ncid));
/* Find our metadata for this file. */
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &h5)))
return retval;
assert(nc && h5 && grp);
assert(h5 && grp);
/* This must be the root group. */
if (grp->parent)

View File

@ -346,8 +346,7 @@ nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var,
* @author Ed Hartnett
*/
int
delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid,
NC_DIM_INFO_T *dim)
delete_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim)
{
NC_HDF5_DIM_INFO_T *hdf5_dim;
NC_HDF5_GRP_INFO_T *hdf5_grp;

View File

@ -337,6 +337,8 @@ dimscale_visitor(hid_t did, unsigned dim, hid_t dsid,
{
H5G_stat_t statbuf;
LOG((4, "%s", __func__));
/* Get more info on the dimscale object.*/
if (H5Gget_objinfo(dsid, ".", 1, &statbuf) < 0)
return -1;
@ -1070,31 +1072,40 @@ get_attached_info(NC_VAR_INFO_T *var, NC_HDF5_VAR_INFO_T *hdf5_var, int ndims,
int d;
int num_scales = 0;
LOG((4, "%s ndims %d datasetid %ld", __func__, ndims, datasetid));
/* Find out how many scales are attached to this
* dataset. H5DSget_num_scales returns an error if there are no
* scales, so convert a negative return value to zero. */
num_scales = H5DSget_num_scales(datasetid, 0);
if (num_scales < 0)
num_scales = 0;
LOG((4, "num_scales %d", num_scales));
if (num_scales && ndims)
/* If an enddef has already been called, the dimscales will already
* be taken care of. */
if (num_scales && ndims && !var->dimscale_attached)
{
/* Allocate space to remember whether the dimscale has been
* attached for each dimension. */
* attached for each dimension, and the HDF5 object IDs of the
* scale(s). */
assert(!hdf5_var->dimscale_hdf5_objids);
if (!(var->dimscale_attached = calloc(ndims, sizeof(nc_bool_t))))
return NC_ENOMEM;
/* Store id information allowing us to match hdf5
* dimscales to netcdf dimensions. */
if (!(hdf5_var->dimscale_hdf5_objids = malloc(ndims *
sizeof(struct hdf5_objid))))
return NC_ENOMEM;
/* Store id information allowing us to match hdf5 dimscales to
* netcdf dimensions. */
for (d = 0; d < var->ndims; d++)
{
LOG((4, "about to iterate scales for dim %d", d));
if (H5DSiterate_scales(hdf5_var->hdf_datasetid, d, NULL, dimscale_visitor,
&(hdf5_var->dimscale_hdf5_objids[d])) < 0)
return NC_EHDFERR;
var->dimscale_attached[d] = NC_TRUE;
LOG((4, "dimscale attached"));
}
}
@ -1131,6 +1142,9 @@ get_scale_info(NC_GRP_INFO_T *grp, NC_DIM_INFO_T *dim, NC_VAR_INFO_T *var,
{
assert(ndims);
var->dimscale = NC_TRUE;
/* If this is a multi-dimensional coordinate var, then the
* dimids must be stored in the hidden coordinates attribute. */
if (var->ndims > 1)
{
if ((retval = read_coord_dimids(grp, var)))
@ -1138,6 +1152,7 @@ get_scale_info(NC_GRP_INFO_T *grp, NC_DIM_INFO_T *dim, NC_VAR_INFO_T *var,
}
else
{
/* This is a 1-dimensional coordinate var. */
assert(!strcmp(var->hdr.name, dim->hdr.name));
var->dimids[0] = dim->hdr.id;
var->dim[0] = dim;
@ -1176,7 +1191,7 @@ nc4_get_var_meta(NC_VAR_INFO_T *var)
int retval = NC_NOERR;
assert(var && var->format_var_info);
LOG((3, "%s: var %s", var->hdr.name));
LOG((3, "%s: var %s", __func__, var->hdr.name));
/* Have we already read the var metadata? */
if (var->meta_read)

View File

@ -52,20 +52,17 @@ NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
if ((typeid1 <= NC_STRING && typeid2 > NC_STRING) ||
(typeid2 <= NC_STRING && typeid1 > NC_STRING))
{
if (equalp) *equalp = 0;
*equalp = 0;
return NC_NOERR;
}
/* If both are atomic types, the answer is easy. */
if (typeid1 <= NUM_ATOMIC_TYPES)
{
if (equalp)
{
if (typeid1 == typeid2)
*equalp = 1;
else
*equalp = 0;
}
if (typeid1 == typeid2)
*equalp = 1;
else
*equalp = 0;
return NC_NOERR;
}
@ -80,7 +77,6 @@ NC4_inq_type_equal(int ncid1, nc_type typeid1, int ncid2,
return NC_EBADTYPE;
/* Are the two types equal? */
if (equalp)
{
hid_t hid1, hid2;

View File

@ -1034,23 +1034,21 @@ NC4_def_var_filter(int ncid, int varid, unsigned int id, size_t nparams,
int
NC4_rename_var(int ncid, int varid, const char *name)
{
NC *nc;
NC_GRP_INFO_T *grp;
NC_HDF5_GRP_INFO_T *hdf5_grp;
NC_FILE_INFO_T *h5;
NC_VAR_INFO_T *var, *tmpvar;
NC_VAR_INFO_T *var;
int retval = NC_NOERR;
if (!name)
return NC_EINVAL;
LOG((2, "%s: ncid 0x%x varid %d name %s", __func__, ncid, varid,
name));
LOG((2, "%s: ncid 0x%x varid %d name %s", __func__, ncid, varid, name));
/* Find info for this file and group, and set pointer to each. */
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &h5)))
return retval;
assert(h5 && grp && grp->format_grp_info && h5);
assert(h5 && grp && grp->format_grp_info);
/* Get HDF5-specific group info. */
hdf5_grp = (NC_HDF5_GRP_INFO_T *)grp->format_grp_info;
@ -1069,14 +1067,12 @@ NC4_rename_var(int ncid, int varid, const char *name)
return retval;
/* Get the variable wrt varid */
var = (NC_VAR_INFO_T*)ncindexith(grp->vars,varid);
if (!var)
if (!(var = (NC_VAR_INFO_T *)ncindexith(grp->vars, varid)))
return NC_ENOTVAR;
/* Check if new name is in use; note that renaming to same name is still an error
according to the nc_test/test_write.c code. Why?*/
tmpvar = (NC_VAR_INFO_T*)ncindexlookup(grp->vars,name);
if(tmpvar != NULL)
if (ncindexlookup(grp->vars, name))
return NC_ENAMEINUSE;
/* If we're not in define mode, new name must be of equal or
@ -1103,8 +1099,8 @@ NC4_rename_var(int ncid, int varid, const char *name)
* so, it must be deleted. */
if (hdf5_d0->hdf_dimscaleid)
{
if ((retval = delete_existing_dimscale_dataset(grp, var->dim[0]->hdr.id,
var->dim[0])))
if ((retval = delete_dimscale_dataset(grp, var->dim[0]->hdr.id,
var->dim[0])))
return retval;
}
}
@ -1119,12 +1115,14 @@ NC4_rename_var(int ncid, int varid, const char *name)
if (!(var->hdr.name = strdup(name)))
return NC_ENOMEM;
LOG((3, "var is now %s", var->hdr.name));
var->hdr.hashkey = NC_hashmapkey(var->hdr.name,strlen(var->hdr.name)); /* Fix hash key */
if(!ncindexrebuild(grp->vars))
/* Fix hash key and rebuild index. */
var->hdr.hashkey = NC_hashmapkey(var->hdr.name, strlen(var->hdr.name));
if (!ncindexrebuild(grp->vars))
return NC_EINTERNAL;
/* Check if this was a coordinate variable previously, but names are different now */
/* Check if this was a coordinate variable previously, but names
* are different now */
if (var->dimscale && strcmp(var->hdr.name, var->dim[0]->hdr.name))
{
/* Break up the coordinate variable */
@ -1132,24 +1130,25 @@ NC4_rename_var(int ncid, int varid, const char *name)
return retval;
}
/* Check if this should become a coordinate variable */
/* Check if this should become a coordinate variable. */
if (!var->dimscale)
{
/* Only variables with >0 dimensions can become coordinate variables */
/* Only variables with >0 dimensions can become coordinate
* variables. */
if (var->ndims)
{
NC_GRP_INFO_T *dim_grp;
NC_DIM_INFO_T *dim;
/* Check to see if this is became a coordinate variable. If so, it
* will have the same name as dimension index 0. If it is a
* coordinate var, is it a coordinate var in the same group as the dim?
*/
/* Check to see if this is became a coordinate variable. If
* so, it will have the same name as dimension index 0. If it
* is a coordinate var, is it a coordinate var in the same
* group as the dim? */
if ((retval = nc4_find_dim(grp, var->dimids[0], &dim, &dim_grp)))
return retval;
if (!strcmp(dim->hdr.name, name) && dim_grp == grp)
{
/* Reform the coordinate variable */
/* Reform the coordinate variable. */
if ((retval = nc4_reform_coord_var(grp, var, dim)))
return retval;
var->became_coord_var = NC_TRUE;

View File

@ -1466,13 +1466,14 @@ var_exists(hid_t grpid, char *name, nc_bool_t *exists)
* attribute which may be present, and, if it does, holds the dimid of
* the coordinate variable.
*
* @param hdf_datasetid The HDF5 dataset ID of the coordinate variable dataset.
* @param hdf_datasetid The HDF5 dataset ID of the coordinate variable
* dataset.
*
* @return ::NC_NOERR No error.
* @return ::NC_EHDFERR HDF5 error.
* @author Ed Hartnett
*/
int
static int
remove_coord_atts(hid_t hdf_datasetid)
{
htri_t attr_exists;
@ -1487,17 +1488,17 @@ remove_coord_atts(hid_t hdf_datasetid)
return NC_EHDFERR;
}
/* (We could do a better job here and verify that the attributes are
* really dimension scale 'CLASS' & 'NAME' attributes, but that would be
* poking about in the HDF5 DimScale internal data) */
if ((attr_exists = H5Aexists(hdf_datasetid, HDF5_DIMSCALE_CLASS_ATT_NAME)) < 0)
/* Remove the dimension scale 'CLASS' & 'NAME' attributes. */
if ((attr_exists = H5Aexists(hdf_datasetid,
HDF5_DIMSCALE_CLASS_ATT_NAME)) < 0)
return NC_EHDFERR;
if (attr_exists)
{
if (H5Adelete(hdf_datasetid, HDF5_DIMSCALE_CLASS_ATT_NAME) < 0)
return NC_EHDFERR;
}
if ((attr_exists = H5Aexists(hdf_datasetid, HDF5_DIMSCALE_NAME_ATT_NAME)) < 0)
if ((attr_exists = H5Aexists(hdf_datasetid,
HDF5_DIMSCALE_NAME_ATT_NAME)) < 0)
return NC_EHDFERR;
if (attr_exists)
{
@ -1612,37 +1613,34 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid)
* and delete dimscale attributes from the var. */
if (var->was_coord_var && var->dimscale_attached)
{
int d;
/* If the variable already exists in the file, Remove any dimension scale
* attributes from it, if they exist. */
if (var->created)
if ((retval = remove_coord_atts(hdf5_var->hdf_datasetid)))
return retval;
if (var->dimscale_attached)
/* If this is a regular var, detach all its dim scales. */
for (d = 0; d < var->ndims; d++)
{
int d;
/* If this is a regular var, detach all its dim scales. */
for (d = 0; d < var->ndims; d++)
if (var->dimscale_attached[d])
{
if (var->dimscale_attached[d])
{
hid_t dsid; /* Dataset ID for dimension */
assert(var->dim[d] && var->dim[d]->hdr.id == var->dimids[d] &&
var->dim[d]->format_dim_info);
hid_t dsid; /* Dataset ID for dimension */
assert(var->dim[d] && var->dim[d]->hdr.id == var->dimids[d] &&
var->dim[d]->format_dim_info);
/* Find dataset ID for dimension */
if (var->dim[d]->coord_var)
dsid = ((NC_HDF5_VAR_INFO_T *)var->dim[d]->coord_var->format_var_info)->hdf_datasetid;
else
dsid = ((NC_HDF5_DIM_INFO_T *)var->dim[d]->format_dim_info)->hdf_dimscaleid;
assert(dsid > 0);
/* Find dataset ID for dimension */
if (var->dim[d]->coord_var)
dsid = ((NC_HDF5_VAR_INFO_T *)var->dim[d]->coord_var->format_var_info)->hdf_datasetid;
else
dsid = ((NC_HDF5_DIM_INFO_T *)var->dim[d]->format_dim_info)->hdf_dimscaleid;
assert(dsid > 0);
/* Detach this dim scale. */
if (H5DSdetach_scale(hdf5_var->hdf_datasetid, dsid, d) < 0)
return NC_EHDFERR;
var->dimscale_attached[d] = NC_FALSE;
}
/* Detach this dim scale. */
if (H5DSdetach_scale(hdf5_var->hdf_datasetid, dsid, d) < 0)
return NC_EHDFERR;
var->dimscale_attached[d] = NC_FALSE;
}
}
}

View File

@ -32,7 +32,6 @@
int
NC4_inq_unlimdim(int ncid, int *unlimdimidp)
{
NC *nc;
NC_GRP_INFO_T *grp, *g;
NC_FILE_INFO_T *h5;
NC_DIM_INFO_T *dim;
@ -42,9 +41,9 @@ NC4_inq_unlimdim(int ncid, int *unlimdimidp)
LOG((2, "%s: called", __func__));
if ((retval = nc4_find_nc_grp_h5(ncid, &nc, &grp, &h5)))
if ((retval = nc4_find_grp_h5(ncid, &grp, &h5)))
return retval;
assert(h5 && nc && grp);
assert(h5 && grp);
if (unlimdimidp)
{

View File

@ -1431,12 +1431,11 @@ nc_set_log_level(int new_level)
* @param tab_count Number of tabs.
*
* @return ::NC_NOERR No error.
* @author Ed Hartnett
* @author Ed Hartnett, Dennis Heimbigner
*/
static int
rec_print_metadata(NC_GRP_INFO_T *grp, int tab_count)
{
NC_GRP_INFO_T *g;
NC_ATT_INFO_T *att;
NC_VAR_INFO_T *var;
NC_DIM_INFO_T *dim;
@ -1455,28 +1454,31 @@ rec_print_metadata(NC_GRP_INFO_T *grp, int tab_count)
LOG((2, "%s GROUP - %s nc_grpid: %d nvars: %d natts: %d",
tabs, grp->hdr.name, grp->hdr.id, ncindexsize(grp->vars), ncindexsize(grp->att)));
for(i=0;i<ncindexsize(grp->att);i++) {
att = (NC_ATT_INFO_T*)ncindexith(grp->att,i);
if(att == NULL) continue;
for (i = 0; i < ncindexsize(grp->att); i++)
{
att = (NC_ATT_INFO_T *)ncindexith(grp->att, i);
assert(att);
LOG((2, "%s GROUP ATTRIBUTE - attnum: %d name: %s type: %d len: %d",
tabs, att->hdr.id, att->hdr.name, att->nc_typeid, att->len));
}
for(i=0;i<ncindexsize(grp->dim);i++) {
dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,i);
if(dim == NULL) continue;
for (i = 0; i < ncindexsize(grp->dim); i++)
{
dim = (NC_DIM_INFO_T *)ncindexith(grp->dim, i);
assert(dim);
LOG((2, "%s DIMENSION - dimid: %d name: %s len: %d unlimited: %d",
tabs, dim->hdr.id, dim->hdr.name, dim->len, dim->unlimited));
}
for(i=0;i<ncindexsize(grp->vars);i++)
for (i = 0; i < ncindexsize(grp->vars); i++)
{
int j;
var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i);
if (var == NULL) continue;
if(var->ndims > 0)
assert(var);
if (var->ndims > 0)
{
dims_string = (char*)malloc(sizeof(char)*(var->ndims*4));
if (!(dims_string = malloc(sizeof(char) * var->ndims * 4)))
return NC_ENOMEM;
strcpy(dims_string, "");
for (d = 0; d < var->ndims; d++)
{
@ -1487,31 +1489,31 @@ rec_print_metadata(NC_GRP_INFO_T *grp, int tab_count)
LOG((2, "%s VARIABLE - varid: %d name: %s ndims: %d dimscale: %d dimids:%s",
tabs, var->hdr.id, var->hdr.name, var->ndims, (int)var->dimscale,
(dims_string ? dims_string : " -")));
for(j=0;j<ncindexsize(var->att);j++) {
att = (NC_ATT_INFO_T*)ncindexith(var->att,j);
if(att == NULL) continue;
for (j = 0; j < ncindexsize(var->att); j++)
{
att = (NC_ATT_INFO_T *)ncindexith(var->att, j);
assert(att);
LOG((2, "%s VAR ATTRIBUTE - attnum: %d name: %s type: %d len: %d",
tabs, att->hdr.id, att->hdr.name, att->nc_typeid, att->len));
}
if(dims_string)
{
if (dims_string)
free(dims_string);
dims_string = NULL;
}
}
for(i=0;i<ncindexsize(grp->type);i++)
for (i = 0; i < ncindexsize(grp->type); i++)
{
if((type = (NC_TYPE_INFO_T*)ncindexith(grp->type,i)) == NULL) continue;
LOG((2, "%s TYPE - nc_typeid: %d committed: %d name: %s num_fields: %d",
type = (NC_TYPE_INFO_T*)ncindexith(grp->type, i);
assert(type);
LOG((2, "%s TYPE - nc_typeid: %d size: %d committed: %d name: %s",
tabs, type->hdr.id, type->size, (int)type->committed, type->hdr.name));
/* Is this a compound type? */
if (type->nc_type_class == NC_COMPOUND)
{
int j;
LOG((3, "compound type"));
for(j=0;j<nclistlength(type->u.c.field);j++) {
field = (NC_FIELD_INFO_T*)nclistget(type->u.c.field,j);
for (j = 0; j < nclistlength(type->u.c.field); j++)
{
field = (NC_FIELD_INFO_T *)nclistget(type->u.c.field, j);
LOG((4, "field %s offset %d nctype %d ndims %d", field->hdr.name,
field->offset, field->nc_typeid, field->ndims));
}
@ -1536,12 +1538,11 @@ rec_print_metadata(NC_GRP_INFO_T *grp, int tab_count)
}
/* Call self for each child of this group. */
for(i=0;i<ncindexsize(grp->children);i++)
{
if((g = (NC_GRP_INFO_T*)ncindexith(grp->children,i)) == NULL) continue;
if ((retval = rec_print_metadata(g, tab_count + 1)))
for (i = 0; i < ncindexsize(grp->children); i++)
if ((retval = rec_print_metadata((NC_GRP_INFO_T *)ncindexith(grp->children, i),
tab_count + 1)))
return retval;
}
return NC_NOERR;
}

View File

@ -81,12 +81,11 @@ TESTS += run_pnetcdf_test.sh
endif
# The .c files that are generated with m4 are already distributed, but
# we also include the original m4 files, plus test scripts data.
EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh \
run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4 \
test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl run_inmemory.sh \
f03tst_open_mem.nc \
CMakeLists.txt
# we also include the original m4 files, plus test scripts and data.
EXTRA_DIST = test_get.m4 test_put.m4 run_diskless.sh run_diskless2.sh \
run_diskless5.sh run_mmap.sh run_pnetcdf_test.sh test_read.m4 \
test_write.m4 ref_tst_diskless2.cdl tst_diskless5.cdl run_inmemory.sh \
f03tst_open_mem.nc CMakeLists.txt
# These files are created by the tests.
CLEANFILES = nc_test_*.nc tst_*.nc t_nc.nc large_files.nc \

View File

@ -24,7 +24,6 @@
int main(int argc, char* argv[])
{
int err = 0;
int ecode = 0;
int ncid;
int cmode, format;

View File

@ -80,13 +80,13 @@ tst_knmi_SOURCES = tst_knmi.c tst_utils.c
tst_wrf_reads_SOURCES = tst_wrf_reads.c tst_utils.c
TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \
run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 tst_mem \
run_knmi_bm.sh tst_wrf_reads tst_attsperf
run_bm_test2.sh run_tst_chunks.sh tst_files3 tst_mem run_knmi_bm.sh \
tst_wrf_reads tst_attsperf
# tst_create_files creates files for other tests.
run_bm_test1.log: tst_create_files.log
run_bm_test2.log: tst_create_files.log
run_bm_elena.log: tst_create_files.log
run_bm_elena.log: tst_create_files.log tst_files.log
# This will run a parallel I/O benchmark for parallel builds.
if TEST_PARALLEL4

View File

@ -1,7 +1,10 @@
#!/bin/sh
# This shell runs some benchmarks that Elena ran as described here:
# http://hdfeos.org/workshops/ws06/presentations/Pourmal/HDF5_IO_Perf.pdf
# http://hdfeos.org/workshops/ws06/presentations/Pourmal/HDF5_IO_Perf.pdf. Also
# added tst_files2, which needs to be run from a script because it is
# dependant on tst_files being run first, and the dependency tacking
# only works for .sh tests.
# Ed Hartnett
@ -20,4 +23,8 @@ ${execdir}/bm_file -d -f 3 -o tst_elena_out.nc -c 0:-1:0:256:64:256 tst_elena_i
${execdir}/bm_file -d -f 3 -o tst_elena_out.nc -c 0:-1:0:256:256:256 tst_elena_int_3D.nc
echo '*** SUCCESS!!!'
echo ""
echo "*** Testing the benchmarking program tst_files2..."
${execdir}/tst_files2
echo '*** SUCCESS!!!'
exit 0

View File

@ -3,7 +3,7 @@
conditions of use.
This is a benchmark test which times how long it takes to create
some files.
some files. This program uses a file produced by tst_files.c.
Ed Hartnett
*/
@ -16,7 +16,7 @@
#define MAX_LEN 30
#define TMP_FILE_NAME "tst_files2_tmp.out"
#define FILE_NAME "tst_files2_1.nc"
#define FILE_NAME "tst_files2_1.nc" /* Created by tst_files.c. */
#define MILLION 1000000
void *last_sbrk;

View File

@ -2358,9 +2358,9 @@ main(int argc, char *argv[])
&formatting_specs.nc_extended,
&formatting_specs.nc_mode) );
if (kind_out) {
printf ("%s", kind_string(formatting_specs.nc_kind));
printf ("%s\n", kind_string(formatting_specs.nc_kind));
} else if (kind_out_extended) {
printf ("%s", kind_string_extended(formatting_specs.nc_extended,formatting_specs.nc_mode));
printf ("%s\n", kind_string_extended(formatting_specs.nc_extended,formatting_specs.nc_mode));
} else {
/* Initialize list of types. */
init_types(ncid);

View File

@ -58,7 +58,7 @@ fi
rm -f $NCF
rm -f $HDF
rm -f *.tmp
rm -f tst_fileinfo.tmp tst_fileinfo2.tmp
if test "x$EXIT" = x0 ; then
echo "*** Pass all tests"