diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-17 12:45:55 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2010-09-17 12:45:55 (GMT) |
commit | 6747ebd9858374ae912b6182024861b1710518c8 (patch) | |
tree | 9bd75142d9dd292fe4272118f650f1c91205a988 /tools/h5repack/h5repacktst.c | |
parent | 9de3a84f916168831f29a4259fe93cb4823d8f57 (diff) | |
download | hdf5-6747ebd9858374ae912b6182024861b1710518c8.zip hdf5-6747ebd9858374ae912b6182024861b1710518c8.tar.gz hdf5-6747ebd9858374ae912b6182024861b1710518c8.tar.bz2 |
[svn-r19413] Description:
Bring r19349:19411 from trunk to revise_chunks branch.
Tested on:
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x,
w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x,
w/C++ & FORTRAN, in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, w/threadsafe, in production mode
Linux/PPC 2.6 (heiwa) w/C++ & FORTRAN, w/threadsafe, in debug mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in debug mode
Mac OS X/32 10.6.4 (amazon) in debug mode
Mac OS X/32 10.6.4 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
Mac OS X/32 10.6.4 (amazon) w/parallel, in debug mode
Diffstat (limited to 'tools/h5repack/h5repacktst.c')
-rw-r--r-- | tools/h5repack/h5repacktst.c | 89 |
1 files changed, 89 insertions, 0 deletions
diff --git a/tools/h5repack/h5repacktst.c b/tools/h5repack/h5repacktst.c index e329082..0567615 100644 --- a/tools/h5repack/h5repacktst.c +++ b/tools/h5repack/h5repacktst.c @@ -76,6 +76,9 @@ #define FNAME17 "h5repack_named_dtypes.h5" #define FNAME17OUT "h5repack_named_dtypes_out.h5" +#define FNAME18 "h5repack_layout2.h5" +#define FNAME18OUT "h5repack_layout2_out.h5" + #define FNAME_UB "ublock.bin" /* obj and region references */ @@ -120,6 +123,7 @@ static int make_attributes(hid_t loc_id); static int make_hlinks(hid_t loc_id); static int make_early(void); static int make_layout(hid_t loc_id); +static int make_layout2(hid_t loc_id); #ifdef H5_HAVE_FILTER_SZIP static int make_szip(hid_t loc_id); #endif /* H5_HAVE_FILTER_SZIP */ @@ -1692,6 +1696,19 @@ int make_testfiles(void) return -1; /*------------------------------------------------------------------------- + * create a file for layout conversion test + *------------------------------------------------------------------------- + */ + if((fid = H5Fcreate(FNAME18, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) + return -1; + + if(make_layout2(fid) < 0) + goto out; + + if(H5Fclose(fid) < 0) + return -1; + + /*------------------------------------------------------------------------- * create a file for the H5D_ALLOC_TIME_EARLY test *------------------------------------------------------------------------- */ @@ -2983,6 +3000,78 @@ out: } /*------------------------------------------------------------------------- + * Function: make_layout2 + * + * Purpose: create datasets with contiguous and chunked layouts: + * + * contig_small: < 1k, fixed dims datspace + * chunked_small_fixed: < 1k, fixed dims dataspace + * + *------------------------------------------------------------------------- + */ +#define S_DIM1 4 +#define S_DIM2 10 +#define CONTIG_S "contig_small" +#define CHUNKED_S_FIX "chunked_small_fixed" + +static +int make_layout2(hid_t loc_id) +{ + + hid_t contig_dcpl = -1; /* dataset creation property list */ + hid_t chunked_dcpl = -1; /* dataset creation property list */ + + int i, j, n; /* Local index variables */ + int ret_value = -1; /* Return value */ + hid_t s_sid = -1; /* dataspace ID */ + + hsize_t s_dims[RANK] = {S_DIM1,S_DIM2}; /* Dataspace (< 1 k) */ + hsize_t chunk_dims[RANK] = {S_DIM1/2, S_DIM2/2}; /* Dimension sizes for chunks */ + + int s_buf[S_DIM1][S_DIM2]; /* Temporary buffer */ + + for(i = n = 0; i < S_DIM1; i++) { + for (j = 0; j < S_DIM2; j++) { + s_buf[i][j] = n++; + } + } + + /* Create dataspaces */ + if((s_sid = H5Screate_simple(RANK, s_dims, NULL)) < 0) + goto out; + + /* Create contiguous datasets */ + if((contig_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_layout(contig_dcpl, H5D_CONTIGUOUS) < 0) + goto out; + if(make_dset(loc_id, CONTIG_S, s_sid, contig_dcpl, s_buf) < 0) + goto out; + + /* Create chunked datasets */ + if((chunked_dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) + goto out; + if(H5Pset_chunk(chunked_dcpl, RANK, chunk_dims) < 0) + goto out; + if(make_dset(loc_id, CHUNKED_S_FIX, s_sid, chunked_dcpl, s_buf) < 0) + goto out; + + ret_value = 0; + +out: + H5E_BEGIN_TRY { + H5Pclose(contig_dcpl); + H5Pclose(chunked_dcpl); + + H5Sclose(s_sid); + + } H5E_END_TRY; + + return(ret_value); + +} /* make_layout2() */ + +/*------------------------------------------------------------------------- * Function: make a file with an integer dataset with a fill value * * Purpose: test copy of fill values |