mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-21 01:04:10 +08:00
[svn-r13280]
2 tests that were previously incorporated inside the array indices test file were separated from it. These are a test with a dataset with dimensions greater tan 4GB and a test to read by hyperslabs
This commit is contained in:
parent
aaa8bba354
commit
319ad4c84b
@ -83,8 +83,8 @@
|
||||
#define FILE53 "textlink.h5"
|
||||
#define FILE54 "tudlink.h5"
|
||||
#define FILE55 "tbinary.h5"
|
||||
|
||||
|
||||
#define FILE56 "tbigdims.h5"
|
||||
#define FILE57 "thyperslab.h5"
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* prototypes
|
||||
@ -5360,7 +5360,7 @@ static void gent_string(void)
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: gent_aindices
|
||||
*
|
||||
* Purpose: make several datasets for the array indices tests
|
||||
* Purpose: make several datasets for the array indices and subsetting tests
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -5372,12 +5372,10 @@ static void gent_aindices(void)
|
||||
hsize_t dims2[2] = {10,10};
|
||||
hsize_t dims3[3] = {2,10,10};
|
||||
hsize_t dims4[4] = {2,2,10,10};
|
||||
hsize_t dims5[2] = {32,4097}; /* big enough data size to force a second stripmine read */
|
||||
int buf1[100];
|
||||
int buf2[10][10];
|
||||
int buf3[2][10][10];
|
||||
int buf4[2][2][10][10];
|
||||
double *buf5;
|
||||
int i, j, k, l, n, ret;
|
||||
|
||||
for (i=n=0; i<100; i++){
|
||||
@ -5406,10 +5404,6 @@ static void gent_aindices(void)
|
||||
}
|
||||
}
|
||||
|
||||
buf5 = malloc(32 * 4097 * sizeof(double) );
|
||||
for (i = 0; i < 32 * 4097; i++)
|
||||
buf5[i] = 1;
|
||||
|
||||
/* create a file */
|
||||
fid = H5Fcreate(FILE50, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
assert(fid>=0);
|
||||
@ -5422,7 +5416,6 @@ static void gent_aindices(void)
|
||||
write_dset(fid,2,dims2,"2d",H5T_NATIVE_INT,buf2);
|
||||
write_dset(fid,3,dims3,"3d",H5T_NATIVE_INT,buf3);
|
||||
write_dset(fid,4,dims4,"4d",H5T_NATIVE_INT,buf4);
|
||||
write_dset(fid,2,dims5,"stripmine",H5T_NATIVE_DOUBLE,buf5);
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* test with group indentation
|
||||
@ -5448,9 +5441,9 @@ static void gent_aindices(void)
|
||||
ret=H5Fclose(fid);
|
||||
assert(ret>=0);
|
||||
|
||||
free(buf5);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: gent_longlinks
|
||||
*
|
||||
@ -5501,8 +5494,6 @@ static void gent_longlinks(void)
|
||||
HDfree(objname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: gent_ldouble
|
||||
*
|
||||
@ -5634,6 +5625,139 @@ gent_binary(void)
|
||||
H5Fclose(fid);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: gen_bigdims
|
||||
*
|
||||
* Purpose: generate a dataset with dimensions greater than 4GB
|
||||
* and write one hyperslab on the boundary
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
#define GB4LL ((unsigned long_long) 4*1024*1024*1024)
|
||||
#define DIM_4GB (GB4LL + 10)
|
||||
|
||||
static void gent_bigdims(void)
|
||||
{
|
||||
hid_t fid;
|
||||
hid_t did;
|
||||
hid_t f_sid;
|
||||
hid_t m_sid;
|
||||
hid_t tid;
|
||||
hid_t dcpl;
|
||||
hsize_t dims[1]={DIM_4GB}; /* dataset dimensions */
|
||||
hsize_t chunk_dims[1]={1024}; /* chunk dimensions */
|
||||
hsize_t hs_start[1];
|
||||
hsize_t hs_size[1]; /* hyperslab dimensions */
|
||||
size_t size;
|
||||
char fillvalue=-1;
|
||||
char *buf=NULL;
|
||||
hsize_t i;
|
||||
char c;
|
||||
size_t nelmts;
|
||||
int ret;
|
||||
|
||||
/* create a file */
|
||||
fid = H5Fcreate(FILE56, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
assert(fid>=0);
|
||||
|
||||
/* create dataset */
|
||||
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE))<0)
|
||||
goto out;
|
||||
if (H5Pset_fill_value(dcpl, H5T_NATIVE_CHAR, &fillvalue)<0)
|
||||
goto out;
|
||||
if (H5Pset_chunk(dcpl, 1, chunk_dims)<0)
|
||||
goto out;
|
||||
if ((f_sid = H5Screate_simple(1,dims,NULL))<0)
|
||||
goto out;
|
||||
if ((did = H5Dcreate(fid,"dset4gb",H5T_NATIVE_CHAR,f_sid,dcpl))<0)
|
||||
goto out;
|
||||
if ((tid = H5Dget_type(did))<0)
|
||||
goto out;
|
||||
if ((size = H5Tget_size(tid))<=0)
|
||||
goto out;
|
||||
|
||||
/* select an hyperslab */
|
||||
nelmts = 20;
|
||||
hs_start[0] = GB4LL - 10;
|
||||
hs_size[0] = nelmts;
|
||||
|
||||
if ((m_sid = H5Screate_simple(1, hs_size, hs_size))<0)
|
||||
goto out;
|
||||
|
||||
buf=(char *) malloc((unsigned)(nelmts*size));
|
||||
|
||||
for (i=0, c=0; i<nelmts; i++, c++)
|
||||
{
|
||||
buf[i] = c;
|
||||
}
|
||||
|
||||
if (H5Sselect_hyperslab (f_sid,H5S_SELECT_SET,hs_start,NULL,hs_size,NULL)<0)
|
||||
goto out;
|
||||
if (H5Dwrite (did,H5T_NATIVE_CHAR,m_sid,f_sid,H5P_DEFAULT,buf)<0)
|
||||
goto out;
|
||||
|
||||
|
||||
free(buf);
|
||||
buf=NULL;
|
||||
|
||||
/* close */
|
||||
if(H5Sclose(f_sid)<0)
|
||||
goto out;
|
||||
if(H5Sclose(m_sid)<0)
|
||||
goto out;
|
||||
if(H5Pclose(dcpl)<0)
|
||||
goto out;
|
||||
if(H5Dclose(did)<0)
|
||||
goto out;
|
||||
|
||||
ret=H5Fclose(fid);
|
||||
assert(ret>=0);
|
||||
|
||||
return;
|
||||
|
||||
out:
|
||||
printf("Error.....\n");
|
||||
H5E_BEGIN_TRY {
|
||||
H5Pclose(dcpl);
|
||||
H5Sclose(f_sid);
|
||||
H5Sclose(m_sid);
|
||||
H5Dclose(did);
|
||||
H5Fclose(fid);
|
||||
} H5E_END_TRY;
|
||||
return;
|
||||
|
||||
}
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: gent_hyperslab
|
||||
*
|
||||
* Purpose: make a dataset for hyperslab read
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
static void gent_hyperslab(void)
|
||||
{
|
||||
hid_t fid; /* file id */
|
||||
hsize_t dims[2] = {32,4097}; /* big enough data size to force a second stripmine read */
|
||||
double *buf;
|
||||
int i, ret;
|
||||
|
||||
buf = malloc(32 * 4097 * sizeof(double) );
|
||||
for (i = 0; i < 32 * 4097; i++)
|
||||
buf[i] = 1;
|
||||
|
||||
/* create a file */
|
||||
fid = H5Fcreate(FILE57, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
|
||||
assert(fid>=0);
|
||||
|
||||
write_dset(fid,2,dims,"stripmine",H5T_NATIVE_DOUBLE,buf);
|
||||
|
||||
ret=H5Fclose(fid);
|
||||
assert(ret>=0);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------------
|
||||
* Function: main
|
||||
*
|
||||
@ -5697,6 +5821,8 @@ int main(void)
|
||||
gent_longlinks();
|
||||
gent_ldouble();
|
||||
gent_binary();
|
||||
gent_bigdims();
|
||||
gent_hyperslab();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -343,6 +343,12 @@ TOOLTEST tbin4.ddl -d double -o out4.bin -b FILE tbinary.h5
|
||||
# test for dataset region references
|
||||
TOOLTEST tregref.ddl tdatareg.h5
|
||||
|
||||
# dimensions over 4GB, print boundary
|
||||
TOOLTEST tbigdims.ddl -d dset4gb -s 4294967284 -c 22 tbigdims.h5
|
||||
|
||||
# hyperslab read
|
||||
TOOLTEST thyperslab.ddl thyperslab.h5
|
||||
|
||||
if test $nerrors -eq 0 ; then
|
||||
echo "All $DUMPER tests passed."
|
||||
fi
|
||||
|
Binary file not shown.
19
tools/testfiles/tbigdims.ddl
Normal file
19
tools/testfiles/tbigdims.ddl
Normal file
@ -0,0 +1,19 @@
|
||||
#############################
|
||||
Expected output for 'h5dump -d dset4gb -s 4294967284 -c 22 tbigdims.h5'
|
||||
#############################
|
||||
HDF5 "tbigdims.h5" {
|
||||
DATASET "dset4gb" {
|
||||
DATATYPE H5T_STD_I8LE
|
||||
DATASPACE SIMPLE { ( 4294967306 ) / ( 4294967306 ) }
|
||||
SUBSET {
|
||||
START ( 4294967284 );
|
||||
STRIDE ( 1 );
|
||||
COUNT ( 22 );
|
||||
BLOCK ( 1 );
|
||||
DATA {
|
||||
(4294967284): -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
||||
(4294967301): 15, 16, 17, 18, 19
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
tools/testfiles/tbigdims.h5
Normal file
BIN
tools/testfiles/tbigdims.h5
Normal file
Binary file not shown.
6553
tools/testfiles/thyperslab.ddl
Normal file
6553
tools/testfiles/thyperslab.ddl
Normal file
File diff suppressed because it is too large
Load Diff
BIN
tools/testfiles/thyperslab.h5
Normal file
BIN
tools/testfiles/thyperslab.h5
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user