2003-10-23 05:30:19 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2008-10-29 03:13:42 +08:00
|
|
|
* Copyright by The HDF Group. *
|
|
|
|
* Copyright by the Board of Trustees of the University of Illinois. *
|
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
|
|
|
* the files COPYING and Copyright.html. COPYING can be found at the root *
|
|
|
|
* of the source code distribution tree; Copyright.html can be found at the *
|
|
|
|
* root level of an installed copy of the electronic HDF5 document set and *
|
|
|
|
* is linked from the top-level documents page. It can also be found at *
|
|
|
|
* http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
|
|
|
|
* access to either file, you may request a copy from help@hdfgroup.org. *
|
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
2003-10-23 05:30:19 +08:00
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
#include "H5private.h"
|
2004-03-03 02:12:25 +08:00
|
|
|
#include "h5tools.h"
|
2011-02-09 05:35:54 +08:00
|
|
|
#include "h5tools_utils.h"
|
|
|
|
#include "h5diff.h"
|
|
|
|
#include "ph5diff.h"
|
2003-10-23 05:30:19 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: diff_dataset
|
|
|
|
*
|
|
|
|
* Purpose: check for comparable datasets and read into a compatible
|
|
|
|
* memory type
|
|
|
|
*
|
|
|
|
* Return: Number of differences found
|
|
|
|
*
|
|
|
|
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
|
|
|
*
|
|
|
|
* Date: May 9, 2003
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2005-08-14 04:53:35 +08:00
|
|
|
hsize_t diff_dataset( hid_t file1_id,
|
|
|
|
hid_t file2_id,
|
|
|
|
const char *obj1_name,
|
|
|
|
const char *obj2_name,
|
2007-02-22 04:05:04 +08:00
|
|
|
diff_opt_t *options)
|
2003-10-23 05:30:19 +08:00
|
|
|
{
|
2008-05-01 03:51:13 +08:00
|
|
|
hid_t did1 = -1;
|
|
|
|
hid_t did2 = -1;
|
|
|
|
hid_t dcpl1 = -1;
|
|
|
|
hid_t dcpl2 = -1;
|
|
|
|
hsize_t nfound = 0;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* open the handles
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/* disable error reporting */
|
2010-01-30 12:29:13 +08:00
|
|
|
H5E_BEGIN_TRY
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Open the datasets */
|
2010-01-30 12:29:13 +08:00
|
|
|
if((did1 = H5Dopen2(file1_id, obj1_name, H5P_DEFAULT)) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("Cannot open dataset <%s>\n", obj1_name);
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
if((did2 = H5Dopen2(file2_id, obj2_name, H5P_DEFAULT)) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("Cannot open dataset <%s>\n", obj2_name);
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/* enable error reporting */
|
|
|
|
} H5E_END_TRY;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
if((dcpl1 = H5Dget_create_plist(did1)) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2008-10-29 03:13:42 +08:00
|
|
|
if((dcpl2 = H5Dget_create_plist(did2)) < 0)
|
|
|
|
{
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2008-10-29 03:13:42 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check if the dataset creation property list has filters that
|
|
|
|
* are not registered in the current configuration
|
|
|
|
* 1) the external filters GZIP and SZIP might not be available
|
|
|
|
* 2) the internal filters might be turned off
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
if ((h5tools_canreadf((options->m_verbose?obj1_name:NULL),dcpl1)==1) &&
|
|
|
|
(h5tools_canreadf((options->m_verbose?obj2_name:NULL),dcpl2)==1))
|
|
|
|
{
|
|
|
|
nfound=diff_datasetid(did1,
|
|
|
|
did2,
|
|
|
|
obj1_name,
|
|
|
|
obj2_name,
|
|
|
|
options);
|
|
|
|
}
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* close
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
/* disable error reporting */
|
2008-10-29 03:13:42 +08:00
|
|
|
H5E_BEGIN_TRY {
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Pclose(dcpl1);
|
|
|
|
H5Pclose(dcpl2);
|
|
|
|
H5Dclose(did1);
|
|
|
|
H5Dclose(did2);
|
|
|
|
/* enable error reporting */
|
|
|
|
} H5E_END_TRY;
|
2009-01-27 03:29:22 +08:00
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
return nfound;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2004-07-21 03:21:03 +08:00
|
|
|
error:
|
2008-05-01 03:51:13 +08:00
|
|
|
options->err_stat=1;
|
|
|
|
/* disable error reporting */
|
2008-10-29 03:13:42 +08:00
|
|
|
H5E_BEGIN_TRY {
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Pclose(dcpl1);
|
|
|
|
H5Pclose(dcpl2);
|
|
|
|
H5Dclose(did1);
|
|
|
|
H5Dclose(did2);
|
|
|
|
/* enable error reporting */
|
|
|
|
} H5E_END_TRY;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
return nfound;
|
2003-12-03 07:13:27 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2008-10-29 03:13:42 +08:00
|
|
|
* Function: diff_datasetid
|
|
|
|
*
|
|
|
|
* Purpose: check for comparable datasets and read into a compatible
|
|
|
|
* memory type
|
|
|
|
*
|
|
|
|
* Return: Number of differences found
|
|
|
|
*
|
|
|
|
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
|
|
|
*
|
|
|
|
* Date: May 9, 2003
|
|
|
|
*
|
|
|
|
* Modifications:
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* October 2006: Read by hyperslabs for big datasets.
|
|
|
|
*
|
|
|
|
* A threshold of H5TOOLS_MALLOCSIZE (128 MB) is the limit upon which I/O hyperslab is done
|
|
|
|
* i.e., if the memory needed to read a dataset is greater than this limit,
|
|
|
|
* then hyperslab I/O is done instead of one operation I/O
|
|
|
|
* For each dataset, the memory needed is calculated according to
|
|
|
|
*
|
|
|
|
* memory needed = number of elements * size of each element
|
|
|
|
*
|
|
|
|
* if the memory needed is lower than H5TOOLS_MALLOCSIZE, then the following operations
|
|
|
|
* are done
|
|
|
|
*
|
|
|
|
* H5Dread( input_dataset1 )
|
|
|
|
* H5Dread( input_dataset2 )
|
|
|
|
*
|
|
|
|
* with all elements in the datasets selected. If the memory needed is greater than
|
|
|
|
* H5TOOLS_MALLOCSIZE, then the following operations are done instead:
|
|
|
|
*
|
|
|
|
* a strip mine is defined for each dimension k (a strip mine is defined as a
|
|
|
|
* hyperslab whose size is memory manageable) according to the formula
|
|
|
|
*
|
|
|
|
* (1) strip_mine_size[k ] = MIN(dimension[k ], H5TOOLS_BUFSIZE / size of memory type)
|
|
|
|
*
|
|
|
|
* where H5TOOLS_BUFSIZE is a constant currently defined as 1MB. This formula assures
|
|
|
|
* that for small datasets (small relative to the H5TOOLS_BUFSIZE constant), the strip
|
|
|
|
* mine size k is simply defined as its dimension k, but for larger datasets the
|
|
|
|
* hyperslab size is still memory manageable.
|
|
|
|
* a cycle is done until the number of elements in the dataset is reached. In each
|
|
|
|
* iteration, two parameters are defined for the function H5Sselect_hyperslab,
|
|
|
|
* the start and size of each hyperslab, according to
|
|
|
|
*
|
|
|
|
* (2) hyperslab_size [k] = MIN(dimension[k] - hyperslab_offset[k], strip_mine_size [k])
|
|
|
|
*
|
|
|
|
* where hyperslab_offset [k] is initially set to zero, and later incremented in
|
|
|
|
* hyperslab_size[k] offsets. The reason for the operation
|
|
|
|
*
|
|
|
|
* dimension[k] - hyperslab_offset[k]
|
|
|
|
*
|
|
|
|
* in (2) is that, when using the strip mine size, it assures that the "remaining" part
|
|
|
|
* of the dataset that does not fill an entire strip mine is processed.
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2006-04-26 02:19:40 +08:00
|
|
|
hsize_t diff_datasetid( hid_t did1,
|
|
|
|
hid_t did2,
|
2005-08-14 04:53:35 +08:00
|
|
|
const char *obj1_name,
|
|
|
|
const char *obj2_name,
|
2007-02-22 04:05:04 +08:00
|
|
|
diff_opt_t *options)
|
2003-12-03 07:13:27 +08:00
|
|
|
{
|
2008-05-01 03:51:13 +08:00
|
|
|
hid_t sid1=-1;
|
|
|
|
hid_t sid2=-1;
|
|
|
|
hid_t f_tid1=-1;
|
2008-09-16 23:52:51 +08:00
|
|
|
hid_t f_tid2=-1;
|
2008-05-01 03:51:13 +08:00
|
|
|
hid_t m_tid1=-1;
|
2008-09-16 23:52:51 +08:00
|
|
|
hid_t m_tid2=-1;
|
2008-05-01 03:51:13 +08:00
|
|
|
size_t m_size1;
|
2008-09-16 23:52:51 +08:00
|
|
|
size_t m_size2;
|
2008-05-01 03:51:13 +08:00
|
|
|
H5T_sign_t sign1;
|
2008-09-16 23:52:51 +08:00
|
|
|
H5T_sign_t sign2;
|
2008-05-01 03:51:13 +08:00
|
|
|
int rank1;
|
|
|
|
int rank2;
|
|
|
|
hsize_t nelmts1;
|
|
|
|
hsize_t nelmts2;
|
|
|
|
hsize_t dims1[H5S_MAX_RANK];
|
|
|
|
hsize_t dims2[H5S_MAX_RANK];
|
|
|
|
hsize_t maxdim1[H5S_MAX_RANK];
|
|
|
|
hsize_t maxdim2[H5S_MAX_RANK];
|
|
|
|
const char *name1=NULL; /* relative names */
|
|
|
|
const char *name2=NULL;
|
|
|
|
hsize_t storage_size1;
|
|
|
|
hsize_t storage_size2;
|
|
|
|
hsize_t nfound=0; /* number of differences found */
|
2009-01-27 03:29:22 +08:00
|
|
|
int can_compare=1; /* do diff or not */
|
2008-09-16 23:52:51 +08:00
|
|
|
void *buf1=NULL;
|
|
|
|
void *buf2=NULL;
|
|
|
|
void *sm_buf1=NULL;
|
2008-05-01 03:51:13 +08:00
|
|
|
void *sm_buf2=NULL;
|
2011-03-18 07:00:14 +08:00
|
|
|
hid_t sm_space; /*stripmine data space */
|
2008-05-01 03:51:13 +08:00
|
|
|
size_t need; /* bytes needed for malloc */
|
|
|
|
int i;
|
2011-03-18 07:00:14 +08:00
|
|
|
unsigned int vl_data = 0; /*contains VL datatypes */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("diff_datasetid start\n");
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get the dataspace handle */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (sid1 = H5Dget_space(did1)) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get rank */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (rank1 = H5Sget_simple_extent_ndims(sid1)) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get the dataspace handle */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (sid2 = H5Dget_space(did2)) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get rank */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (rank2 = H5Sget_simple_extent_ndims(sid2)) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get dimensions */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( H5Sget_simple_extent_dims(sid1,dims1,maxdim1) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get dimensions */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( H5Sget_simple_extent_dims(sid2,dims2,maxdim2) < 0 )
|
2008-10-29 03:13:42 +08:00
|
|
|
{
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2008-10-29 03:13:42 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-10-29 03:13:42 +08:00
|
|
|
* get the file data type
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get the data type */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (f_tid1 = H5Dget_type(did1)) < 0 )
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* Get the data type */
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( (f_tid2 = H5Dget_type(did2)) < 0 )
|
2008-10-29 03:13:42 +08:00
|
|
|
{
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2008-10-29 03:13:42 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-10-29 03:13:42 +08:00
|
|
|
* check for empty datasets
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("check for empty datasets\n");
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
storage_size1=H5Dget_storage_size(did1);
|
|
|
|
storage_size2=H5Dget_storage_size(did2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if (storage_size1==0 || storage_size2==0)
|
|
|
|
{
|
2009-01-27 03:29:22 +08:00
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
2009-05-29 05:31:57 +08:00
|
|
|
parallel_print("Not comparable: <%s> or <%s> is an empty dataset\n", obj1_name, obj2_name);
|
2009-01-27 03:29:22 +08:00
|
|
|
can_compare=0;
|
2008-05-01 03:51:13 +08:00
|
|
|
options->not_cmp=1;
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for comparable TYPE and SPACE
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if (diff_can_type(f_tid1,
|
|
|
|
f_tid2,
|
|
|
|
rank1,
|
|
|
|
rank2,
|
|
|
|
dims1,
|
|
|
|
dims2,
|
|
|
|
maxdim1,
|
|
|
|
maxdim2,
|
|
|
|
obj1_name,
|
|
|
|
obj2_name,
|
2009-02-11 23:57:25 +08:00
|
|
|
options,
|
|
|
|
0)!=1)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2009-01-27 03:29:22 +08:00
|
|
|
can_compare=0;
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* memory type and sizes
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("check for memory type and sizes\n");
|
2008-05-01 03:51:13 +08:00
|
|
|
if ((m_tid1=h5tools_get_native_type(f_tid1)) < 0)
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if ((m_tid2=h5tools_get_native_type(f_tid2)) < 0)
|
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
m_size1 = H5Tget_size( m_tid1 );
|
|
|
|
m_size2 = H5Tget_size( m_tid2 );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for different signed/unsigned types
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2011-09-17 03:29:03 +08:00
|
|
|
if (can_compare)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("can_compare for sign\n");
|
2011-09-17 03:29:03 +08:00
|
|
|
sign1=H5Tget_sign(m_tid1);
|
|
|
|
sign2=H5Tget_sign(m_tid2);
|
|
|
|
if ( sign1 != sign2 )
|
2009-01-27 03:29:22 +08:00
|
|
|
{
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("sign1 != sign2\n");
|
2011-09-17 03:29:03 +08:00
|
|
|
if ((options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
|
|
|
{
|
|
|
|
parallel_print("Not comparable: <%s> has sign %s ", obj1_name, get_sign(sign1));
|
|
|
|
parallel_print("and <%s> has sign %s\n", obj2_name, get_sign(sign2));
|
|
|
|
}
|
|
|
|
|
|
|
|
can_compare=0;
|
|
|
|
options->not_cmp=1;
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
|
|
|
}
|
2011-07-16 07:02:50 +08:00
|
|
|
|
2011-03-18 07:00:14 +08:00
|
|
|
/* Check if type is either VLEN-data or VLEN-string to reclaim any
|
|
|
|
* VLEN memory buffer later */
|
2011-03-22 07:02:31 +08:00
|
|
|
if( TRUE == h5tools_detect_vlen(m_tid1) )
|
2011-03-18 07:00:14 +08:00
|
|
|
vl_data = TRUE;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-09-17 03:29:03 +08:00
|
|
|
/*------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* only attempt to compare if possible
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2011-02-06 11:24:42 +08:00
|
|
|
if(can_compare) /* it is possible to compare */
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("can_compare attempt\n");
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-09-17 03:29:03 +08:00
|
|
|
/*-----------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* get number of elements
|
2011-09-17 03:29:03 +08:00
|
|
|
*------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
*/
|
|
|
|
nelmts1 = 1;
|
2011-02-06 11:24:42 +08:00
|
|
|
for(i = 0; i < rank1; i++)
|
2008-05-01 03:51:13 +08:00
|
|
|
nelmts1 *= dims1[i];
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
nelmts2 = 1;
|
2011-02-06 11:24:42 +08:00
|
|
|
for(i = 0; i < rank2; i++)
|
2008-05-01 03:51:13 +08:00
|
|
|
nelmts2 *= dims2[i];
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
HDassert(nelmts1 == nelmts2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-09-17 03:29:03 +08:00
|
|
|
/*-----------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* "upgrade" the smaller memory size
|
2011-09-17 03:29:03 +08:00
|
|
|
*------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
*/
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("upgrade the smaller memory size?\n");
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
if(m_size1 != m_size2) {
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("m_size1 != m_size2\n");
|
2011-02-06 11:24:42 +08:00
|
|
|
if(m_size1 < m_size2) {
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Tclose(m_tid1);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
if((m_tid1 = h5tools_get_native_type(f_tid2)) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
m_size1 = H5Tget_size(m_tid1);
|
|
|
|
} /* end if */
|
|
|
|
else {
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Tclose(m_tid2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
if((m_tid2 = h5tools_get_native_type(f_tid1)) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
m_size2 = H5Tget_size(m_tid2);
|
|
|
|
} /* end else */
|
|
|
|
} /* end if */
|
|
|
|
HDassert(m_size1 == m_size2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* print names */
|
2011-02-06 11:24:42 +08:00
|
|
|
if(obj1_name)
|
|
|
|
name1 = diff_basename(obj1_name);
|
|
|
|
if(obj2_name)
|
|
|
|
name2 = diff_basename(obj2_name);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
|
|
|
|
2011-09-17 03:29:03 +08:00
|
|
|
/*----------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* read/compare
|
2011-09-17 03:29:03 +08:00
|
|
|
*-----------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
*/
|
2011-02-06 11:24:42 +08:00
|
|
|
need = (size_t)(nelmts1 * m_size1); /* bytes needed */
|
|
|
|
if(need < H5TOOLS_MALLOCSIZE) {
|
2008-05-01 03:51:13 +08:00
|
|
|
buf1 = HDmalloc(need);
|
|
|
|
buf2 = HDmalloc(need);
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* end if */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
if(buf1 != NULL && buf2 != NULL) {
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("buf1 != NULL && buf2 != NULL\n");
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Dread(did1, m_tid1, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf1) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Dread(did2, m_tid2, H5S_ALL, H5S_ALL, H5P_DEFAULT, buf2) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* array diff */
|
2011-02-06 11:24:42 +08:00
|
|
|
nfound = diff_array(buf1, buf2, nelmts1, (hsize_t)0, rank1, dims1,
|
|
|
|
options, name1, name2, m_tid1, did1, did2);
|
|
|
|
|
|
|
|
/* reclaim any VL memory, if necessary */
|
2012-02-28 03:25:22 +08:00
|
|
|
if(vl_data) {
|
2011-02-06 11:24:42 +08:00
|
|
|
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
|
|
|
|
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
|
|
|
|
} /* end if */
|
|
|
|
} /* end if */
|
2008-05-01 03:51:13 +08:00
|
|
|
else /* possibly not enough memory, read/compare by hyperslabs */
|
|
|
|
{
|
|
|
|
size_t p_type_nbytes = m_size1; /*size of memory type */
|
|
|
|
hsize_t p_nelmts = nelmts1; /*total selected elmts */
|
|
|
|
hsize_t elmtno; /*counter */
|
|
|
|
int carry; /*counter carry value */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* stripmine info */
|
|
|
|
hsize_t sm_size[H5S_MAX_RANK]; /*stripmine size */
|
|
|
|
hsize_t sm_nbytes; /*bytes per stripmine */
|
|
|
|
hsize_t sm_nelmts; /*elements per stripmine*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* hyperslab info */
|
|
|
|
hsize_t hs_offset[H5S_MAX_RANK]; /*starting offset */
|
|
|
|
hsize_t hs_size[H5S_MAX_RANK]; /*size this pass */
|
|
|
|
hsize_t hs_nelmts; /*elements in request */
|
|
|
|
hsize_t zero[8]; /*vector of zeros */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
/*
|
|
|
|
* determine the strip mine size and allocate a buffer. The strip mine is
|
|
|
|
* a hyperslab whose size is manageable.
|
|
|
|
*/
|
2008-05-01 03:51:13 +08:00
|
|
|
sm_nbytes = p_type_nbytes;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
for(i = rank1; i > 0; --i) {
|
[svn-r16614] 3. #1501 (B1) tools bug if dataset is larger than H5TOOLS_BUFSIZE limit.
ISSUE : the tools use the following formula to read by hyperslabs: hyperslab_size[i] = MIN( dim_size[i], H5TOOLS_BUFSIZE / datum_size) where H5TOOLS_BUFSIZE is a constant defined of 1024K. This is OK as long as the datum_size does not exceed 1024K, otherwise we have a hyperslab size of 0 (since 1024K/(greater than 1024K) = 0). This affects h5dump. h5repack, h5diff
SOLUTION: add a check for a 0 size and define as 1 if so.
TEST FOR H5DUMP: Defined a case in the h5dump test generator program of such a type (an array type of doubles with a large array dimension, that was the case the user reported). Since the written file commited in svn would be around 1024K, opted for not writing the data (the part of the code where the hyperslab is defined is executed, since h5dump always reads the files). Defined a macro WRITE_ARRAY to enable such writing if needed. Added a run on the h5dump shell script. Added 2 new files to svn: tools/testfiles/tarray8.ddl, tools/testfiles/tarray8.h5. NOTE: while doing this I thought of adding this dataset case to an existing file, but that would add the large array output to those files (the ddls). The issue is that the file list is increasing.
TEST FOR H5DIFF: for h5diff the check for reading by hyperslabs is H5TOOLS_MALLOCSIZE (128 * H5TOOLS_BUFSIZE) or 128 Mb. This makes it not possible to add such a file to svn, so used the same method as h5dump (only write the dataset if WRITE_ARRAY is defined). As opposed to h5dump, the hyperslab code is NOT executed when the dataset is empty (dataset is not read). Added the new dataset to existing files and shell run (tools/h5diff/testfiles/h5diff_dset1.h5 and tools/h5diff/testfiles/h5diff_dset2.h5 and output in tools/h5diff/testfiles/h5diff_80.txt).
TEST FOR H5REPACK: similar issue as h5diff with the difference that the hyperslab code is run. Added a run to the shell script (with a filter, otherwise the code uses H5Ocopy).
tested: linux (h5commitest failed , apparently it did not detect the code changes in /tools/lib that fix the bug: the error in an assertion in the hyperslab of 0. I am sure that making h5ccomitest --distclean will detect the new code , but don't want to wait more 3 hours :-) )
2009-03-26 04:28:50 +08:00
|
|
|
hsize_t size = H5TOOLS_BUFSIZE / sm_nbytes;
|
2011-02-06 11:24:42 +08:00
|
|
|
|
|
|
|
if(size == 0) /* datum size > H5TOOLS_BUFSIZE */
|
[svn-r16614] 3. #1501 (B1) tools bug if dataset is larger than H5TOOLS_BUFSIZE limit.
ISSUE : the tools use the following formula to read by hyperslabs: hyperslab_size[i] = MIN( dim_size[i], H5TOOLS_BUFSIZE / datum_size) where H5TOOLS_BUFSIZE is a constant defined of 1024K. This is OK as long as the datum_size does not exceed 1024K, otherwise we have a hyperslab size of 0 (since 1024K/(greater than 1024K) = 0). This affects h5dump. h5repack, h5diff
SOLUTION: add a check for a 0 size and define as 1 if so.
TEST FOR H5DUMP: Defined a case in the h5dump test generator program of such a type (an array type of doubles with a large array dimension, that was the case the user reported). Since the written file commited in svn would be around 1024K, opted for not writing the data (the part of the code where the hyperslab is defined is executed, since h5dump always reads the files). Defined a macro WRITE_ARRAY to enable such writing if needed. Added a run on the h5dump shell script. Added 2 new files to svn: tools/testfiles/tarray8.ddl, tools/testfiles/tarray8.h5. NOTE: while doing this I thought of adding this dataset case to an existing file, but that would add the large array output to those files (the ddls). The issue is that the file list is increasing.
TEST FOR H5DIFF: for h5diff the check for reading by hyperslabs is H5TOOLS_MALLOCSIZE (128 * H5TOOLS_BUFSIZE) or 128 Mb. This makes it not possible to add such a file to svn, so used the same method as h5dump (only write the dataset if WRITE_ARRAY is defined). As opposed to h5dump, the hyperslab code is NOT executed when the dataset is empty (dataset is not read). Added the new dataset to existing files and shell run (tools/h5diff/testfiles/h5diff_dset1.h5 and tools/h5diff/testfiles/h5diff_dset2.h5 and output in tools/h5diff/testfiles/h5diff_80.txt).
TEST FOR H5REPACK: similar issue as h5diff with the difference that the hyperslab code is run. Added a run to the shell script (with a filter, otherwise the code uses H5Ocopy).
tested: linux (h5commitest failed , apparently it did not detect the code changes in /tools/lib that fix the bug: the error in an assertion in the hyperslab of 0. I am sure that making h5ccomitest --distclean will detect the new code , but don't want to wait more 3 hours :-) )
2009-03-26 04:28:50 +08:00
|
|
|
size = 1;
|
|
|
|
sm_size[i - 1] = MIN(dims1[i - 1], size);
|
2008-05-01 03:51:13 +08:00
|
|
|
sm_nbytes *= sm_size[i - 1];
|
2012-02-24 03:08:09 +08:00
|
|
|
HDassert(sm_nbytes > 0);
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* end for */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2012-02-24 03:08:09 +08:00
|
|
|
/* malloc return code should be verified.
|
[svn-r17953] Description:
Bring Coverity changes into the trunk:
r17877:
Error 266: Uninitialized memspace set to -1. Changed malloc and free to HDmalloc and HDfree. Removed unused dtype var.
r17878:
Error 265: Uninitialized mem_space set to -1. Changed malloc and free to HDmalloc and HDfree.
Error 267: Uninitialized smspace set to -1. Changed malloc and free to HDmalloc and HDfree.
r17879:
Error 242: Uninitialized aid set to -1.
Error 243: Uninitialized sid set to -1.
Uninitialized tid set to -1 for consistency
r17880:
Error 242: reinitialized aid to -1 after close to be ready for reuse.
Error 243: reinitialized sid to -1 after close to be ready for reuse.
reinitialized tid to -1 for consistency after close to be ready for reuse.
r17881:
use valgrind to check there is a memory leak. The fix is to free ptrstr in line 5838 at xml_dump_group() of h5dump.c after it is used. run the valgrind after the fix, no memory leak for that part of the code.
r17882:
Fix Coverity items 256 and 269.
r17883:
Error 222-230: initialized hid_t vars to -1 after close to be ready for reuse.
Also added H5Tclose for tid in gent_bigdims
r17884:
Bug fix (Coverity run2, view 23, dead code)
(this is pair-program done by Albert, Elena and Larry).
Confirmed and fixed the deadcode in hyperslab read branch of function
diff_datasetid.
(Discovered other bad code that diff_datasetid() should be recoded.
Bug 1693 is entered for this.)
r17906:
Fix Coverity item 260.
r17907:
262: Initialized hid_t's dtype, dtype_tmp and file to -1. Initialized H5T_t * dt to NULL.
r17908:
Fix Coverity item 261.
r17909:
Fix Coverity item 248.
r17910:
Revise fix for Coverity item 248.
r17911:
Resolved coverity issues #s 263, 162, 163, 164. All issues in dsets.c. Initialized fid and did hid_t's. filter_corrupt function was returning in the middle of an if statement, bypassing free calls. Updated error handling to free buffers and hid_t's appropriately.
r17912:
(done by Larry and Albert)
Cleanup Coverity view warnings (#231-241) about
using uninitialized variables. Initialized all
of them.
r17913:
Resolved issue 251 and 264. Initialized tid2 to -1 and initialized buffers that were freed in case of an error.
r17914:
Resolved coverity issues 66, 220, and 221:
66: Negative Return assignment ignored
220,221: Initialized hid_t's.
r17915:
Fix Coverity item 247.
r17916:
Fix Coverity item 246.
r17917:
Fix Coverity item 245.
r17918:
Fix Coverity item 244.
r17919:
Coverity Issue #84: Moved asserts in H5T_cmp to the top of the function, and converted them to HDassert. Coverity complaining about using potentially NULL pointer without checking it. Want to see if Coverity will accept Assertions as acceptable checking before using the value.
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 (smirom) 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, in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Mac OS X/32 10.6.2 (amazon) in debug mode
Mac OS X/32 10.6.2 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
2009-12-04 03:11:29 +08:00
|
|
|
* If fail, need to handle the error.
|
|
|
|
* This else branch should be recoded as a separate function.
|
|
|
|
* Note that there are many "goto error" within this branch
|
|
|
|
* that fails to address freeing other objects created here.
|
2012-02-24 03:08:09 +08:00
|
|
|
* E.g., sm_space.
|
|
|
|
*/
|
|
|
|
sm_buf1 = HDmalloc((size_t)sm_nbytes);
|
|
|
|
HDassert(sm_buf1);
|
|
|
|
sm_buf2 = HDmalloc((size_t)sm_nbytes);
|
|
|
|
HDassert(sm_buf2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
sm_nelmts = sm_nbytes / p_type_nbytes;
|
|
|
|
sm_space = H5Screate_simple(1, &sm_nelmts, NULL);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* the stripmine loop */
|
2012-02-24 03:08:09 +08:00
|
|
|
HDmemset(hs_offset, 0, sizeof hs_offset);
|
|
|
|
HDmemset(zero, 0, sizeof zero);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
for(elmtno = 0; elmtno < p_nelmts; elmtno += hs_nelmts) {
|
2008-05-01 03:51:13 +08:00
|
|
|
/* calculate the hyperslab size */
|
2011-02-06 11:24:42 +08:00
|
|
|
if(rank1 > 0) {
|
|
|
|
for(i = 0, hs_nelmts = 1; i < rank1; i++) {
|
2008-05-01 03:51:13 +08:00
|
|
|
hs_size[i] = MIN(dims1[i] - hs_offset[i], sm_size[i]);
|
|
|
|
hs_nelmts *= hs_size[i];
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* end for */
|
|
|
|
if(H5Sselect_hyperslab(sid1, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Sselect_hyperslab(sid2, H5S_SELECT_SET, hs_offset, NULL, hs_size, NULL) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Sselect_hyperslab(sm_space, H5S_SELECT_SET, zero, NULL, &hs_nelmts, NULL) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* end if */
|
2008-09-16 23:52:51 +08:00
|
|
|
else
|
2008-05-01 03:51:13 +08:00
|
|
|
hs_nelmts = 1;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Dread(did1,m_tid1,sm_space,sid1,H5P_DEFAULT,sm_buf1) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2011-02-06 11:24:42 +08:00
|
|
|
if(H5Dread(did2,m_tid2,sm_space,sid2,H5P_DEFAULT,sm_buf2) < 0)
|
2008-05-01 03:51:13 +08:00
|
|
|
goto error;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/* get array differences. in the case of hyperslab read, increment the number of differences
|
|
|
|
found in each hyperslab and pass the position at the beggining for printing */
|
2011-02-06 11:24:42 +08:00
|
|
|
nfound += diff_array(sm_buf1, sm_buf2, hs_nelmts, elmtno, rank1,
|
|
|
|
dims1, options, name1, name2, m_tid1, did1, did2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* reclaim any VL memory, if necessary */
|
2011-02-06 11:24:42 +08:00
|
|
|
if(vl_data) {
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
|
|
|
|
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2);
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* end if */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
/* calculate the next hyperslab offset */
|
2011-02-06 11:24:42 +08:00
|
|
|
for(i = rank1, carry = 1; i > 0 && carry; --i) {
|
2008-05-01 03:51:13 +08:00
|
|
|
hs_offset[i - 1] += hs_size[i - 1];
|
2011-02-06 11:24:42 +08:00
|
|
|
if(hs_offset[i - 1] == dims1[i - 1])
|
2008-05-01 03:51:13 +08:00
|
|
|
hs_offset[i - 1] = 0;
|
|
|
|
else
|
|
|
|
carry = 0;
|
|
|
|
} /* i */
|
|
|
|
} /* elmtno */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
H5Sclose(sm_space);
|
2011-02-06 11:24:42 +08:00
|
|
|
} /* hyperslab read */
|
|
|
|
} /*can_compare*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* compare attributes
|
|
|
|
* the if condition refers to cases when the dataset is a referenced object
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("compare attributes?\n");
|
2011-02-06 11:24:42 +08:00
|
|
|
if(obj1_name)
|
|
|
|
nfound += diff_attr(did1,did2,obj1_name,obj2_name,options);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* close
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("compare attributes?\n");
|
2011-02-06 11:24:42 +08:00
|
|
|
|
|
|
|
/* free */
|
|
|
|
if(buf1 != NULL) {
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(buf1);
|
2011-02-06 11:24:42 +08:00
|
|
|
buf1 = NULL;
|
|
|
|
} /* end if */
|
|
|
|
if(buf2 != NULL) {
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(buf2);
|
2011-02-06 11:24:42 +08:00
|
|
|
buf2 = NULL;
|
|
|
|
} /* end if */
|
|
|
|
if(sm_buf1 != NULL) {
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(sm_buf1);
|
2011-02-06 11:24:42 +08:00
|
|
|
sm_buf1 = NULL;
|
|
|
|
} /* end if */
|
|
|
|
if(sm_buf2 != NULL) {
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(sm_buf2);
|
2011-02-06 11:24:42 +08:00
|
|
|
sm_buf2 = NULL;
|
|
|
|
} /* end if */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
H5Sclose(sid1);
|
|
|
|
H5Sclose(sid2);
|
|
|
|
H5Tclose(f_tid1);
|
|
|
|
H5Tclose(f_tid2);
|
|
|
|
H5Tclose(m_tid1);
|
|
|
|
H5Tclose(m_tid2);
|
|
|
|
} H5E_END_TRY;
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("diff_datasetid finish\n");
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-02-06 11:24:42 +08:00
|
|
|
return nfound;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
error:
|
2011-02-06 11:24:42 +08:00
|
|
|
options->err_stat=1;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2011-03-18 07:00:14 +08:00
|
|
|
/* free */
|
|
|
|
if (buf1!=NULL)
|
|
|
|
{
|
|
|
|
/* reclaim any VL memory, if necessary */
|
2011-07-16 07:02:50 +08:00
|
|
|
if(vl_data)
|
2011-03-18 07:00:14 +08:00
|
|
|
H5Dvlen_reclaim(m_tid1, sid1, H5P_DEFAULT, buf1);
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(buf1);
|
2011-03-18 07:00:14 +08:00
|
|
|
buf1=NULL;
|
|
|
|
}
|
|
|
|
if (buf2!=NULL)
|
|
|
|
{
|
|
|
|
/* reclaim any VL memory, if necessary */
|
2011-07-16 07:02:50 +08:00
|
|
|
if(vl_data)
|
2011-03-18 07:00:14 +08:00
|
|
|
H5Dvlen_reclaim(m_tid2, sid2, H5P_DEFAULT, buf2);
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(buf2);
|
2011-03-18 07:00:14 +08:00
|
|
|
buf2=NULL;
|
|
|
|
}
|
|
|
|
if (sm_buf1!=NULL)
|
|
|
|
{
|
|
|
|
/* reclaim any VL memory, if necessary */
|
|
|
|
if(vl_data)
|
|
|
|
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf1);
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(sm_buf1);
|
2011-03-18 07:00:14 +08:00
|
|
|
sm_buf1=NULL;
|
|
|
|
}
|
|
|
|
if (sm_buf2!=NULL)
|
|
|
|
{
|
|
|
|
/* reclaim any VL memory, if necessary */
|
|
|
|
if(vl_data)
|
|
|
|
H5Dvlen_reclaim(m_tid1, sm_space, H5P_DEFAULT, sm_buf2);
|
2012-02-24 03:08:09 +08:00
|
|
|
HDfree(sm_buf2);
|
2011-03-18 07:00:14 +08:00
|
|
|
sm_buf2=NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* disable error reporting */
|
|
|
|
H5E_BEGIN_TRY {
|
|
|
|
H5Sclose(sid1);
|
|
|
|
H5Sclose(sid2);
|
|
|
|
H5Tclose(f_tid1);
|
|
|
|
H5Tclose(f_tid2);
|
|
|
|
H5Tclose(m_tid1);
|
|
|
|
H5Tclose(m_tid2);
|
|
|
|
/* enable error reporting */
|
|
|
|
} H5E_END_TRY;
|
2012-08-04 04:11:36 +08:00
|
|
|
h5difftrace("diff_datasetid errored\n");
|
2011-03-18 07:00:14 +08:00
|
|
|
|
|
|
|
return nfound;
|
2003-10-23 05:30:19 +08:00
|
|
|
}
|
|
|
|
|
2003-11-04 06:10:57 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-10-29 03:13:42 +08:00
|
|
|
* Function: diff_can_type
|
|
|
|
*
|
|
|
|
* Purpose: check for comparable TYPE and SPACE
|
|
|
|
*
|
|
|
|
* Return:
|
|
|
|
* 1, can compare
|
|
|
|
* 0, cannot compare
|
|
|
|
* -1, error
|
|
|
|
*
|
|
|
|
* Programmer: Pedro Vicente, pvn@ncsa.uiuc.edu
|
|
|
|
*
|
|
|
|
* Date: November 3, 2003
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2003-11-04 06:10:57 +08:00
|
|
|
|
2006-04-26 02:19:40 +08:00
|
|
|
int diff_can_type( hid_t f_tid1, /* file data type */
|
|
|
|
hid_t f_tid2, /* file data type */
|
2005-08-14 04:53:35 +08:00
|
|
|
int rank1,
|
2003-11-04 06:10:57 +08:00
|
|
|
int rank2,
|
2005-08-14 04:53:35 +08:00
|
|
|
hsize_t *dims1,
|
2003-11-04 06:10:57 +08:00
|
|
|
hsize_t *dims2,
|
2005-08-14 04:53:35 +08:00
|
|
|
hsize_t *maxdim1,
|
2003-11-04 06:10:57 +08:00
|
|
|
hsize_t *maxdim2,
|
2005-08-14 04:53:35 +08:00
|
|
|
const char *obj1_name,
|
|
|
|
const char *obj2_name,
|
2009-02-11 23:57:25 +08:00
|
|
|
diff_opt_t *options,
|
|
|
|
int is_compound)
|
2003-11-04 06:10:57 +08:00
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
H5T_class_t tclass1;
|
|
|
|
H5T_class_t tclass2;
|
|
|
|
int maxdim_diff=0; /* maximum dimensions are different */
|
|
|
|
int dim_diff=0; /* current dimensions are different */
|
|
|
|
int i;
|
2009-01-27 03:29:22 +08:00
|
|
|
int can_compare = 1; /* return value */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for the same class
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if ((tclass1=H5Tget_class(f_tid1)) < 0)
|
|
|
|
return -1;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if ((tclass2=H5Tget_class(f_tid2)) < 0)
|
|
|
|
return -1;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( tclass1 != tclass2 )
|
|
|
|
{
|
2009-02-11 23:57:25 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
if ( is_compound )
|
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-04-21 04:59:40 +08:00
|
|
|
parallel_print("Not comparable: <%s> has a class %s and <%s> has a class %s\n",
|
2009-02-11 23:57:25 +08:00
|
|
|
obj1_name, get_class(tclass1),
|
|
|
|
obj2_name, get_class(tclass2) );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
else
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-05-20 22:07:22 +08:00
|
|
|
parallel_print("Not comparable: <%s> is of class %s and <%s> is of class %s\n",
|
2009-02-11 23:57:25 +08:00
|
|
|
obj1_name, get_class(tclass1),
|
|
|
|
obj2_name, get_class(tclass2) );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
}
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2009-02-11 23:57:25 +08:00
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
return can_compare;
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for non supported classes
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2012-02-24 03:08:09 +08:00
|
|
|
HDassert(tclass1==tclass2);
|
2008-05-01 03:51:13 +08:00
|
|
|
switch (tclass1)
|
|
|
|
{
|
|
|
|
case H5T_INTEGER:
|
|
|
|
case H5T_FLOAT:
|
|
|
|
case H5T_COMPOUND:
|
|
|
|
case H5T_STRING:
|
|
|
|
case H5T_ARRAY:
|
|
|
|
case H5T_BITFIELD:
|
|
|
|
case H5T_OPAQUE:
|
|
|
|
case H5T_ENUM:
|
|
|
|
case H5T_VLEN:
|
|
|
|
case H5T_REFERENCE:
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
break;
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
default: /*H5T_TIME */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
|
|
|
{
|
2009-04-21 04:59:40 +08:00
|
|
|
parallel_print("Not comparable: <%s> and <%s> are of class %s\n",
|
2009-01-27 03:29:22 +08:00
|
|
|
obj1_name,obj2_name,get_class(tclass2) );
|
|
|
|
}
|
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
return can_compare;
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for equal file datatype; warning only
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
if ( (H5Tequal(f_tid1, f_tid2)==0) &&
|
|
|
|
(options->m_verbose) && obj1_name && obj2_name)
|
2008-05-01 03:51:13 +08:00
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
H5T_class_t cl = H5Tget_class(f_tid1);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
parallel_print("Warning: different storage datatype\n");
|
2008-10-29 03:13:42 +08:00
|
|
|
if ( cl == H5T_INTEGER || cl == H5T_FLOAT )
|
|
|
|
{
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("<%s> has file datatype ", obj1_name);
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(f_tid1);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("<%s> has file datatype ", obj2_name);
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(f_tid2);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n");
|
2008-10-29 03:13:42 +08:00
|
|
|
}
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for the same rank
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-05-29 05:31:57 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if ( rank1 != rank2 )
|
|
|
|
{
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
|
|
|
{
|
2009-04-21 04:59:40 +08:00
|
|
|
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank1,dims1);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print(", max dimensions ");
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank1,maxdim1);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n" );
|
2009-05-29 05:31:57 +08:00
|
|
|
parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank2,dims2);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print(", max dimensions ");
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank2,maxdim2);
|
2009-01-27 23:33:17 +08:00
|
|
|
parallel_print("\n");
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
return can_compare;
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* check for different dimensions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2012-02-24 03:08:09 +08:00
|
|
|
HDassert(rank1==rank2);
|
2008-05-01 03:51:13 +08:00
|
|
|
for ( i=0; i<rank1; i++)
|
|
|
|
{
|
|
|
|
if (maxdim1 && maxdim2)
|
|
|
|
{
|
|
|
|
if ( maxdim1[i] != maxdim2[i] )
|
|
|
|
maxdim_diff=1;
|
|
|
|
}
|
|
|
|
if ( dims1[i] != dims2[i] )
|
|
|
|
dim_diff=1;
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* current dimensions
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if (dim_diff==1)
|
|
|
|
{
|
2009-01-27 03:29:22 +08:00
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
|
|
|
{
|
2009-04-21 04:59:40 +08:00
|
|
|
parallel_print("Not comparable: <%s> has rank %d, dimensions ", obj1_name, rank1);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank1,dims1);
|
2010-01-30 12:29:13 +08:00
|
|
|
if (maxdim1 && maxdim2)
|
2009-01-27 03:29:22 +08:00
|
|
|
{
|
|
|
|
parallel_print(", max dimensions ");
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank1,maxdim1);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n" );
|
2009-05-29 05:31:57 +08:00
|
|
|
parallel_print("and <%s> has rank %d, dimensions ", obj2_name, rank2);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank2,dims2);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print(", max dimensions ");
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank2,maxdim2);
|
2009-01-27 23:33:17 +08:00
|
|
|
parallel_print("\n");
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
|
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
return can_compare;
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-05-01 03:51:13 +08:00
|
|
|
* maximum dimensions; just give a warning
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
if (maxdim1 && maxdim2 && maxdim_diff==1 && obj1_name )
|
|
|
|
{
|
2008-10-29 03:13:42 +08:00
|
|
|
if (options->m_verbose) {
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print( "Warning: different maximum dimensions\n");
|
|
|
|
parallel_print("<%s> has max dimensions ", obj1_name);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank1,maxdim1);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("<%s> has max dimensions ", obj2_name);
|
2008-05-01 03:51:13 +08:00
|
|
|
print_dimensions(rank2,maxdim2);
|
2009-01-27 03:29:22 +08:00
|
|
|
parallel_print("\n");
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
|
|
|
}
|
2009-02-11 23:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
|
if ( tclass1 == H5T_COMPOUND )
|
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
int nmembs1;
|
|
|
|
int nmembs2;
|
|
|
|
int j;
|
|
|
|
hid_t memb_type1;
|
|
|
|
hid_t memb_type2;
|
|
|
|
|
|
|
|
nmembs1 = H5Tget_nmembers(f_tid1);
|
|
|
|
nmembs2 = H5Tget_nmembers(f_tid2);
|
|
|
|
|
|
|
|
if ( nmembs1 != nmembs2 )
|
|
|
|
{
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
if ( (options->m_verbose||options->m_list_not_cmp) && obj1_name && obj2_name)
|
|
|
|
{
|
2009-04-21 04:59:40 +08:00
|
|
|
parallel_print("Not comparable: <%s> has %d members ", obj1_name, nmembs1);
|
2009-02-11 23:57:25 +08:00
|
|
|
parallel_print("<%s> has %d members ", obj2_name, nmembs2);
|
|
|
|
parallel_print("\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
return can_compare;
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
for (j = 0; j < nmembs1; j++)
|
|
|
|
{
|
|
|
|
memb_type1 = H5Tget_member_type(f_tid1, (unsigned)j);
|
|
|
|
memb_type2 = H5Tget_member_type(f_tid2, (unsigned)j);
|
|
|
|
|
|
|
|
if (diff_can_type(memb_type1,
|
|
|
|
memb_type2,
|
|
|
|
rank1,
|
|
|
|
rank2,
|
|
|
|
dims1,
|
|
|
|
dims2,
|
|
|
|
maxdim1,
|
|
|
|
maxdim2,
|
|
|
|
obj1_name,
|
|
|
|
obj2_name,
|
|
|
|
options,
|
|
|
|
1)!=1)
|
|
|
|
{
|
|
|
|
can_compare = 0;
|
|
|
|
options->not_cmp = 1;
|
|
|
|
H5Tclose(memb_type1);
|
|
|
|
H5Tclose(memb_type2);
|
|
|
|
return can_compare;
|
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
H5Tclose(memb_type1);
|
|
|
|
H5Tclose(memb_type2);
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
}
|
2010-01-30 12:29:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-02-11 23:57:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-30 12:29:13 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
2009-01-27 03:29:22 +08:00
|
|
|
return can_compare;
|
2003-11-04 06:10:57 +08:00
|
|
|
}
|
2007-02-20 04:21:09 +08:00
|
|
|
|
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
|
|
|
|
|
2007-02-20 04:21:09 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2008-10-29 03:13:42 +08:00
|
|
|
* Function: print_sizes
|
|
|
|
*
|
|
|
|
* Purpose: Print datatype sizes
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2007-02-20 04:21:09 +08:00
|
|
|
#if defined (H5DIFF_DEBUG)
|
|
|
|
void print_sizes( const char *obj1,
|
|
|
|
const char *obj2,
|
|
|
|
hid_t f_tid1,
|
|
|
|
hid_t f_tid2,
|
|
|
|
hid_t m_tid1,
|
|
|
|
hid_t m_tid2 )
|
|
|
|
{
|
2008-10-29 03:13:42 +08:00
|
|
|
size_t f_size1, f_size2; /* size of type in file */
|
|
|
|
size_t m_size1, m_size2; /* size of type in memory */
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2008-10-29 03:13:42 +08:00
|
|
|
f_size1 = H5Tget_size( f_tid1 );
|
|
|
|
f_size2 = H5Tget_size( f_tid2 );
|
|
|
|
m_size1 = H5Tget_size( m_tid1 );
|
|
|
|
m_size2 = H5Tget_size( m_tid2 );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("------------------\n");
|
|
|
|
parallel_print("sizeof(char) %u\n", sizeof(char) );
|
|
|
|
parallel_print("sizeof(short) %u\n", sizeof(short) );
|
|
|
|
parallel_print("sizeof(int) %u\n", sizeof(int) );
|
|
|
|
parallel_print("sizeof(long) %u\n", sizeof(long) );
|
|
|
|
parallel_print("<%s> ------------------\n", obj1);
|
|
|
|
parallel_print("type on file ");
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(f_tid1);
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("size on file %u\n", f_size1 );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("type on memory ");
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(m_tid1);
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("size on memory %u\n", m_size1 );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("<%s> ------------------\n", obj2);
|
|
|
|
parallel_print("type on file ");
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(f_tid2);
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("size on file %u\n", f_size2 );
|
2010-01-30 12:29:13 +08:00
|
|
|
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("type on memory ");
|
2008-10-29 03:13:42 +08:00
|
|
|
print_type(m_tid2);
|
2009-01-30 02:58:36 +08:00
|
|
|
parallel_print("\n");
|
|
|
|
parallel_print("size on memory %u\n", m_size2 );
|
|
|
|
parallel_print("\n");
|
2008-05-01 03:51:13 +08:00
|
|
|
}
|
|
|
|
#endif /* H5DIFF_DEBUG */
|