void AbstractHdf5Access::SetMainDatasetRawChunkCache() { // 128 M cache for raw data. 12799 is a prime number which is 100 x larger // than the number of 1 MB chunks (the largest we have tested with) which // could fit into the 128 M cache. 0.75 for the last argument is the default. // See: http://www.hdfgroup.org/HDF5/doc/RM/RM_H5P.html#Property-SetChunkCache hsize_t max_objects_in_chunk_cache = 12799u; hsize_t max_bytes_in_cache = 128u*1024u*1024u; #if H5_VERS_MAJOR>=1 && H5_VERS_MINOR>=8 && H5_VERS_RELEASE>=3 // HDF5 1.8.3+ // These methods set the cache on a dataset basis hid_t dapl_id = H5Dget_access_plist( mVariablesDatasetId ); H5Pset_chunk_cache( dapl_id, max_objects_in_chunk_cache , max_bytes_in_cache , H5D_CHUNK_CACHE_W0_DEFAULT); #else // These older methods set the cache on a file basis hid_t fapl_id = H5Fget_access_plist( mFileId ); H5Pset_cache( fapl_id, 0, // unused max_objects_in_chunk_cache, max_bytes_in_cache, 0.75); // default value #endif }
/*------------------------------------------------------------------------- * Function: test_diag * * Purpose: Reads windows diagonally across the dataset. Each window is * offset from the previous window by OFFSET in the x and y * directions. The reading ends after the (k,k) value is read * where k is the maximum index in the dataset. * * Return: Efficiency. * * Programmer: Robb Matzke * Friday, May 15, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static double test_diag (int op, size_t cache_size, size_t io_size, size_t offset) { hid_t file, dset, mem_space, file_space; hsize_t i, hs_size[2]; hsize_t nio = 0; hsize_t hs_offset[2]; signed char *buf = calloc (1, (size_t)(SQUARE (io_size))); #ifdef H5_WANT_H5_V1_4_COMPAT int mdc_nelmts, rdcc_nelmts; #else /* H5_WANT_H5_V1_4_COMPAT */ int mdc_nelmts; size_t rdcc_nelmts; #endif /* H5_WANT_H5_V1_4_COMPAT */ double w0; H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0); #ifdef DIAG_W0 w0 = DIAG_W0; #endif #ifdef DIAG_NRDCC rdcc_nelmts = DIAG_NRDCC; #endif H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts, cache_size*SQUARE (CH_SIZE), w0); file = H5Fopen (FILE_NAME, H5F_ACC_RDWR, fapl_g); dset = H5Dopen (file, "dset"); file_space = H5Dget_space (dset); nio_g = 0; for (i=0, hs_size[0]=io_size; hs_size[0]==io_size; i+=offset) { hs_offset[0] = hs_offset[1] = i; hs_size[0] = hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-i); mem_space = H5Screate_simple (2, hs_size, hs_size); H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); if (READ==op) { H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf); } else { H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf); } H5Sclose (mem_space); nio += hs_size[0]*hs_size[1]; if (i>0) nio -= SQUARE (io_size-offset); } free (buf); H5Sclose (file_space); H5Dclose (dset); H5Fclose (file); /* * The extra cast in the following statement is a bug workaround for the * Win32 version 5.0 compiler. * 1998-11-06 ptl */ return (double)(hssize_t)nio/(hssize_t)nio_g; }
//-------------------------------------------------------------------------- // Function: FileAccPropList::setCache ///\brief Sets the meta data cache and raw data chunk cache parameters. ///\param mdc_nelmts - IN: Number of elements in the meta data cache ///\param rdcc_nelmts - IN: Number of elements in the raw data chunk cache ///\param rdcc_nbytes - IN: Total size of the raw data chunk cache, in bytes ///\param rdcc_w0 - IN: Preemption policy ///\exception H5::PropListIException ///\par Description /// The argument \a rdcc_w0 should hold a value between 0 and 1 /// inclusive. This value indicates how much chunks that have /// been fully read are favored for preemption. A value of zero /// means fully read chunks are treated no differently than other /// chunks (the preemption is strictly LRU) while a value of one /// means fully read chunks are always preempted before other chunks. // Programmer: Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- void FileAccPropList::setCache( int mdc_nelmts, size_t rdcc_nelmts, size_t rdcc_nbytes, double rdcc_w0 ) const { herr_t ret_value = H5Pset_cache( id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0 ); if( ret_value < 0 ) { throw PropListIException("FileAccPropList::setCache", "H5Pset_cache failed"); } }
/*------------------------------------------------------------------------- * Function: test_rowmaj * * Purpose: Reads the entire dataset using the specified size-squared * I/O requests in row major order. * * Return: Efficiency: data requested divided by data actually read. * * Programmer: Robb Matzke * Thursday, May 14, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static double test_rowmaj (int op, size_t cache_size, size_t io_size) { hid_t file, dset, mem_space, file_space; signed char *buf = calloc (1, (size_t)(SQUARE(io_size))); hsize_t i, j, hs_size[2]; hsize_t hs_offset[2]; int mdc_nelmts; size_t rdcc_nelmts; double w0; H5Pget_cache (fapl_g, &mdc_nelmts, &rdcc_nelmts, NULL, &w0); #ifdef RM_W0 w0 = RM_W0; #endif #ifdef RM_NRDCC rdcc_nelmts = RM_NRDCC; #endif H5Pset_cache (fapl_g, mdc_nelmts, rdcc_nelmts, cache_size*SQUARE (CH_SIZE), w0); file = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_g); dset = H5Dopen2(file, "dset", H5P_DEFAULT); file_space = H5Dget_space(dset); nio_g = 0; for (i=0; i<CH_SIZE*DS_SIZE; i+=io_size) { #if 0 fprintf (stderr, "%5d\b\b\b\b\b", (int)i); fflush (stderr); #endif for (j=0; j<CH_SIZE*DS_SIZE; j+=io_size) { hs_offset[0] = i; hs_size[0] = MIN (io_size, CH_SIZE*DS_SIZE-i); hs_offset[1] = j; hs_size[1] = MIN (io_size, CH_SIZE*DS_SIZE-j); mem_space = H5Screate_simple (2, hs_size, hs_size); H5Sselect_hyperslab (file_space, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL); if (READ==op) { H5Dread (dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf); } else { H5Dwrite (dset, H5T_NATIVE_SCHAR, mem_space, file_space, H5P_DEFAULT, buf); } H5Sclose (mem_space); } } free (buf); H5Sclose (file_space); H5Dclose (dset); H5Fclose (file); return (double)SQUARE(CH_SIZE*DS_SIZE)/(double)nio_g; }
/*------------------------------------------------------------------------- * Function: disable_chunk_cache * * Purpose: Turns the chunk cache off * * Return: SUCCEED/FAIL * *------------------------------------------------------------------------- */ static herr_t disable_chunk_cache(hid_t fapl_id) { int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; if (H5Pget_cache(fapl_id, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) TEST_ERROR; rdcc_nbytes = 0; if (H5Pset_cache(fapl_id, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) TEST_ERROR; return SUCCEED; error: return FAIL; } /* end disable_chunk_cache() */
/*------------------------------------------------------------------------- * Function: main * * Purpose: Tests the plugin module (H5PL) * * Return: Success: exit(0) * * Failure: exit(1) * * Programmer: Raymond Lu * 14 March 2013 * *------------------------------------------------------------------------- */ int main(void) { char filename[FILENAME_BUF_SIZE]; hid_t file, fapl, fapl2; hbool_t new_format; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; int nerrors = 0; /* Testing setup */ h5_reset(); fapl = h5_fileaccess(); /* Turn off the chunk cache, so all the chunks are immediately written to disk */ if(H5Pget_cache(fapl, &mdc_nelmts, &rdcc_nelmts, &rdcc_nbytes, &rdcc_w0) < 0) TEST_ERROR rdcc_nbytes = 0; if(H5Pset_cache(fapl, mdc_nelmts, rdcc_nelmts, rdcc_nbytes, rdcc_w0) < 0) TEST_ERROR /* Copy the file access property list */ if((fapl2 = H5Pcopy(fapl)) < 0) TEST_ERROR /* Set the "use the latest version of the format" bounds for creating objects in the file */ if(H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) TEST_ERROR h5_fixname(FILENAME[0], fapl, filename, sizeof filename); /* Test with old & new format groups */ for(new_format = FALSE; new_format <= TRUE; new_format++) { hid_t my_fapl; /* Set the FAPL for the type of format */ if(new_format) { puts("\nTesting with new file format:"); my_fapl = fapl2; } /* end if */ else { puts("Testing with old file format:"); my_fapl = fapl; } /* end else */ /* Create the file for this test */ if((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, my_fapl)) < 0) TEST_ERROR /* Test dynamically loaded filters for chunked dataset */ nerrors += (test_filters_for_datasets(file) < 0 ? 1 : 0); /* Test dynamically loaded filters for groups */ nerrors += (test_filters_for_groups(file) < 0 ? 1 : 0); if(H5Fclose(file) < 0) TEST_ERROR } /* end for */ /* Close FAPL */ if(H5Pclose(fapl2) < 0) TEST_ERROR if(H5Pclose(fapl) < 0) TEST_ERROR puts("\nTesting reading data with with dynamic plugin filters:"); /* Close the library so that all loaded plugin libraries are unloaded */ h5_reset(); fapl = h5_fileaccess(); /* Reopen the file for testing data reading */ if((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) TEST_ERROR /* Read the data with filters */ nerrors += (test_read_with_filters(file) < 0 ? 1 : 0); /* Open the groups with filters */ nerrors += (test_groups_with_filters(file) < 0 ? 1 : 0); if(H5Fclose(file) < 0) TEST_ERROR if(nerrors) TEST_ERROR printf("All plugin tests passed.\n"); h5_cleanup(FILENAME, fapl); return 0; error: nerrors = MAX(1, nerrors); printf("***** %d PLUGIN TEST%s FAILED! *****\n", nerrors, 1 == nerrors ? "" : "S"); return 1; }
int main() { printf("\n*** Checking HDF5 attribute functions some more.\n"); printf("*** Creating tst_xplatform2_3.nc with HDF only..."); { hid_t fapl_id, fcpl_id; size_t chunk_cache_size = MY_CHUNK_CACHE_SIZE; size_t chunk_cache_nelems = CHUNK_CACHE_NELEMS; float chunk_cache_preemption = CHUNK_CACHE_PREEMPTION; hid_t fileid, grpid, attid, spaceid; hid_t s1_typeid, vlen_typeid, s3_typeid; hid_t file_typeid1[NUM_OBJ], native_typeid1[NUM_OBJ]; hid_t file_typeid2, native_typeid2; hsize_t num_obj; H5O_info_t obj_info; char obj_name[STR_LEN + 1]; hsize_t dims[1] = {ATT_LEN}; /* netcdf attributes always 1-D. */ struct s1 { float x; double y; }; struct s3 { hvl_t data[NUM_VL]; }; /* cvc stands for "Compound with Vlen of Compound." */ struct s3 cvc_out[ATT_LEN]; int i, j, k; /* Create some output data: a struct s3 array (length ATT_LEN) * which holds an array of vlen (length NUM_VL) of struct s1. */ for (i = 0; i < ATT_LEN; i++) for (j = 0; j < NUM_VL; j++) { cvc_out[i].data[j].len = i + 1; if (!(cvc_out[i].data[j].p = calloc(sizeof(struct s1), cvc_out[i].data[j].len))) ERR; for (k = 0; k < cvc_out[i].data[j].len; k++) { ((struct s1 *)cvc_out[i].data[j].p)[k].x = 42.42; ((struct s1 *)cvc_out[i].data[j].p)[k].y = 2.0; } } /* Create the HDF5 file, with cache control, creation order, and * all the timmings. */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; if (H5Pset_cache(fapl_id, 0, chunk_cache_nelems, chunk_cache_size, chunk_cache_preemption) < 0) ERR; if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR; if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; if (H5Pclose(fcpl_id) < 0) ERR; /* Open the root group. */ if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; /* Create the compound type for struct s1. */ if ((s1_typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s1))) < 0) ERR; if (H5Tinsert(s1_typeid, X_NAME, offsetof(struct s1, x), H5T_NATIVE_FLOAT) < 0) ERR; if (H5Tinsert(s1_typeid, Y_NAME, offsetof(struct s1, y), H5T_NATIVE_DOUBLE) < 0) ERR; if (H5Tcommit(grpid, S1_TYPE_NAME, s1_typeid) < 0) ERR; /* Create a vlen type. Its a vlen of struct s1. */ if ((vlen_typeid = H5Tvlen_create(s1_typeid)) < 0) ERR; if (H5Tcommit(grpid, VLEN_TYPE_NAME, vlen_typeid) < 0) ERR; /* Create the struct s3 type, which contains the vlen. */ if ((s3_typeid = H5Tcreate(H5T_COMPOUND, sizeof(struct s3))) < 0) ERR; if (H5Tinsert(s3_typeid, VL_NAME, offsetof(struct s3, data), vlen_typeid) < 0) ERR; if (H5Tcommit(grpid, S3_TYPE_NAME, s3_typeid) < 0) ERR; /* Create an attribute of this new type. */ if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR; if ((attid = H5Acreate(grpid, S3_ATT_NAME, s3_typeid, spaceid, H5P_DEFAULT)) < 0) ERR; if (H5Awrite(attid, s3_typeid, cvc_out) < 0) ERR; /* Close the types. */ if (H5Tclose(s1_typeid) < 0 || H5Tclose(vlen_typeid) < 0 || H5Tclose(s3_typeid) < 0) ERR; /* Close the att. */ if (H5Aclose(attid) < 0) ERR; /* Close the space. */ if (H5Sclose(spaceid) < 0) ERR; /* Close the group and file. */ if (H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; /* Reopen the file. */ if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; /* How many objects in this group? (There should be 3, the * types. Atts don't count as objects to HDF5.) */ if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; if (num_obj != NUM_OBJ) ERR; /* For each object in the group... */ for (i = 0; i < num_obj; i++) { /* Get the name, and make sure this is a type. */ if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0) ERR; if (H5Lget_name_by_idx(grpid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, STR_LEN + 1, H5P_DEFAULT) < 0) ERR; if (obj_info.type != H5O_TYPE_NAMED_DATATYPE) ERR; /* Get the typeid and native typeid. */ if ((file_typeid1[i] = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR; if ((native_typeid1[i] = H5Tget_native_type(file_typeid1[i], H5T_DIR_DEFAULT)) < 0) ERR; } /* There is one att: open it by index. */ if ((attid = H5Aopen_idx(grpid, 0)) < 0) ERR; /* Get file and native typeids of the att. */ if ((file_typeid2 = H5Aget_type(attid)) < 0) ERR; if ((native_typeid2 = H5Tget_native_type(file_typeid2, H5T_DIR_DEFAULT)) < 0) ERR; /* Close the attribute. */ if (H5Aclose(attid) < 0) ERR; /* Close the typeids. */ for (i = 0; i < NUM_OBJ; i++) { if (H5Tclose(file_typeid1[i]) < 0) ERR; if (H5Tclose(native_typeid1[i]) < 0) ERR; } if (H5Tclose(file_typeid2) < 0) ERR; if (H5Tclose(native_typeid2) < 0) ERR; /* Close the group and file. */ if (H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; /* Deallocate our vlens. */ for (i = 0; i < ATT_LEN; i++) for (j = 0; j < NUM_VL; j++) free(cvc_out[i].data[j].p); } SUMMARIZE_ERR; printf("*** Checking vlen of compound file..."); { #define NUM_OBJ_1 1 #define ATT_NAME "Poseidon" hid_t fapl_id, fcpl_id; hid_t fileid, grpid, attid, spaceid; hid_t vlen_typeid; hid_t file_typeid1[NUM_OBJ_1], native_typeid1[NUM_OBJ_1]; hid_t file_typeid2, native_typeid2; hsize_t num_obj; H5O_info_t obj_info; char obj_name[STR_LEN + 1]; hsize_t dims[1] = {ATT_LEN}; /* netcdf attributes always 1-D. */ /* vc stands for "Vlen of Compound." */ hvl_t vc_out[ATT_LEN]; int i, k; /* Create some output data: an array of vlen (length ATT_LEN) of * int. */ for (i = 0; i < ATT_LEN; i++) { vc_out[i].len = i + 1; if (!(vc_out[i].p = calloc(sizeof(int), vc_out[i].len))) ERR; for (k = 0; k < vc_out[i].len; k++) ((int *)vc_out[i].p)[k] = 42; } /* Create the HDF5 file with creation order. */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; if (H5Pclose(fcpl_id) < 0) ERR; /* Open the root group. */ if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; /* Create a vlen type. Its a vlen of int. */ if ((vlen_typeid = H5Tvlen_create(H5T_NATIVE_INT)) < 0) ERR; if (H5Tcommit(grpid, VLEN_TYPE_NAME, vlen_typeid) < 0) ERR; /* Create an attribute of this new type. */ if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0) ERR; if ((attid = H5Acreate(grpid, ATT_NAME, vlen_typeid, spaceid, H5P_DEFAULT)) < 0) ERR; if (H5Awrite(attid, vlen_typeid, vc_out) < 0) ERR; /* Close the type. */ if (H5Tclose(vlen_typeid) < 0) ERR; /* Close the att. */ if (H5Aclose(attid) < 0) ERR; /* Close the space. */ if (H5Sclose(spaceid) < 0) ERR; /* Close the group and file. */ if (H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; /* Reopen the file. */ if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR; if ((grpid = H5Gopen(fileid, "/")) < 0) ERR; /* How many objects in this group? (There should be 2, the * types. Atts don't count as objects to HDF5.) */ if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; if (num_obj != NUM_OBJ_1) ERR; /* For each object in the group... */ for (i = 0; i < num_obj; i++) { /* Get the name, and make sure this is a type. */ if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i, &obj_info, H5P_DEFAULT) < 0) ERR; if (H5Lget_name_by_idx(grpid, ".", H5_INDEX_NAME, H5_ITER_INC, i, obj_name, STR_LEN + 1, H5P_DEFAULT) < 0) ERR; if (obj_info.type != H5O_TYPE_NAMED_DATATYPE) ERR; /* Get the typeid and native typeid. */ if ((file_typeid1[i] = H5Topen2(grpid, obj_name, H5P_DEFAULT)) < 0) ERR; if ((native_typeid1[i] = H5Tget_native_type(file_typeid1[i], H5T_DIR_DEFAULT)) < 0) ERR; } /* There is one att: open it by index. */ if ((attid = H5Aopen_idx(grpid, 0)) < 0) ERR; /* Get file and native typeids of the att. */ if ((file_typeid2 = H5Aget_type(attid)) < 0) ERR; if ((native_typeid2 = H5Tget_native_type(file_typeid2, H5T_DIR_DEFAULT)) < 0) ERR; /* Close the attribute. */ if (H5Aclose(attid) < 0) ERR; /* Close the typeids. */ for (i = 0; i < NUM_OBJ_1; i++) { if (H5Tclose(file_typeid1[i]) < 0) ERR; if (H5Tclose(native_typeid1[i]) < 0) ERR; } if (H5Tclose(file_typeid2) < 0) ERR; if (H5Tclose(native_typeid2) < 0) ERR; /* Close the group and file. */ if (H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; /* Deallocate our vlens. */ for (i = 0; i < ATT_LEN; i++) free(vc_out[i].p); } SUMMARIZE_ERR; FINAL_RESULTS; }
int main() { printf("\n*** Checking HDF5 file functions.\n"); printf("*** Creating HDF5 file in the canonical netCDF-4 way..."); { hid_t fapl_id, fcpl_id, fileid, grpid, fileid2; hsize_t num_obj; /* Create file access and create property lists. */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; /* Set latest_format in access propertly list. This ensures that * the latest, greatest, HDF5 versions are used in the file. */ /* if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0) ERR;*/ /* Set H5P_CRT_ORDER_TRACKED in the creation property list. This * turns on HDF5 creation ordering in the file. */ if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; /* Set close degree. */ if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; /* Create the file. */ if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; /* Open the root group. */ if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; /* Close up. */ if (H5Pclose(fapl_id) < 0 || H5Pclose(fcpl_id) < 0 || H5Gclose(grpid) < 0 || H5Fclose(fileid) < 0) ERR; /* Reopen the file and check it. */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_id)) < 0) ERR; if (H5Gget_num_objs(fileid, &num_obj) < 0) ERR; if (num_obj) ERR; /* Open another copy of the same file. Must use the same file * access degree or HDF5 will not open the file. */ if ((fileid2 = H5Fopen(FILE_NAME, H5F_ACC_RDWR, fapl_id)) < 0) ERR; if (H5Fclose(fileid) < 0) ERR; if (H5Fclose(fileid2) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; } SUMMARIZE_ERR; printf("*** Opening a HDF5 file with H5Literate..."); { hid_t fapl_id, fileid, grpid; hsize_t idx = 0; char obj_name[STR_LEN + 1]; hsize_t num_obj; int i; if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; if (H5Pset_cache(fapl_id, 0, CHUNK_CACHE_NELEMS, CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR; if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, fapl_id)) < 0) ERR; if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; for (i = 0; i < num_obj; i++) { if (H5Literate(grpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, &idx, op_func, (void *)obj_name) != 1) ERR; printf("encountered object %s\n", obj_name); } if (H5Gclose(grpid) < 0) ERR; if (H5Fclose(fileid) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; } SUMMARIZE_ERR; printf("*** Opening a HDF5 file in the canonical netCDF-4 way..."); { hid_t fapl_id, fileid, grpid; H5_index_t idx_field = H5_INDEX_CRT_ORDER; H5O_info_t obj_info; hsize_t num_obj; ssize_t size; char obj_name[STR_LEN + 1]; int i; if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; if (H5Pset_cache(fapl_id, 0, CHUNK_CACHE_NELEMS, CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR; if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDONLY, fapl_id)) < 0) ERR; if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; /* How many objects in this group? */ if (H5Gget_num_objs(grpid, &num_obj) < 0) ERR; for (i = 0; i < num_obj; i++) { if (H5Oget_info_by_idx(grpid, ".", H5_INDEX_CRT_ORDER, H5_ITER_INC, i, &obj_info, H5P_DEFAULT)) ERR; if ((size = H5Lget_name_by_idx(grpid, ".", idx_field, H5_ITER_INC, i, NULL, 0, H5P_DEFAULT)) < 0) ERR; if (H5Lget_name_by_idx(grpid, ".", idx_field, H5_ITER_INC, i, obj_name, size+1, H5P_DEFAULT) < 0) ERR; } if (H5Gclose(grpid) < 0) ERR; if (H5Fclose(fileid) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; } SUMMARIZE_ERR; FINAL_RESULTS; }
int main() { printf("\n*** Checking HDF5 dimscales detach.\n"); printf("*** Creating a file with two vars with one dimension scale..."); { #if 0 hid_t cparmsid; #endif hid_t fileid, grpid, spaceid, var1_id, var2_id, dimscaleid; hid_t fcpl_id, fapl_id, create_propid, access_propid; hsize_t dims[NDIMS] = {DIM_LEN}; char dimscale_wo_var[STR_LEN]; float data = 42; /* Create file. */ if ((fapl_id = H5Pcreate(H5P_FILE_ACCESS)) < 0) ERR; if (H5Pset_fclose_degree(fapl_id, H5F_CLOSE_STRONG)) ERR; if (H5Pset_cache(fapl_id, 0, CHUNK_CACHE_NELEMS, CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR; if (H5Pset_libver_bounds(fapl_id, H5F_LIBVER_18, H5F_LIBVER_18) < 0) ERR; if ((fcpl_id = H5Pcreate(H5P_FILE_CREATE)) < 0) ERR; if (H5Pset_link_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if (H5Pset_attr_creation_order(fcpl_id, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)) < 0) ERR; if ((fileid = H5Fcreate(FILE_NAME, H5F_ACC_TRUNC, fcpl_id, fapl_id)) < 0) ERR; if (H5Pclose(fapl_id) < 0) ERR; if (H5Pclose(fcpl_id) < 0) ERR; if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; /* Create dimension scale. */ if ((create_propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR; if (H5Pset_attr_creation_order(create_propid, H5P_CRT_ORDER_TRACKED| H5P_CRT_ORDER_INDEXED) < 0) ERR; if ((spaceid = H5Screate_simple(1, dims, dims)) < 0) ERR; if ((dimscaleid = H5Dcreate1(grpid, DIMSCALE_NAME, H5T_IEEE_F32BE, spaceid, create_propid)) < 0) ERR; if (H5Sclose(spaceid) < 0) ERR; if (H5Pclose(create_propid) < 0) ERR; sprintf(dimscale_wo_var, "%s%10d", DIM_WITHOUT_VARIABLE, DIM_LEN); if (H5DSset_scale(dimscaleid, dimscale_wo_var) < 0) ERR; /* Create a variable that uses this dimension scale. */ if ((access_propid = H5Pcreate(H5P_DATASET_ACCESS)) < 0) ERR; if (H5Pset_chunk_cache(access_propid, CHUNK_CACHE_NELEMS, CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR; if ((create_propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR; if (H5Pset_fill_value(create_propid, H5T_NATIVE_FLOAT, &data) < 0) ERR; if (H5Pset_layout(create_propid, H5D_CONTIGUOUS) < 0) ERR; if (H5Pset_attr_creation_order(create_propid, H5P_CRT_ORDER_TRACKED| H5P_CRT_ORDER_INDEXED) < 0) ERR; if ((spaceid = H5Screate_simple(NDIMS, dims, dims)) < 0) ERR; if ((var1_id = H5Dcreate2(grpid, VAR1_NAME, H5T_NATIVE_FLOAT, spaceid, H5P_DEFAULT, create_propid, access_propid)) < 0) ERR; if (H5Pclose(create_propid) < 0) ERR; if (H5Pclose(access_propid) < 0) ERR; if (H5Sclose(spaceid) < 0) ERR; if (H5DSattach_scale(var1_id, dimscaleid, 0) < 0) ERR; /* Create another variable that uses this dimension scale. */ if ((access_propid = H5Pcreate(H5P_DATASET_ACCESS)) < 0) ERR; if (H5Pset_chunk_cache(access_propid, CHUNK_CACHE_NELEMS, CHUNK_CACHE_SIZE, CHUNK_CACHE_PREEMPTION) < 0) ERR; if ((create_propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) ERR; if (H5Pset_fill_value(create_propid, H5T_NATIVE_FLOAT, &data) < 0) ERR; if (H5Pset_layout(create_propid, H5D_CONTIGUOUS) < 0) ERR; if (H5Pset_attr_creation_order(create_propid, H5P_CRT_ORDER_TRACKED| H5P_CRT_ORDER_INDEXED) < 0) ERR; if ((spaceid = H5Screate_simple(NDIMS, dims, dims)) < 0) ERR; if ((var2_id = H5Dcreate2(grpid, VAR2_NAME, H5T_NATIVE_FLOAT, spaceid, H5P_DEFAULT, create_propid, access_propid)) < 0) ERR; if (H5Pclose(create_propid) < 0) ERR; if (H5Pclose(access_propid) < 0) ERR; if (H5Sclose(spaceid) < 0) ERR; if (H5DSattach_scale(var2_id, dimscaleid, 0) < 0) ERR; /* Now detach the scales and remove the dimscale. This doesn't * work if I reverse the order of the statements. */ if (H5DSdetach_scale(var2_id, dimscaleid, 0) < 0) ERR; if (H5DSdetach_scale(var1_id, dimscaleid, 0) < 0) ERR; /* Fold up our tents. */ if (H5Dclose(var1_id) < 0) ERR; if (H5Dclose(dimscaleid) < 0) ERR; if (H5Gclose(grpid) < 0) ERR; if (H5Fclose(fileid) < 0) ERR; /* /\* Now read the file and check it. *\/ */ /* { */ /* hid_t fileid, spaceid = 0, datasetid = 0; */ /* hsize_t num_obj, i; */ /* int obj_class; */ /* char obj_name[STR_LEN + 1]; */ /* char dimscale_name[STR_LEN+1]; */ /* htri_t is_scale; */ /* char label[STR_LEN+1]; */ /* int num_scales; */ /* hsize_t dims[1], maxdims[1]; */ /* H5G_stat_t statbuf; */ /* HDF5_OBJID_T dimscale_obj, vars_dimscale_obj; */ /* struct nc_hdf5_link_info link_info; */ /* hsize_t idx = 0; */ /* /\* Open the file. *\/ */ /* if ((fileid = H5Fopen(FILE_NAME, H5F_ACC_RDWR, H5P_DEFAULT)) < 0) ERR; */ /* if ((grpid = H5Gopen2(fileid, "/", H5P_DEFAULT)) < 0) ERR; */ /* /\* Loop through objects in the root group. *\/ */ /* if (H5Gget_num_objs(fileid, &num_obj) < 0) ERR; */ /* for (i = 0; i < num_obj; i++) */ /* { */ /* if (H5Literate(grpid, H5_INDEX_CRT_ORDER, H5_ITER_INC, */ /* &idx, visit_link, (void *)&link_info) < 0) ERR; */ /* printf("Encountered: HDF5 object link_info.name %s\n", link_info.name); */ /* /\* Deal with object based on its obj_class. *\/ */ /* switch(link_info.obj_type) */ /* { */ /* case H5I_GROUP: */ /* break; */ /* case H5I_DATASET: */ /* /\* Open the dataset. *\/ */ /* if ((datasetid = H5Dopen1(fileid, link_info.name)) < 0) ERR; */ /* if ((spaceid = H5Dget_space(datasetid)) < 0) ERR; */ /* if (H5Sget_simple_extent_dims(spaceid, dims, maxdims) < 0) ERR; */ /* if (maxdims[0] != DIM_LEN) ERR; */ /* if (H5Sclose(spaceid) < 0) ERR; */ /* /\* Is this a dimscale? *\/ */ /* if ((is_scale = H5DSis_scale(datasetid)) < 0) ERR; */ /* if (is_scale && strcmp(link_info.name, DIMSCALE_NAME)) ERR; */ /* if (is_scale) */ /* { */ /* /\* A dimscale comes with a NAME attribute, in */ /* * addition to its real name. *\/ */ /* if (H5DSget_scale_name(datasetid, dimscale_name, STR_LEN) < 0) ERR; */ /* if (strcmp(dimscale_name, dimscale_wo_var)) ERR; */ /* /\* fileno and objno uniquely identify an object and a */ /* * HDF5 file. *\/ */ /* if (H5Gget_objinfo(datasetid, ".", 1, &statbuf) < 0) ERR; */ /* dimscale_obj.fileno[0] = statbuf.fileno[0]; */ /* dimscale_obj.objno[0] = statbuf.objno[0]; */ /* dimscale_obj.fileno[1] = statbuf.fileno[1]; */ /* dimscale_obj.objno[1] = statbuf.objno[1]; */ /* /\*printf("scale statbuf.fileno = %d statbuf.objno = %d\n", */ /* statbuf.fileno, statbuf.objno);*\/ */ /* } */ /* else */ /* { */ /* /\* Here's how to get the number of scales attached */ /* * to the dataset's dimension 0. *\/ */ /* if ((num_scales = H5DSget_num_scales(datasetid, 0)) < 0) ERR; */ /* if (num_scales != 1) ERR; */ /* /\* Go through all dimscales for this var and learn about them. *\/ */ /* if (H5DSiterate_scales(datasetid, 0, NULL, alien_visitor, */ /* &vars_dimscale_obj) < 0) ERR; */ /* /\*printf("vars_dimscale_obj.fileno = %d vars_dimscale_obj.objno = %d\n", */ /* vars_dimscale_obj.fileno, vars_dimscale_obj.objno);*\/ */ /* /\* if (vars_dimscale_obj.fileno[0] != dimscale_obj.fileno[0] || *\/ */ /* /\* vars_dimscale_obj.objno[0] != dimscale_obj.objno[0] || *\/ */ /* /\* vars_dimscale_obj.fileno[1] != dimscale_obj.fileno[1] || *\/ */ /* /\* vars_dimscale_obj.objno[1] != dimscale_obj.objno[1]) ERR; *\/ */ /* /\* There's also a label for dimension 0. *\/ */ /* if (H5DSget_label(datasetid, 0, label, STR_LEN) < 0) ERR; */ /* /\*printf("found non-scale dataset %s, label %s\n", link_info.name, label);*\/ */ /* } */ /* if (H5Dclose(datasetid) < 0) ERR; */ /* break; */ /* case H5I_DATATYPE: */ /* break; */ /* default: */ /* printf("Unknown object!"); */ /* ERR; */ /* } */ /* } */ /* /\* Close up the shop. *\/ */ /* if (H5Fclose(fileid) < 0) ERR; */ /* }*/ } SUMMARIZE_ERR; FINAL_RESULTS; }
/*------------------------------------------------------------------------- * Function: test * * Purpose: The guts of the test * * Return: Success: 0 * * Failure: number of errors * * Programmer: Robb Matzke * Wednesday, September 30, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static int test(fill_t fill_style, const double splits[], hbool_t verbose, hbool_t use_rdcc) { hid_t file = (-1), fapl = (-1), dcpl = (-1), xfer = (-1), mspace = (-1), fspace = (-1), dset = (-1); hsize_t ch_size[1] = {1}; /*chunk size */ hsize_t cur_size[1] = {1000}; /*current dataset size */ hsize_t max_size[1] = {H5S_UNLIMITED}; /*maximum dataset size */ hsize_t hs_start[1]; /*hyperslab start offset*/ hsize_t hs_count[1] = {1}; /*hyperslab nelmts */ int fd = (-1); /*h5 file direct */ int *had = NULL; /*for random filling */ const char *sname=NULL; /*fill style nam */ int mdc_nelmts; /*num meta objs to cache*/ hsize_t i; int j; h5_stat_t sb; if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; if(!use_rdcc) { if(H5Pget_cache(fapl, &mdc_nelmts, NULL, NULL, NULL) < 0) goto error; if(H5Pset_cache(fapl, mdc_nelmts, 0, 0, 0.0F) < 0) goto error; } if((file = H5Fcreate(FILE_NAME_1, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) goto error; if((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0) goto error; if(H5Pset_chunk(dcpl, 1, ch_size) < 0) goto error; if((xfer = H5Pcreate(H5P_DATASET_XFER)) < 0) goto error; if(H5Pset_btree_ratios(xfer, splits[0], splits[1], splits[2]) < 0) goto error; if((fspace = H5Screate_simple(1, cur_size, max_size)) < 0) goto error; if((mspace = H5Screate_simple(1, ch_size, ch_size)) < 0) goto error; if((dset = H5Dcreate2(file, "chunked", H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0) goto error; if ((fd=HDopen(FILE_NAME_1, O_RDONLY, 0666)) < 0) goto error; if(FILL_RANDOM==fill_style) had = calloc((size_t)cur_size[0], sizeof(int)); for (i=1; i<=cur_size[0]; i++) { /* Decide which chunk to write to */ switch (fill_style) { case FILL_FORWARD: hs_start[0] = i-1; break; case FILL_REVERSE: hs_start[0] = cur_size[0]-i; break; case FILL_INWARD: hs_start[0] = i%2 ? i/2 : cur_size[0]-i/2; break; case FILL_OUTWARD: j = (int)(cur_size[0]-i)+1; hs_start[0] = j%2 ? j/2 : (hssize_t)cur_size[0]-j/2; break; case FILL_RANDOM: for (j=HDrand()%(int)cur_size[0]; had[j]; j=(j+1)%(int)cur_size[0]) /*void*/; hs_start[0] = j; had[j] = 1; break; case FILL_ALL: abort(); default: /* unknown request */ HDfprintf(stderr, "Unknown fill style\n"); goto error; break; } /* Write the chunk */ if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_start, NULL, hs_count, NULL) < 0) goto error; if (H5Dwrite(dset, H5T_NATIVE_INT, mspace, fspace, xfer, &i) < 0) { goto error; } /* Determine overhead */ if (verbose) { if (H5Fflush(file, H5F_SCOPE_LOCAL) < 0) goto error; if (HDfstat(fd, &sb) < 0) goto error; /* * The extra cast in the following statement is a bug workaround * for the Win32 version 5.0 compiler. * 1998-11-06 ptl */ printf("%4lu %8.3f ***\n", (unsigned long)i, (double)(hssize_t)(sb.st_size-i*sizeof(int))/(hssize_t)i); } } if(had) { free(had); had = NULL; } /* end if */ H5Dclose(dset); H5Sclose(mspace); H5Sclose(fspace); H5Pclose(dcpl); H5Pclose(xfer); H5Fclose(file); if (!verbose) { switch (fill_style) { case FILL_FORWARD: sname = "forward"; break; case FILL_REVERSE: sname = "reverse"; break; case FILL_INWARD: sname = "inward"; break; case FILL_OUTWARD: sname = "outward"; break; case FILL_RANDOM: sname = "random"; break; case FILL_ALL: abort(); default: /* unknown request */ HDfprintf(stderr, "Unknown fill style\n"); goto error; break; } if (HDfstat(fd, &sb) < 0) goto error; printf("%-7s %8.3f\n", sname, (double)(hssize_t)(sb.st_size-cur_size[0]*sizeof(int))/ (hssize_t)cur_size[0]); } HDclose(fd); return 0; error: H5Dclose(dset); H5Sclose(mspace); H5Sclose(fspace); H5Pclose(dcpl); H5Pclose(xfer); H5Fclose(file); if(had) free(had); HDclose(fd); return 1; }
int main(void) { hid_t dcpl1; /* dataset create prop. list */ hid_t dapl1; /* dataset access prop. list */ hid_t dxpl1; /* dataset xfer prop. list */ hid_t gcpl1; /* group create prop. list */ hid_t ocpypl1; /* object copy prop. list */ hid_t ocpl1; /* object create prop. list */ hid_t lcpl1; /* link create prop. list */ hid_t lapl1; /* link access prop. list */ hid_t fapl1; /* file access prop. list */ hid_t fcpl1; /* file create prop. list */ hid_t strcpl1; /* string create prop. list */ hid_t acpl1; /* attribute create prop. list */ herr_t ret = 0; hsize_t chunk_size = 16384; /* chunk size */ int fill = 2; /* Fill value */ hsize_t max_size[1]; /* data space maximum size */ size_t nslots = 521 * 2; size_t nbytes = 1048576 * 10; double w0 = 0.5f; unsigned max_compact; unsigned min_dense; const char* c_to_f = "x+32"; int little_endian; int word_length; H5AC_cache_config_t my_cache_config = { H5AC__CURR_CACHE_CONFIG_VERSION, 1 /*TRUE*/, 0 /*FALSE*/, 0 /*FALSE*/, "temp", 1 /*TRUE*/, 0 /*FALSE*/, ( 2 * 2048 * 1024), 0.3f, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, 0.8f, 3.0f, 1 /*TRUE*/, (8 * 1024 * 1024), H5C_flash_incr__add_space, 2.0f, 0.25f, H5C_decr__age_out_with_threshold, 0.997f, 0.8f, 1 /*TRUE*/, (3 * 1024 * 1024), 3, 0 /*FALSE*/, 0.2f, (256 * 2048), H5AC_METADATA_WRITE_STRATEGY__PROCESS_0_ONLY}; H5AC_cache_image_config_t my_cache_image_config = { H5AC__CURR_CACHE_IMAGE_CONFIG_VERSION, TRUE, FALSE, -1}; /* check endianess */ { short int word = 0x0001; char *byte = (char *) &word; if(byte[0] == 1) /* little endian */ little_endian = 1; else /* big endian */ little_endian = 0; } /* check word length */ { word_length = 8 * sizeof(void *); } /* Explicitly initialize the library, since we are including the private header file */ H5open(); /******* ENCODE/DECODE DCPLS *****/ if((dcpl1 = H5Pcreate(H5P_DATASET_CREATE)) < 0) assert(dcpl1 > 0); if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/def_dcpl_")) < 0) assert(ret > 0); if((ret = H5Pset_chunk(dcpl1, 1, &chunk_size)) < 0) assert(ret > 0); if((ret = H5Pset_alloc_time(dcpl1, H5D_ALLOC_TIME_LATE)) < 0) assert(ret > 0); ret = H5Tconvert(H5T_NATIVE_INT, H5T_STD_I32BE, (size_t)1, &fill, NULL, H5P_DEFAULT); assert(ret >= 0); if((ret = H5Pset_fill_value(dcpl1, H5T_STD_I32BE, &fill)) < 0) assert(ret > 0); max_size[0] = 100; if((ret = H5Pset_external(dcpl1, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) assert(ret > 0); if((ret = H5Pset_external(dcpl1, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) assert(ret > 0); if((ret = H5Pset_external(dcpl1, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) assert(ret > 0); if((ret = H5Pset_external(dcpl1, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4))) < 0) assert(ret > 0); if((ret = encode_plist(dcpl1, little_endian, word_length, "testfiles/plist_files/dcpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(dcpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE DAPLS *****/ if((dapl1 = H5Pcreate(H5P_DATASET_ACCESS)) < 0) assert(dapl1 > 0); if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/def_dapl_")) < 0) assert(ret > 0); if((ret = H5Pset_chunk_cache(dapl1, nslots, nbytes, w0)) < 0) assert(ret > 0); if((ret = encode_plist(dapl1, little_endian, word_length, "testfiles/plist_files/dapl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(dapl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE DXPLS *****/ if((dxpl1 = H5Pcreate(H5P_DATASET_XFER)) < 0) assert(dxpl1 > 0); if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/def_dxpl_")) < 0) assert(ret > 0); if((ret = H5Pset_btree_ratios(dxpl1, 0.2f, 0.6f, 0.2f)) < 0) assert(ret > 0); if((ret = H5Pset_hyper_vector_size(dxpl1, 5)) < 0) assert(ret > 0); #ifdef H5_HAVE_PARALLEL if((ret = H5Pset_dxpl_mpio(dxpl1, H5FD_MPIO_COLLECTIVE)) < 0) assert(ret > 0); if((ret = H5Pset_dxpl_mpio_collective_opt(dxpl1, H5FD_MPIO_INDIVIDUAL_IO)) < 0) assert(ret > 0); if((ret = H5Pset_dxpl_mpio_chunk_opt(dxpl1, H5FD_MPIO_CHUNK_MULTI_IO)) < 0) assert(ret > 0); if((ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl1, 30)) < 0) assert(ret > 0); if((ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl1, 40)) < 0) assert(ret > 0); #endif/* H5_HAVE_PARALLEL */ if((ret = H5Pset_edc_check(dxpl1, H5Z_DISABLE_EDC)) < 0) assert(ret > 0); if((ret = H5Pset_data_transform(dxpl1, c_to_f)) < 0) assert(ret > 0); if((ret = encode_plist(dxpl1, little_endian, word_length, "testfiles/plist_files/dxpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(dxpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE GCPLS *****/ if((gcpl1 = H5Pcreate(H5P_GROUP_CREATE)) < 0) assert(gcpl1 > 0); if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/def_gcpl_")) < 0) assert(ret > 0); if((ret = H5Pset_local_heap_size_hint(gcpl1, 256)) < 0) assert(ret > 0); if((ret = H5Pset_link_phase_change(gcpl1, 2, 2)) < 0) assert(ret > 0); /* Query the group creation properties */ if((ret = H5Pget_link_phase_change(gcpl1, &max_compact, &min_dense)) < 0) assert(ret > 0); if((ret = H5Pset_est_link_info(gcpl1, 3, 9)) < 0) assert(ret > 0); if((ret = H5Pset_link_creation_order(gcpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) assert(ret > 0); if((ret = encode_plist(gcpl1, little_endian, word_length, "testfiles/plist_files/gcpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(gcpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE LCPLS *****/ if((lcpl1 = H5Pcreate(H5P_LINK_CREATE)) < 0) assert(lcpl1 > 0); if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/def_lcpl_")) < 0) assert(ret > 0); if((ret = H5Pset_create_intermediate_group(lcpl1, 1 /*TRUE*/)) < 0) assert(ret > 0); if((ret = encode_plist(lcpl1, little_endian, word_length, "testfiles/plist_files/lcpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(lcpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE OCPYLS *****/ if((ocpypl1 = H5Pcreate(H5P_OBJECT_COPY)) < 0) assert(ocpypl1 > 0); if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/def_ocpypl_")) < 0) assert(ret > 0); ret = H5Pset_copy_object(ocpypl1, H5O_COPY_EXPAND_EXT_LINK_FLAG); assert(ret >= 0); ret = H5Padd_merge_committed_dtype_path(ocpypl1, "foo"); assert(ret >= 0); ret = H5Padd_merge_committed_dtype_path(ocpypl1, "bar"); assert(ret >= 0); if((ret = encode_plist(ocpypl1, little_endian, word_length, "testfiles/plist_files/ocpypl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(ocpypl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE OCPLS *****/ if((ocpl1 = H5Pcreate(H5P_OBJECT_CREATE)) < 0) assert(ocpl1 > 0); if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/def_ocpl_")) < 0) assert(ret > 0); if((ret = H5Pset_attr_creation_order(ocpl1, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED))) < 0) assert(ret > 0); if((ret = H5Pset_attr_phase_change (ocpl1, 110, 105)) < 0) assert(ret > 0); if((ret = H5Pset_filter (ocpl1, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL)) < 0) assert(ret > 0); if((ret = encode_plist(ocpl1, little_endian, word_length, "testfiles/plist_files/ocpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(ocpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE LAPLS *****/ if((lapl1 = H5Pcreate(H5P_LINK_ACCESS)) < 0) assert(lapl1 > 0); if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/def_lapl_")) < 0) assert(ret > 0); if((ret = H5Pset_nlinks(lapl1, (size_t)134)) < 0) assert(ret > 0); if((ret = H5Pset_elink_acc_flags(lapl1, H5F_ACC_RDONLY)) < 0) assert(ret > 0); if((ret = H5Pset_elink_prefix(lapl1, "/tmpasodiasod")) < 0) assert(ret > 0); /* Create FAPL for the elink FAPL */ if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) assert(fapl1 > 0); if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0) assert(ret > 0); if((ret = H5Pset_elink_fapl(lapl1, fapl1)) < 0) assert(ret > 0); /* Close the elink's FAPL */ if((ret = H5Pclose(fapl1)) < 0) assert(ret > 0); if((ret = encode_plist(lapl1, little_endian, word_length, "testfiles/plist_files/lapl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(lapl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE FAPLS *****/ if((fapl1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) assert(fapl1 > 0); if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/def_fapl_")) < 0) assert(ret > 0); if((ret = H5Pset_family_offset(fapl1, 1024)) < 0) assert(ret > 0); if((ret = H5Pset_meta_block_size(fapl1, 2098452)) < 0) assert(ret > 0); if((ret = H5Pset_sieve_buf_size(fapl1, 1048576)) < 0) assert(ret > 0); if((ret = H5Pset_alignment(fapl1, 2, 1024)) < 0) assert(ret > 0); if((ret = H5Pset_cache(fapl1, 1024, 128, 10485760, 0.3f)) < 0) assert(ret > 0); if((ret = H5Pset_elink_file_cache_size(fapl1, 10485760)) < 0) assert(ret > 0); if((ret = H5Pset_gc_references(fapl1, 1)) < 0) assert(ret > 0); if((ret = H5Pset_small_data_block_size(fapl1, 2048)) < 0) assert(ret > 0); if((ret = H5Pset_libver_bounds(fapl1, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST)) < 0) assert(ret > 0); if((ret = H5Pset_fclose_degree(fapl1, H5F_CLOSE_WEAK)) < 0) assert(ret > 0); if((ret = H5Pset_multi_type(fapl1, H5FD_MEM_GHEAP)) < 0) assert(ret > 0); if((ret = H5Pset_mdc_config(fapl1, &my_cache_config)) < 0) assert(ret > 0); if((ret = H5Pset_mdc_image_config(fapl1, &my_cache_image_config)) < 0) assert(ret > 0); if((ret = H5Pset_core_write_tracking(fapl1, TRUE, (size_t)(1024 * 1024))) < 0) assert(ret > 0); if((ret = encode_plist(fapl1, little_endian, word_length, "testfiles/plist_files/fapl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(fapl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE FCPLS *****/ if((fcpl1 = H5Pcreate(H5P_FILE_CREATE)) < 0) assert(fcpl1 > 0); if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/def_fcpl_")) < 0) assert(ret > 0); if((ret = H5Pset_userblock(fcpl1, 1024) < 0)) assert(ret > 0); if((ret = H5Pset_istore_k(fcpl1, 3) < 0)) assert(ret > 0); if((ret = H5Pset_sym_k(fcpl1, 4, 5) < 0)) assert(ret > 0); if((ret = H5Pset_shared_mesg_nindexes(fcpl1, 8) < 0)) assert(ret > 0); if((ret = H5Pset_shared_mesg_index(fcpl1, 1, H5O_SHMESG_SDSPACE_FLAG, 32) < 0)) assert(ret > 0); if((ret = H5Pset_shared_mesg_phase_change(fcpl1, 60, 20) < 0)) assert(ret > 0); if((ret = H5Pset_sizes(fcpl1, 8, 4) < 0)) assert(ret > 0); if((ret = H5Pset_file_space_strategy(fcpl1, H5F_FSPACE_STRATEGY_PAGE, TRUE, (hsize_t)1)) < 0) assert(ret > 0); if((ret = H5Pset_file_space_page_size(fcpl1, (hsize_t)4096)) < 0) assert(ret > 0); if((ret = encode_plist(fcpl1, little_endian, word_length, "testfiles/plist_files/fcpl_")) < 0) assert(ret > 0); /* release resource */ if((ret = H5Pclose(fcpl1)) < 0) assert(ret > 0); /******* ENCODE/DECODE STRCPLS *****/ strcpl1 = H5Pcreate(H5P_STRING_CREATE); assert(strcpl1 > 0); ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/def_strcpl_"); assert(ret > 0); ret = H5Pset_char_encoding(strcpl1, H5T_CSET_UTF8); assert(ret >= 0); ret = encode_plist(strcpl1, little_endian, word_length, "testfiles/plist_files/strcpl_"); assert(ret > 0); /* release resource */ ret = H5Pclose(strcpl1); assert(ret >= 0); /******* ENCODE/DECODE ACPLS *****/ acpl1 = H5Pcreate(H5P_ATTRIBUTE_CREATE); assert(acpl1 > 0); ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/def_acpl_"); assert(ret > 0); ret = H5Pset_char_encoding(acpl1, H5T_CSET_UTF8); assert(ret >= 0); ret = encode_plist(acpl1, little_endian, word_length, "testfiles/plist_files/acpl_"); assert(ret > 0); /* release resource */ ret = H5Pclose(acpl1); assert(ret >= 0); return 0; }
void test_plist_ed(void) { hid_t dcpl; /* dataset create prop. list */ hid_t dapl; /* dataset access prop. list */ hid_t dxpl; /* dataset transfer prop. list */ hid_t gcpl; /* group create prop. list */ hid_t lcpl; /* link create prop. list */ hid_t lapl; /* link access prop. list */ hid_t ocpypl; /* object copy prop. list */ hid_t ocpl; /* object create prop. list */ hid_t fapl; /* file access prop. list */ hid_t fcpl; /* file create prop. list */ hid_t strcpl; /* string create prop. list */ hid_t acpl; /* attribute create prop. list */ int mpi_size, mpi_rank, recv_proc; hsize_t chunk_size = 16384; /* chunk size */ double fill = 2.7f; /* Fill value */ size_t nslots = 521*2; size_t nbytes = 1048576 * 10; double w0 = 0.5f; unsigned max_compact; unsigned min_dense; hsize_t max_size[1]; /*data space maximum size */ const char* c_to_f = "x+32"; H5AC_cache_config_t my_cache_config = { H5AC__CURR_CACHE_CONFIG_VERSION, TRUE, FALSE, FALSE, "temp", TRUE, FALSE, ( 2 * 2048 * 1024), 0.3f, (64 * 1024 * 1024), (4 * 1024 * 1024), 60000, H5C_incr__threshold, 0.8f, 3.0f, TRUE, (8 * 1024 * 1024), H5C_flash_incr__add_space, 2.0f, 0.25f, H5C_decr__age_out_with_threshold, 0.997f, 0.8f, TRUE, (3 * 1024 * 1024), 3, FALSE, 0.2f, (256 * 2048), H5AC__DEFAULT_METADATA_WRITE_STRATEGY}; herr_t ret; /* Generic return value */ if(VERBOSE_MED) printf("Encode/Decode DCPLs\n"); /* set up MPI parameters */ MPI_Comm_size(MPI_COMM_WORLD, &mpi_size); MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank); if(mpi_size == 1) recv_proc = 0; else recv_proc = 1; dcpl = H5Pcreate(H5P_DATASET_CREATE); VRFY((dcpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk(dcpl, 1, &chunk_size); VRFY((ret >= 0), "H5Pset_chunk succeeded"); ret = H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE); VRFY((ret >= 0), "H5Pset_alloc_time succeeded"); ret = H5Pset_fill_value(dcpl, H5T_NATIVE_DOUBLE, &fill); VRFY((ret>=0), "set fill-value succeeded"); max_size[0] = 100; ret = H5Pset_external(dcpl, "ext1.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4)); VRFY((ret>=0), "set external succeeded"); ret = H5Pset_external(dcpl, "ext2.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4)); VRFY((ret>=0), "set external succeeded"); ret = H5Pset_external(dcpl, "ext3.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4)); VRFY((ret>=0), "set external succeeded"); ret = H5Pset_external(dcpl, "ext4.data", (off_t)0, (hsize_t)(max_size[0] * sizeof(int)/4)); VRFY((ret>=0), "set external succeeded"); ret = test_encode_decode(dcpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(dcpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE DAPLS *****/ dapl = H5Pcreate(H5P_DATASET_ACCESS); VRFY((dapl >= 0), "H5Pcreate succeeded"); ret = H5Pset_chunk_cache(dapl, nslots, nbytes, w0); VRFY((ret >= 0), "H5Pset_chunk_cache succeeded"); ret = test_encode_decode(dapl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(dapl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE OCPLS *****/ ocpl = H5Pcreate(H5P_OBJECT_CREATE); VRFY((ocpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_attr_creation_order(ocpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); VRFY((ret >= 0), "H5Pset_attr_creation_order succeeded"); ret = H5Pset_attr_phase_change(ocpl, 110, 105); VRFY((ret >= 0), "H5Pset_attr_phase_change succeeded"); ret = H5Pset_filter(ocpl, H5Z_FILTER_FLETCHER32, 0, (size_t)0, NULL); VRFY((ret >= 0), "H5Pset_filter succeeded"); ret = test_encode_decode(ocpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(ocpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE DXPLS *****/ dxpl = H5Pcreate(H5P_DATASET_XFER); VRFY((dxpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_btree_ratios(dxpl, 0.2f, 0.6f, 0.2f); VRFY((ret >= 0), "H5Pset_btree_ratios succeeded"); ret = H5Pset_hyper_vector_size(dxpl, 5); VRFY((ret >= 0), "H5Pset_hyper_vector_size succeeded"); ret = H5Pset_dxpl_mpio(dxpl, H5FD_MPIO_COLLECTIVE); VRFY((ret >= 0), "H5Pset_dxpl_mpio succeeded"); ret = H5Pset_dxpl_mpio_collective_opt(dxpl, H5FD_MPIO_INDIVIDUAL_IO); VRFY((ret >= 0), "H5Pset_dxpl_mpio_collective_opt succeeded"); ret = H5Pset_dxpl_mpio_chunk_opt(dxpl, H5FD_MPIO_CHUNK_MULTI_IO); VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt succeeded"); ret = H5Pset_dxpl_mpio_chunk_opt_ratio(dxpl, 30); VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_ratio succeeded"); ret = H5Pset_dxpl_mpio_chunk_opt_num(dxpl, 40); VRFY((ret >= 0), "H5Pset_dxpl_mpio_chunk_opt_num succeeded"); ret = H5Pset_edc_check(dxpl, H5Z_DISABLE_EDC); VRFY((ret >= 0), "H5Pset_edc_check succeeded"); ret = H5Pset_data_transform(dxpl, c_to_f); VRFY((ret >= 0), "H5Pset_data_transform succeeded"); ret = test_encode_decode(dxpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(dxpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE GCPLS *****/ gcpl = H5Pcreate(H5P_GROUP_CREATE); VRFY((gcpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_local_heap_size_hint(gcpl, 256); VRFY((ret >= 0), "H5Pset_local_heap_size_hint succeeded"); ret = H5Pset_link_phase_change(gcpl, 2, 2); VRFY((ret >= 0), "H5Pset_link_phase_change succeeded"); /* Query the group creation properties */ ret = H5Pget_link_phase_change(gcpl, &max_compact, &min_dense); VRFY((ret >= 0), "H5Pget_est_link_info succeeded"); ret = H5Pset_est_link_info(gcpl, 3, 9); VRFY((ret >= 0), "H5Pset_est_link_info succeeded"); ret = H5Pset_link_creation_order(gcpl, (H5P_CRT_ORDER_TRACKED | H5P_CRT_ORDER_INDEXED)); VRFY((ret >= 0), "H5Pset_link_creation_order succeeded"); ret = test_encode_decode(gcpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(gcpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE LCPLS *****/ lcpl = H5Pcreate(H5P_LINK_CREATE); VRFY((lcpl >= 0), "H5Pcreate succeeded"); ret= H5Pset_create_intermediate_group(lcpl, TRUE); VRFY((ret >= 0), "H5Pset_create_intermediate_group succeeded"); ret = test_encode_decode(lcpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(lcpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE LAPLS *****/ lapl = H5Pcreate(H5P_LINK_ACCESS); VRFY((lapl >= 0), "H5Pcreate succeeded"); ret = H5Pset_nlinks(lapl, (size_t)134); VRFY((ret >= 0), "H5Pset_nlinks succeeded"); ret = H5Pset_elink_acc_flags(lapl, H5F_ACC_RDONLY); VRFY((ret >= 0), "H5Pset_elink_acc_flags succeeded"); ret = H5Pset_elink_prefix(lapl, "/tmpasodiasod"); VRFY((ret >= 0), "H5Pset_nlinks succeeded"); /* Create FAPL for the elink FAPL */ fapl = H5Pcreate(H5P_FILE_ACCESS); VRFY((fapl >= 0), "H5Pcreate succeeded"); ret = H5Pset_alignment(fapl, 2, 1024); VRFY((ret >= 0), "H5Pset_alignment succeeded"); ret = H5Pset_elink_fapl(lapl, fapl); VRFY((ret >= 0), "H5Pset_elink_fapl succeeded"); /* Close the elink's FAPL */ ret = H5Pclose(fapl); VRFY((ret >= 0), "H5Pclose succeeded"); ret = test_encode_decode(lapl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(lapl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE OCPYPLS *****/ ocpypl = H5Pcreate(H5P_OBJECT_COPY); VRFY((ocpypl >= 0), "H5Pcreate succeeded"); ret = H5Pset_copy_object(ocpypl, H5O_COPY_EXPAND_EXT_LINK_FLAG); VRFY((ret >= 0), "H5Pset_copy_object succeeded"); ret = H5Padd_merge_committed_dtype_path(ocpypl, "foo"); VRFY((ret >= 0), "H5Padd_merge_committed_dtype_path succeeded"); ret = H5Padd_merge_committed_dtype_path(ocpypl, "bar"); VRFY((ret >= 0), "H5Padd_merge_committed_dtype_path succeeded"); ret = test_encode_decode(ocpypl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(ocpypl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE FAPLS *****/ fapl = H5Pcreate(H5P_FILE_ACCESS); VRFY((fapl >= 0), "H5Pcreate succeeded"); ret = H5Pset_family_offset(fapl, 1024); VRFY((ret >= 0), "H5Pset_family_offset succeeded"); ret = H5Pset_meta_block_size(fapl, 2098452); VRFY((ret >= 0), "H5Pset_meta_block_size succeeded"); ret = H5Pset_sieve_buf_size(fapl, 1048576); VRFY((ret >= 0), "H5Pset_sieve_buf_size succeeded"); ret = H5Pset_alignment(fapl, 2, 1024); VRFY((ret >= 0), "H5Pset_alignment succeeded"); ret = H5Pset_cache(fapl, 1024, 128, 10485760, 0.3f); VRFY((ret >= 0), "H5Pset_cache succeeded"); ret = H5Pset_elink_file_cache_size(fapl, 10485760); VRFY((ret >= 0), "H5Pset_elink_file_cache_size succeeded"); ret = H5Pset_gc_references(fapl, 1); VRFY((ret >= 0), "H5Pset_gc_references succeeded"); ret = H5Pset_small_data_block_size(fapl, 2048); VRFY((ret >= 0), "H5Pset_small_data_block_size succeeded"); ret = H5Pset_libver_bounds(fapl, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST); VRFY((ret >= 0), "H5Pset_libver_bounds succeeded"); ret = H5Pset_fclose_degree(fapl, H5F_CLOSE_WEAK); VRFY((ret >= 0), "H5Pset_fclose_degree succeeded"); ret = H5Pset_multi_type(fapl, H5FD_MEM_GHEAP); VRFY((ret >= 0), "H5Pset_multi_type succeeded"); ret = H5Pset_mdc_config(fapl, &my_cache_config); VRFY((ret >= 0), "H5Pset_mdc_config succeeded"); ret = test_encode_decode(fapl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(fapl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE FCPLS *****/ fcpl = H5Pcreate(H5P_FILE_CREATE); VRFY((fcpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_userblock(fcpl, 1024); VRFY((ret >= 0), "H5Pset_userblock succeeded"); ret = H5Pset_istore_k(fcpl, 3); VRFY((ret >= 0), "H5Pset_istore_k succeeded"); ret = H5Pset_sym_k(fcpl, 4, 5); VRFY((ret >= 0), "H5Pset_sym_k succeeded"); ret = H5Pset_shared_mesg_nindexes(fcpl, 8); VRFY((ret >= 0), "H5Pset_shared_mesg_nindexes succeeded"); ret = H5Pset_shared_mesg_index(fcpl, 1, H5O_SHMESG_SDSPACE_FLAG, 32); VRFY((ret >= 0), "H5Pset_shared_mesg_index succeeded"); ret = H5Pset_shared_mesg_phase_change(fcpl, 60, 20); VRFY((ret >= 0), "H5Pset_shared_mesg_phase_change succeeded"); ret = H5Pset_sizes(fcpl, 8, 4); VRFY((ret >= 0), "H5Pset_sizes succeeded"); ret = test_encode_decode(fcpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(fcpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE STRCPLS *****/ strcpl = H5Pcreate(H5P_STRING_CREATE); VRFY((strcpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_char_encoding(strcpl, H5T_CSET_UTF8); VRFY((ret >= 0), "H5Pset_char_encoding succeeded"); ret = test_encode_decode(strcpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(strcpl); VRFY((ret >= 0), "H5Pclose succeeded"); /******* ENCODE/DECODE ACPLS *****/ acpl = H5Pcreate(H5P_ATTRIBUTE_CREATE); VRFY((acpl >= 0), "H5Pcreate succeeded"); ret = H5Pset_char_encoding(acpl, H5T_CSET_UTF8); VRFY((ret >= 0), "H5Pset_char_encoding succeeded"); ret = test_encode_decode(acpl, mpi_rank, recv_proc); VRFY((ret >= 0), "test_encode_decode succeeded"); ret = H5Pclose(acpl); VRFY((ret >= 0), "H5Pclose succeeded"); }