/* * Copyright (C) 1998 NCSA * All rights reserved. * * Programmer: Robb Matzke * Wednesday, April 8, 1998 */ #include #include #include #include #include #include /*needed for HDfprintf() */ #define FNAME "big%05d.h5" #define WRT_N 50 #define WRT_SIZE 4*1024 #define FAMILY_SIZE 1024*1024*1024 static hsize_t randll (hsize_t limit) { hsize_t acc = rand (); acc *= rand (); return acc % limit; } /*------------------------------------------------------------------------- * Function: main * * Purpose: Creates a *big* dataset. * * Return: Success: * * Failure: * * Programmer: Robb Matzke * Wednesday, April 8, 1998 * * Modifications: * *------------------------------------------------------------------------- */ static void writer (int wrt_n) { hsize_t size1[4] = {8, 1024, 1024, 1024}; hsize_t size2[1] = {8589934592LL}; hssize_t hs_start[1]; hsize_t hs_size[1]; hid_t plist, file, space1, space2, mem_space, d1, d2; int *buf = malloc (sizeof(int) * WRT_SIZE); int i, j; /* * Make sure that `hsize_t' is large enough to represent the entire data * space. */ assert (sizeof(hsize_t)>4); /* * We might be on a machine that has 32-bit files, so create an HDF5 file * which is a family of files. Each member of the family will be 1GB */ plist = H5Pcreate (H5P_FILE_ACCESS); H5Pset_family (plist, FAMILY_SIZE, H5P_DEFAULT); file = H5Fcreate (FNAME, H5F_ACC_TRUNC, H5P_DEFAULT, plist); H5Pclose (plist); /* Create simple data spaces according to the size specified above. */ space1 = H5Screate_simple (4, size1, size1); space2 = H5Screate_simple (1, size2, size2); /* Create the datasets */ d1 = H5Dcreate (file, "d1", H5T_NATIVE_INT, space1, H5P_DEFAULT); d2 = H5Dcreate (file, "d2", H5T_NATIVE_INT, space2, H5P_DEFAULT); /* Write some things to them randomly */ hs_size[0] = WRT_SIZE; mem_space = H5Screate_simple (1, hs_size, hs_size); for (i=0; i