fixed errors found by regression tests:

the H5Fed file data structure can't be created by >1 MPI task, so it is disabled in parallel mode (for now)
the H5Block3dSetHalo function was inverting the halo radii
the h5b_test wasn't writing the correct data in the halo case
This commit is contained in:
Marc Howison
2010-07-28 21:55:00 +00:00
parent 377af10fb0
commit 6568099f62
11 changed files with 116 additions and 118 deletions
+16 -14
View File
@@ -116,12 +116,12 @@ H5Block3dSetView (
h5_err_t
H5Block3dGetView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c k */
h5_int64_t *k_end /*!< OUT: end index of \c k */
) {
SET_FNAME( f, __func__ );
@@ -139,12 +139,12 @@ H5Block3dGetView (
h5_err_t
H5Block3dGetReducedView (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c j */
h5_size_t *k_end /*!< OUT: end index of \c j */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c j */
h5_int64_t *k_end /*!< OUT: end index of \c j */
) {
SET_FNAME( f, __func__ );
@@ -184,12 +184,14 @@ h5_err_t
H5Block3dGetChunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
h5_int64_t *i, /*!< OUT: size of \c i */
h5_int64_t *j, /*!< OUT: size of \c j */
h5_int64_t *k /*!< OUT: size of \c k */
) {
SET_FNAME( f, __func__ );
return h5b_3d_get_chunk(f, field_name, dims);
return h5b_3d_get_chunk(f, field_name, i, j, k);
}
/*!
+1 -1
View File
@@ -43,5 +43,5 @@ libH5hutC_a_SOURCES = \
H5Fed_store.c \
H5Fed_tags.c
clean: cleam-am
clean: clean-am
+2 -18
View File
@@ -96,20 +96,12 @@ h5bl_3d_getview (
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
h5_size_t view[6];
h5_err_t herr = h5b_3d_get_view (
filehandle,
view+0, view+1, view+2, view+3, view+4, view+5 );
i_start, i_end, j_start, j_end, k_start, k_end );
if ( herr < 0 ) return herr;
*i_start = view[0]+1;
*i_end = view[1]+1;
*j_start = view[2]+1;
*j_end = view[3]+1;
*k_start = view[4]+1;
*k_end = view[5]+1;
return H5_SUCCESS;
}
@@ -126,20 +118,12 @@ h5bl_3d_getreducedview (
h5_file_t *filehandle = (h5_file_t*)(size_t)*f;
h5_set_funcname( filehandle, __func__ );
h5_size_t view[6];
h5_err_t herr = h5b_3d_get_reduced_view (
filehandle,
view+0, view+1, view+2, view+3, view+4, view+5 );
i_start, i_end, j_start, j_end, k_start, k_end );
if ( herr < 0 ) return herr;
*i_start = view[0]+1;
*i_end = view[1]+1;
*j_start = view[2]+1;
*j_end = view[3]+1;
*k_start = view[4]+1;
*k_end = view[5]+1;
return H5_SUCCESS;
}
+1 -1
View File
@@ -168,7 +168,7 @@ h5pt_opena_par_align (
h5_int32_t fbits = H5_O_APPEND | _flagsfor2c ( flags2 );
h5_file_t* f = H5OpenFile( file_name2, ccomm, fbits, __func__ );
h5_file_t* f = h5_open_file( file_name2, ccomm, fbits, __func__ );
free ( file_name2 );
free ( flags2 );
+9 -1
View File
@@ -24,7 +24,11 @@ h5_check_filehandle (
h5_file_t* const f /*!< filehandle to check validity of */
) {
if (f == NULL || f->file < 0 || f->u == NULL || f->b == NULL || f->t == NULL) {
if (f == NULL || f->file < 0 || f->u == NULL || f->b == NULL
#ifndef PARALLEL_IO
|| f->t == NULL
#endif
) {
return h5_error (
f,
H5_ERR_BADFD,
@@ -225,7 +229,9 @@ h5priv_open_file (
TRY( h5upriv_open_file (f) );
TRY( h5bpriv_open_file (f) );
#ifndef PARALLEL_IO
TRY( h5tpriv_open_file (f) );
#endif
return H5_SUCCESS;
}
@@ -339,7 +345,9 @@ h5_close_file (
TRY( h5priv_close_step (f) );
TRY( h5upriv_close_file (f) );
TRY( h5bpriv_close_file (f) );
#ifndef PARALLEL_IO
TRY( h5tpriv_close_file (f) );
#endif
TRY( h5priv_close_hdf5_group (f, f->step_gid) );
TRY( h5priv_close_hdf5_property (f, f->xfer_prop) );
TRY( h5priv_close_hdf5_property (f, f->access_prop) );
+34 -40
View File
@@ -523,12 +523,12 @@ h5b_3d_has_view (
h5_err_t
h5b_3d_set_view (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i_start, /*!< IN: start index of \c i */
const h5_size_t i_end, /*!< IN: end index of \c i */
const h5_size_t j_start, /*!< IN: start index of \c j */
const h5_size_t j_end, /*!< IN: end index of \c j */
const h5_size_t k_start, /*!< IN: start index of \c k */
const h5_size_t k_end /*!< IN: end index of \c k */
const h5_int64_t i_start, /*!< IN: start index of \c i */
const h5_int64_t i_end, /*!< IN: end index of \c i */
const h5_int64_t j_start, /*!< IN: start index of \c j */
const h5_int64_t j_end, /*!< IN: end index of \c j */
const h5_int64_t k_start, /*!< IN: start index of \c k */
const h5_int64_t k_end /*!< IN: end index of \c k */
) {
h5b_partition_t *p = f->b->user_layout;
@@ -590,12 +590,12 @@ h5b_3d_set_view (
h5_err_t
h5b_3d_get_view (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c k */
h5_int64_t *k_end /*!< OUT: end index of \c k */
) {
h5b_partition_t *p = f->b->user_layout;
@@ -613,12 +613,12 @@ h5b_3d_get_view (
h5_err_t
h5b_3d_get_reduced_view (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c k */
h5_int64_t *k_end /*!< OUT: end index of \c k */
) {
h5b_partition_t *p = f->b->write_layout;
@@ -636,9 +636,9 @@ h5b_3d_get_reduced_view (
h5_err_t
h5b_3d_set_chunk (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: size of \c i */
const h5_size_t j, /*!< IN: size of \c j */
const h5_size_t k /*!< IN: size of \c k */
const h5_int64_t i, /*!< IN: size of \c i */
const h5_int64_t j, /*!< IN: size of \c j */
const h5_int64_t k /*!< IN: size of \c k */
) {
if ( i == 0 || j == 0 || k == 0 )
@@ -662,7 +662,9 @@ h5_err_t
h5b_3d_get_chunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
h5_int64_t *i, /*!< OUT: size of \c i */
h5_int64_t *j, /*!< OUT: size of \c j */
h5_int64_t *k /*!< OUT: size of \c k */
) {
CHECK_TIMEGROUP ( f );
@@ -681,15 +683,15 @@ h5b_3d_get_chunk (
TRY( h5priv_close_hdf5_property(f, plist_id) );
TRY( h5priv_close_hdf5_dataset(f, dataset_id) );
dims[0] = hdims[2];
dims[1] = hdims[1];
dims[2] = hdims[0];
*i = hdims[2];
*j = hdims[1];
*k = hdims[0];
h5_info(f,
"Found chunk dimensions (%lld,%lld,%lld)",
(long long)dims[0],
(long long)dims[1],
(long long)dims[2] );
(long long)hdims[0],
(long long)hdims[1],
(long long)hdims[2] );
return H5_SUCCESS;
}
@@ -818,20 +820,12 @@ h5b_3d_set_halo (
h5b_fdata_t *b = f->b;
b->user_layout->i_start -= k;
b->user_layout->i_end += k;
b->user_layout->i_start -= i;
b->user_layout->i_end += i;
b->user_layout->j_start -= j;
b->user_layout->j_end += j;
b->user_layout->k_start -= i;
b->user_layout->k_end += i;
b->user_layout->i_start = MAX(0, b->user_layout->i_start);
b->user_layout->j_start = MAX(0, b->user_layout->j_start);
b->user_layout->k_start = MAX(0, b->user_layout->k_start);
b->user_layout->i_end = MIN(b->i_max, b->user_layout->i_end);
b->user_layout->j_end = MIN(b->j_max, b->user_layout->j_end);
b->user_layout->k_end = MIN(b->k_max, b->user_layout->k_end);
b->user_layout->k_start -= k;
b->user_layout->k_end += k;
return H5_SUCCESS;
}
+6 -6
View File
@@ -2,12 +2,12 @@
#define __H5B_TYPES_PRIVATE_H
struct h5b_partition {
h5_size_t i_start;
h5_size_t i_end;
h5_size_t j_start;
h5_size_t j_end;
h5_size_t k_start;
h5_size_t k_end;
h5_int64_t i_start;
h5_int64_t i_end;
h5_int64_t j_start;
h5_int64_t j_end;
h5_int64_t k_start;
h5_int64_t k_end;
};
struct h5b_fdata {
+24 -22
View File
@@ -37,49 +37,51 @@ h5b_3d_has_view (
h5_err_t
h5b_3d_set_view (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i_start, /*!< IN: start index of \c i */
const h5_size_t i_end, /*!< IN: end index of \c i */
const h5_size_t j_start, /*!< IN: start index of \c j */
const h5_size_t j_end, /*!< IN: end index of \c j */
const h5_size_t k_start, /*!< IN: start index of \c k */
const h5_size_t k_end /*!< IN: end index of \c k */
const h5_int64_t i_start, /*!< IN: start index of \c i */
const h5_int64_t i_end, /*!< IN: end index of \c i */
const h5_int64_t j_start, /*!< IN: start index of \c j */
const h5_int64_t j_end, /*!< IN: end index of \c j */
const h5_int64_t k_start, /*!< IN: start index of \c k */
const h5_int64_t k_end /*!< IN: end index of \c k */
);
h5_err_t
h5b_3d_get_view (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c k */
h5_int64_t *k_end /*!< OUT: end index of \c k */
);
h5_err_t
h5b_3d_get_reduced_view (
h5_file_t *const f, /*!< IN: File handle */
h5_size_t *i_start, /*!< OUT: start index of \c i */
h5_size_t *i_end, /*!< OUT: end index of \c i */
h5_size_t *j_start, /*!< OUT: start index of \c j */
h5_size_t *j_end, /*!< OUT: end index of \c j */
h5_size_t *k_start, /*!< OUT: start index of \c k */
h5_size_t *k_end /*!< OUT: end index of \c k */
h5_int64_t *i_start, /*!< OUT: start index of \c i */
h5_int64_t *i_end, /*!< OUT: end index of \c i */
h5_int64_t *j_start, /*!< OUT: start index of \c j */
h5_int64_t *j_end, /*!< OUT: end index of \c j */
h5_int64_t *k_start, /*!< OUT: start index of \c k */
h5_int64_t *k_end /*!< OUT: end index of \c k */
);
h5_err_t
h5b_3d_set_chunk (
h5_file_t *const f, /*!< IN: File handle */
const h5_size_t i, /*!< IN: size of \c i */
const h5_size_t j, /*!< IN: size of \c j */
const h5_size_t k /*!< IN: size of \c k */
const h5_int64_t i, /*!< IN: size of \c i */
const h5_int64_t j, /*!< IN: size of \c j */
const h5_int64_t k /*!< IN: size of \c k */
);
h5_err_t
h5b_3d_get_chunk (
h5_file_t *const f, /*!< IN: File handle */
const char *field_name, /*!< IN: name of dataset */
h5_size_t *dims /*!< OUT: array containing the chunk dimensions */
h5_int64_t *i, /*!< OUT: size of \c i */
h5_int64_t *j, /*!< OUT: size of \c j */
h5_int64_t *k /*!< OUT: size of \c k */
);
h5_err_t
+8 -7
View File
@@ -56,6 +56,7 @@ test_read_field_attribs(
static void
test_read_data64(h5_file_t *file, int step)
{
extern h5_size_t grid[3];
extern h5_size_t layout[6];
int i,t;
@@ -114,9 +115,9 @@ test_read_data64(h5_file_t *file, int step)
IVALUE(type[0], type[1], "field type");
IVALUE(field_rank[0], 3, "field rank");
IVALUE(field_dims[0], NBLOCKX, "field dims x");
IVALUE(field_dims[1], NBLOCKY, "field dims y");
IVALUE(field_dims[2], NBLOCKZ, "field dims z");
IVALUE(field_dims[0], grid[0]*NBLOCKX, "field dims x");
IVALUE(field_dims[1], grid[1]*NBLOCKY, "field dims y");
IVALUE(field_dims[2], grid[2]*NBLOCKZ, "field dims z");
if (i==1) {
CVALUE(name[0], 'e', "field name");
IVALUE(elem_rank[0], 1, "elem rank");
@@ -231,10 +232,10 @@ test_read_data32(h5_file_t *file, int step)
int i;
for (i=0; i<nelems; i++)
{
FVALUE(e[i] , 0.0 + (float)(i+nelems*t), " e data");
FVALUE(ex[i], 0.1 + (float)(i+nelems*t), " ex data");
FVALUE(ey[i], 0.2 + (float)(i+nelems*t), " ey data");
FVALUE(ez[i], 0.3 + (float)(i+nelems*t), " ez data");
FVALUE(e[i] , 0.0f + (float)(i+nelems*t), " e data");
FVALUE(ex[i], 0.1f + (float)(i+nelems*t), " ex data");
FVALUE(ey[i], 0.2f + (float)(i+nelems*t), " ey data");
FVALUE(ez[i], 0.3f + (float)(i+nelems*t), " ez data");
IVALUE(id[i], (i+nelems*t), " id data");
}
}
+1
View File
@@ -8,6 +8,7 @@
/* global */
h5_size_t grid[3];
h5_size_t layout[6];
h5_size_t fields_dims[3];
/* from write.c */
void h5b_test_write1(void);
+14 -8
View File
@@ -116,14 +116,14 @@ test_write_data32(h5_file_t *file, int step)
{
extern h5_size_t grid[3];
int i,t;
int i,j,k,t;
h5_int64_t status, val;
float *e;
float *ex,*ey,*ez;
int *id;
const size_t nelems = NBLOCKX * (NBLOCKY+2) * (NBLOCKZ+4);
size_t nelems = NBLOCKX * (NBLOCKY+2) * (NBLOCKZ+4);
e=(float*)malloc(nelems*sizeof(double));
ex=(float*)malloc(nelems*sizeof(double));
@@ -131,17 +131,23 @@ test_write_data32(h5_file_t *file, int step)
ez=(float*)malloc(nelems*sizeof(double));
id=(int*)malloc(nelems*sizeof(int));
nelems = NBLOCKX * NBLOCKY * NBLOCKZ;
TEST("Writing 32-bit data");
for (t=step; t<step+NTIMESTEPS; t++)
{
for (i=0; i<nelems; i++)
for (k=0; k<NBLOCKZ+4; k++)
for (j=0; j<NBLOCKY+2; j++)
for (i=0; i<NBLOCKX; i++)
{
e[i] = 0.0 + (float)(i+nelems*t);
ex[i] = 0.1 + (float)(i+nelems*t);
ey[i] = 0.2 + (float)(i+nelems*t);
ez[i] = 0.3 + (float)(i+nelems*t);
id[i] = i + nelems*t;
int idx = i + j*NBLOCKX + k*NBLOCKX*(NBLOCKY+2);
int n = i + (j-1)*NBLOCKX + (k-2)*NBLOCKX*NBLOCKY;
e[idx] = 0.0f + (float)(n+nelems*t);
ex[idx] = 0.1f + (float)(n+nelems*t);
ey[idx] = 0.2f + (float)(n+nelems*t);
ez[idx] = 0.3f + (float)(n+nelems*t);
id[idx] = n + nelems*t;
}
val = H5HasStep(file, t);