2003-04-01 01:59:04 +08:00
|
|
|
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
2007-02-07 22:56:24 +08:00
|
|
|
* Copyright by The HDF Group. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* All rights reserved. *
|
|
|
|
* *
|
|
|
|
* This file is part of HDF5. The full HDF5 copyright notice, including *
|
|
|
|
* terms governing use, modification, and redistribution, is contained in *
|
2017-04-18 03:32:16 +08:00
|
|
|
* the COPYING file, which can be found at the root of the source code *
|
2021-02-17 22:52:04 +08:00
|
|
|
* distribution tree, or in https://www.hdfgroup.org/licenses. *
|
2017-04-18 03:32:16 +08:00
|
|
|
* If you do not have access to either file, you may request a copy from *
|
|
|
|
* help@hdfgroup.org. *
|
2003-04-01 01:59:04 +08:00
|
|
|
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests dataset fill values.
|
1998-10-06 05:01:10 +08:00
|
|
|
*/
|
2001-04-04 02:09:16 +08:00
|
|
|
#include "h5test.h"
|
2010-03-18 20:23:04 +08:00
|
|
|
#include "H5srcdir.h"
|
1998-11-03 01:58:28 +08:00
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*
|
|
|
|
* Define NO_FILLING if you want to compare how this test works when there is
|
|
|
|
* no fill value (that is, when the fill value is zero).
|
|
|
|
*/
|
|
|
|
/* #define NO_FILLING */
|
|
|
|
|
2023-06-19 13:13:38 +08:00
|
|
|
static const char *FILENAME[] = {"fillval_1", "fillval_2", "fillval_3", "fillval_4", "fillval_5",
|
|
|
|
"fillval_6", "fillval_7", "fillval_8", "fillval_9", NULL};
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Common type for compound datatype operations */
|
2002-04-12 06:53:26 +08:00
|
|
|
typedef struct {
|
|
|
|
float a;
|
|
|
|
int x;
|
|
|
|
double y;
|
|
|
|
char z;
|
|
|
|
} comp_datatype;
|
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Common type for compound+vl datatype operations */
|
|
|
|
typedef struct {
|
2020-09-30 22:27:10 +08:00
|
|
|
int x;
|
|
|
|
char *a;
|
|
|
|
char *b;
|
|
|
|
int y;
|
2007-07-05 23:45:45 +08:00
|
|
|
} comp_vl_datatype;
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
/* The fill_old.h5 is generated from gen_old_fill.c in HDF5 'test' directory
|
2002-04-12 06:53:26 +08:00
|
|
|
* for version 1.4(after 1.4.3). To get this data file, simply compile
|
|
|
|
* gen_old_fill.c with HDF5 library (before v1.5) and run it. */
|
|
|
|
#define FILE_COMPATIBLE "fill_old.h5"
|
2020-09-30 22:27:10 +08:00
|
|
|
#define FILE_NAME_RAW "fillval.raw"
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2005-08-14 04:53:35 +08:00
|
|
|
* Function: create_compound_type
|
2002-04-12 06:53:26 +08:00
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
* Purpose: create a compound datatype
|
2002-04-12 06:53:26 +08:00
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
* Return: Success: datatype ID
|
2002-04-12 06:53:26 +08:00
|
|
|
*
|
2005-08-14 04:53:35 +08:00
|
|
|
* Failure: -1
|
2002-04-12 06:53:26 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
static hid_t
|
|
|
|
create_compound_type(void)
|
2002-04-12 06:53:26 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t ret_value = H5I_INVALID_HID;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_datatype))) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Tinsert(ret_value, "a", HOFFSET(comp_datatype, a), H5T_NATIVE_FLOAT) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "x", HOFFSET(comp_datatype, x), H5T_NATIVE_INT) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "y", HOFFSET(comp_datatype, y), H5T_NATIVE_DOUBLE) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "z", HOFFSET(comp_datatype, z), H5T_NATIVE_CHAR) < 0)
|
2007-06-06 01:51:06 +08:00
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
return ret_value;
|
|
|
|
|
2007-06-06 01:51:06 +08:00
|
|
|
error:
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Tclose(ret_value);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-04-12 06:53:26 +08:00
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: create_compound_vl_type
|
|
|
|
*
|
|
|
|
* Purpose: create a compound+vl datatype
|
|
|
|
*
|
|
|
|
* Return: Success: datatype ID
|
|
|
|
*
|
|
|
|
* Failure: -1
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static hid_t
|
|
|
|
create_compound_vl_type(void)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t str_id = H5I_INVALID_HID; /* Datatype for VL-string fields */
|
|
|
|
hid_t ret_value = H5I_INVALID_HID;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Create a string datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((str_id = H5Tcopy(H5T_C_S1)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tset_size(str_id, H5T_VARIABLE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
|
|
|
|
if ((ret_value = H5Tcreate(H5T_COMPOUND, sizeof(comp_vl_datatype))) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "x", HOFFSET(comp_vl_datatype, x), H5T_NATIVE_INT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "a", HOFFSET(comp_vl_datatype, a), str_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "b", HOFFSET(comp_vl_datatype, b), str_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tinsert(ret_value, "y", HOFFSET(comp_vl_datatype, y), H5T_NATIVE_INT) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Close string datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tclose(str_id) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
return ret_value;
|
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2007-07-05 23:45:45 +08:00
|
|
|
H5Tclose(str_id);
|
|
|
|
H5Tclose(ret_value);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2007-07-05 23:45:45 +08:00
|
|
|
return -1;
|
|
|
|
} /* end create_compound_vl_type() */
|
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_getset
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value()
|
|
|
|
* functions.
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure: number of errors
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_getset(void)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t dcpl = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
int fill_i;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t type_ss = H5I_INVALID_HID, type_si = H5I_INVALID_HID;
|
1998-10-06 05:01:10 +08:00
|
|
|
struct fill_si {
|
2020-09-30 22:27:10 +08:00
|
|
|
int v1, v2;
|
|
|
|
} fill_si;
|
1998-10-06 05:01:10 +08:00
|
|
|
struct fill_ss {
|
2020-09-30 22:27:10 +08:00
|
|
|
short v1, v2;
|
|
|
|
} fill_ss, fill_ss_rd;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
TESTING("property lists");
|
1998-10-06 05:01:10 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Create the dataset creation property list and the data types that will
|
|
|
|
* be used during this test.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((type_ss = H5Tcreate(H5T_COMPOUND, sizeof fill_ss)) < 0 ||
|
|
|
|
H5Tinsert(type_ss, "v1", HOFFSET(struct fill_ss, v1), H5T_NATIVE_SHORT) < 0 ||
|
|
|
|
H5Tinsert(type_ss, "v2", HOFFSET(struct fill_ss, v2), H5T_NATIVE_SHORT) < 0) {
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if ((type_si = H5Tcreate(H5T_COMPOUND, sizeof fill_si)) < 0 ||
|
|
|
|
H5Tinsert(type_si, "v1", HOFFSET(struct fill_si, v1), H5T_NATIVE_INT) < 0 ||
|
|
|
|
H5Tinsert(type_si, "v2", HOFFSET(struct fill_si, v2), H5T_NATIVE_INT) < 0) {
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*
|
|
|
|
* Reading the fill value from a dataset creation property list that has
|
|
|
|
* no fill value should result in a failure.
|
|
|
|
*/
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Pget_fill_value(dcpl, H5T_NATIVE_INT, &fill_i);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_i != 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" H5Pget_fill_value() should return default 0");
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set the fill value using a struct as the data type.
|
|
|
|
*/
|
|
|
|
fill_ss.v1 = 1111;
|
|
|
|
fill_ss.v2 = 2222;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, type_ss, &fill_ss) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the fill value using the same data type that was used to set it.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, type_ss, &fill_ss_rd) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_ss.v1 != fill_ss_rd.v1 || fill_ss.v2 != fill_ss_rd.v2) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Failed to get fill value using same data type that was ");
|
|
|
|
puts(" used to set the fill value.");
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Get the fill value using some other data type.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, type_si, &fill_si) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_ss.v1 != fill_si.v1 || fill_ss.v2 != fill_si.v2) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Failed to get fill value using a data type other than what");
|
|
|
|
puts(" was used to set the fill value.");
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Reset the fill value
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, type_si, &fill_si) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_fill_value(dcpl, type_ss, &fill_ss) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_si.v1 != fill_ss.v1 || fill_si.v2 != fill_ss.v2) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Resetting the fill value was unsuccessful.");
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Success */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Tclose(type_si) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Tclose(type_ss) < 0)
|
|
|
|
goto error;
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-06 05:01:10 +08:00
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Tclose(type_si);
|
|
|
|
H5Tclose(type_ss);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-06 05:01:10 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2007-06-01 04:33:19 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_getset_vl
|
2007-06-01 04:33:19 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests the H5Pget_fill_value() and H5Pset_fill_value()
|
|
|
|
* functions, using variable-length datatype.
|
2007-06-01 04:33:19 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: number of errors
|
2007-06-01 04:33:19 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_getset_vl(hid_t fapl)
|
|
|
|
{
|
|
|
|
hsize_t dims[1] = {2};
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fileid = (H5I_INVALID_HID), spaceid = (H5I_INVALID_HID), dtypeid = (H5I_INVALID_HID),
|
|
|
|
datasetid = (H5I_INVALID_HID), plistid = (H5I_INVALID_HID);
|
|
|
|
char fill_value[] = "aaaa";
|
|
|
|
char orig_fill_value[] = "aaaa";
|
|
|
|
char *f1 = fill_value;
|
|
|
|
char *f2;
|
|
|
|
char filename[1024];
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
TESTING("property lists, with variable-length datatype");
|
|
|
|
|
|
|
|
/* Create string type. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dtypeid = H5Tcopy(H5T_C_S1)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tset_size(dtypeid, H5T_VARIABLE) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Set up dataset creation property list, with fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((plistid = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(plistid, dtypeid, &f1) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Modify original fill value string */
|
|
|
|
fill_value[0] = 'b';
|
|
|
|
|
|
|
|
/* Retrieve fill value from property */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(plistid, dtypeid, &f2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Verify that the fill value is the original value */
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(f2, orig_fill_value) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Release the fill value retrieved */
|
2023-06-29 06:48:12 +08:00
|
|
|
free(f2);
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Open file. */
|
|
|
|
h5_fixname(FILENAME[0], fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fileid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Write an dataset of this type. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((spaceid = H5Screate_simple(1, dims, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((datasetid = H5Dcreate2(fileid, "Dataset", dtypeid, spaceid, H5P_DEFAULT, plistid, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Close IDs (except datatype) */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(datasetid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(plistid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(spaceid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fileid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Re-open file, group & dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fileid = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((datasetid = H5Dopen2(fileid, "Dataset", H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Get dataset's creation property list */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((plistid = H5Dget_create_plist(datasetid)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Query fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(plistid, dtypeid, &f2) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Verify that the fill value is the original value */
|
2023-09-16 06:13:18 +08:00
|
|
|
if (strcmp(f2, orig_fill_value) != 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Release the fill value retrieved */
|
2023-06-29 06:48:12 +08:00
|
|
|
free(f2);
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
/* Close IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(datasetid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(fileid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(plistid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tclose(dtypeid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-06-01 04:33:19 +08:00
|
|
|
|
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
2021-03-17 23:25:39 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2007-06-01 04:33:19 +08:00
|
|
|
return 1;
|
|
|
|
} /* end test_getset_vl() */
|
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_create
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests creating datasets that have fill values.
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure: number of errors
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-15 22:58:25 +08:00
|
|
|
test_create(hid_t fapl, const char *base_name, H5D_layout_t layout)
|
1998-10-06 05:01:10 +08:00
|
|
|
{
|
2023-08-02 12:14:02 +08:00
|
|
|
hid_t file = H5I_INVALID_HID, space = H5I_INVALID_HID, dcpl = H5I_INVALID_HID,
|
|
|
|
comp_type_id = H5I_INVALID_HID;
|
|
|
|
hid_t dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID, dset3 = H5I_INVALID_HID, dset4 = H5I_INVALID_HID,
|
|
|
|
dset5 = H5I_INVALID_HID, dset6 = H5I_INVALID_HID,
|
|
|
|
/* dset7=H5I_INVALID_HID, */ dset8 = H5I_INVALID_HID, dset9 = H5I_INVALID_HID,
|
|
|
|
dset10 = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t cur_size[5] = {2, 8, 8, 4, 2};
|
|
|
|
hsize_t ch_size[5] = {1, 1, 1, 4, 1};
|
|
|
|
short rd_s, fill_s = 0x1234;
|
|
|
|
long rd_l, fill_l = 0x4321;
|
|
|
|
char filename[1024];
|
|
|
|
H5D_space_status_t allocation;
|
|
|
|
H5D_alloc_time_t alloc_time;
|
2019-08-16 05:46:00 +08:00
|
|
|
H5D_fill_time_t fill_time;
|
2020-09-30 22:27:10 +08:00
|
|
|
comp_datatype rd_c, fill_ctype;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CHUNKED == layout) {
|
|
|
|
TESTING("chunked dataset creation");
|
|
|
|
}
|
|
|
|
else if (H5D_COMPACT == layout) {
|
2002-08-21 00:18:02 +08:00
|
|
|
TESTING("compact dataset creation");
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
TESTING("contiguous dataset creation");
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
1998-10-09 01:13:14 +08:00
|
|
|
/*
|
2002-04-12 06:53:26 +08:00
|
|
|
* Create a file.
|
1998-10-09 01:13:14 +08:00
|
|
|
*/
|
1999-06-15 22:58:25 +08:00
|
|
|
h5_fixname(base_name, fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((space = H5Screate_simple(5, cur_size, cur_size)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5D_CHUNKED == layout) {
|
|
|
|
if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
else if (H5D_COMPACT == layout) {
|
|
|
|
if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
/* Create a compound datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((comp_type_id = create_compound_type()) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* I. Test cases for late space allocation except compact dataset */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_COMPACT != layout) {
|
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 1. Compound datatype test */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
fill_ctype.y = 4444;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset9 = H5Dcreate2(file, "dset9", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2002-08-21 00:18:02 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* The three datasets test three fill
|
|
|
|
* conversion paths: small to large, large to small, and no conversion.
|
|
|
|
* They depend on `short' being smaller than `long'.
|
|
|
|
*/
|
|
|
|
/* 2. Small to large fill conversion */
|
1998-10-06 05:01:10 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_SHORT, &fill_s) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset1 = H5Dcreate2(file, "dset1", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* 3. Large to small fill conversion */
|
1998-10-09 01:13:14 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset2 = H5Dcreate2(file, "dset2", H5T_NATIVE_SHORT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* 4. No conversion */
|
1998-10-09 01:13:14 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset3 = H5Dcreate2(file, "dset3", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 5. late space allocation and never write fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset4 = H5Dcreate2(file, "dset4", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
/* 6. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC.
|
2002-08-21 00:18:02 +08:00
|
|
|
* Supposed to fail. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
if (H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) != FAIL)
|
2002-08-21 00:18:02 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
/* II. Test early space allocation cases */
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5D_CHUNKED == layout) {
|
|
|
|
if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (H5D_COMPACT == layout) {
|
|
|
|
if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* 1. Compound datatype test */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
fill_ctype.y = 4444;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, comp_type_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset8 = H5Dcreate2(file, "dset8", comp_type_id, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_LONG, &fill_l) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* 2. Never write fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset5 = H5Dcreate2(file, "dset5", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
/* 3. Write fill value at space allocation time */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset6 = H5Dcreate2(file, "dset6", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
/* 4. fill value is undefined while fill write time is H5D_FILL_TIME_ALLOC.
|
2002-04-12 06:53:26 +08:00
|
|
|
* Supposed to fail. */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
if (H5Dcreate2(file, "dset7", H5T_NATIVE_LONG, space, H5P_DEFAULT, dcpl, H5P_DEFAULT) != FAIL)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2023-08-02 12:14:02 +08:00
|
|
|
/*
|
|
|
|
* Test that a dataset with an undefined fill value can be
|
|
|
|
* created and then re-opened after the file it is in has
|
|
|
|
* been closed and re-opened. This is to test for a bug that
|
|
|
|
* was introduced in the fill value object header message
|
|
|
|
* decoding logic.
|
|
|
|
*/
|
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dset10 = H5Dcreate2(file, "dset10", H5T_NATIVE_INT, space, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
|
1998-10-09 01:13:14 +08:00
|
|
|
/* Close everything */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_COMPACT != layout) {
|
|
|
|
if (H5Dclose(dset1) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset2) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset3) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset4) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset9) < 0)
|
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (H5Dclose(dset5) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset6) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset8) < 0)
|
|
|
|
goto error;
|
2023-08-02 12:14:02 +08:00
|
|
|
if (H5Dclose(dset10) < 0)
|
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(space) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Fclose(file) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
1998-10-09 01:13:14 +08:00
|
|
|
/* Open the file and get the dataset fill value from each dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* I. Check cases for late space allocation except compact dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_COMPACT != layout) {
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 1. Large to small conversion */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset1)) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, H5T_NATIVE_SHORT, &rd_s) < 0)
|
|
|
|
goto error;
|
|
|
|
if (rd_s != fill_s) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got %d, set %d\n", rd_s, fill_s);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
1998-10-06 05:01:10 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset1) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 2. Small to large conversion */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset2)) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
|
|
|
|
goto error;
|
|
|
|
if (rd_l != fill_l) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got %ld, set %ld\n", rd_l, fill_l);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
1998-10-09 01:13:14 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset2) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 3. No conversion */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset3 = H5Dopen2(file, "dset3", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset3)) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
|
|
|
|
goto error;
|
|
|
|
if (rd_l != fill_l) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got %ld, set %ld\n", rd_l, fill_l);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
1998-10-09 01:13:14 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_fill_time(dcpl, &fill_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (alloc_time != H5D_ALLOC_TIME_LATE) {
|
2002-08-21 00:18:02 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", alloc_time);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time != H5D_FILL_TIME_ALLOC) {
|
2002-08-21 00:18:02 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", fill_time);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset3) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
1998-10-09 01:13:14 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* 4. late space allocation and never write fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset4 = H5Dopen2(file, "dset4", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dget_space_status(dset4, &allocation) < 0)
|
|
|
|
goto error;
|
|
|
|
if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_NOT_ALLOCATED) {
|
2002-08-21 00:18:02 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got allocated space instead of unallocated.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", allocation);
|
2002-08-21 00:18:02 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Dget_create_plist(dset4)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_fill_time(dcpl, &fill_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (alloc_time != H5D_ALLOC_TIME_LATE) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_ALLOC_TIME_LATE space allocation time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", alloc_time);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_FILL_TIME_NEVER fill value write time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", fill_time);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset4) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
|
|
|
|
/* 5. Compound datatype test */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset9 = H5Dopen2(file, "dset9", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset9)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0)
|
|
|
|
goto error;
|
|
|
|
if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 ||
|
|
|
|
rd_c.z != '\0') {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got wrong fill value");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x,
|
|
|
|
rd_c.z);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset9) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* II. Check early space allocation cases */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* 1. Never write fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset5 = H5Dopen2(file, "dset5", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset5)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dget_space_status(dset5, &allocation) < 0)
|
|
|
|
goto error;
|
|
|
|
if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
|
|
|
|
printf(" Got %d\n", allocation);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2005-08-14 04:53:35 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (alloc_time != H5D_ALLOC_TIME_EARLY) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", alloc_time);
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_time(dcpl, &fill_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_FILL_TIME_NEVER fill value write time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", fill_time);
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset5) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* 2. test writing fill value at space allocation time */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset6 = H5Dopen2(file, "dset6", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset6)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dget_space_status(dset6, &allocation) < 0)
|
|
|
|
goto error;
|
|
|
|
if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
|
|
|
|
printf(" Got %d\n", allocation);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_value(dcpl, H5T_NATIVE_LONG, &rd_l) < 0)
|
|
|
|
goto error;
|
|
|
|
if (rd_l != fill_l) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got %ld, set %ld\n", rd_l, fill_l);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_alloc_time(dcpl, &alloc_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (alloc_time != H5D_ALLOC_TIME_EARLY) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_ALLOC_TIME_EARLY space allocation time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", alloc_time);
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pget_fill_time(dcpl, &fill_time) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_time != H5D_FILL_TIME_ALLOC) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got non-H5D_FILL_TIME_ALLOC fill value write time.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %d\n", fill_time);
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset6) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2005-08-14 04:53:35 +08:00
|
|
|
/* 3. Compound datatype test */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset8 = H5Dopen2(file, "dset8", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Dget_create_plist(dset8)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pget_fill_value(dcpl, comp_type_id, &rd_c) < 0)
|
|
|
|
goto error;
|
|
|
|
if (!H5_FLT_ABS_EQUAL(rd_c.a, 0) || !H5_DBL_ABS_EQUAL(rd_c.y, fill_ctype.y) || rd_c.x != 0 ||
|
|
|
|
rd_c.z != '\0') {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got wrong fill value");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got rd_c.a=%f, rd_c.y=%f and rd_c.x=%d, rd_c.z=%c\n", (double)rd_c.a, rd_c.y, rd_c.x,
|
|
|
|
rd_c.z);
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset8) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
|
2023-08-02 12:14:02 +08:00
|
|
|
/*
|
|
|
|
* Check that the dataset with an undefined fill value can
|
|
|
|
* be opened.
|
|
|
|
*/
|
|
|
|
if ((dset10 = H5Dopen2(file, "dset10", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset10) < 0)
|
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-06 05:01:10 +08:00
|
|
|
return 0;
|
|
|
|
|
[svn-r14193] Description:
Make H5Dopen versioned and change all internal usage to use H5Dopen2
Add simple regression test for H5Dopen1
Tested on:
FreeBSD/32 6.2 (duty) in debug mode
FreeBSD/64 6.2 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe,
in debug mode
Linux/64-amd64 2.6 (smirom) w/default API=1.6.x, w/C++ & FORTRAN,
in production mode
Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN,
in production mode
Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN,
w/szip filter, in production mode
Mac OS X/32 10.4.10 (amazon) in debug mode
2007-10-09 03:59:36 +08:00
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Sclose(space);
|
|
|
|
if (H5D_COMPACT != layout) {
|
|
|
|
H5Dclose(dset1);
|
|
|
|
H5Dclose(dset2);
|
|
|
|
H5Dclose(dset3);
|
|
|
|
H5Dclose(dset4);
|
|
|
|
H5Dclose(dset9);
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2002-04-12 06:53:26 +08:00
|
|
|
H5Dclose(dset5);
|
|
|
|
H5Dclose(dset6);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Dclose(dset8);
|
2023-08-02 12:14:02 +08:00
|
|
|
H5Dclose(dset10);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Fclose(file);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-06 05:01:10 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_rdwr_cases
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests fill values read and write for datasets.
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure: 1
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2020-09-30 22:27:10 +08:00
|
|
|
test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval, H5D_fill_time_t fill_time,
|
|
|
|
H5D_layout_t layout, H5T_class_t datatype, hid_t ctype_id)
|
1998-10-06 05:01:10 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fspace = H5I_INVALID_HID, mspace = H5I_INVALID_HID, dset1 = H5I_INVALID_HID,
|
|
|
|
dset2 = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t cur_size[5] = {2, 8, 8, 4, 2};
|
|
|
|
hsize_t one[5] = {1, 1, 1, 1, 1};
|
|
|
|
hsize_t hs_size[5], hs_stride[5];
|
|
|
|
hsize_t hs_offset[5], nelmts;
|
|
|
|
int fillval = (-1), val_rd, should_be;
|
|
|
|
int i, j, *buf = NULL, odd;
|
|
|
|
unsigned u;
|
|
|
|
comp_datatype rd_c, fill_c, should_be_c;
|
2023-06-19 13:13:38 +08:00
|
|
|
comp_datatype *buf_c = NULL;
|
|
|
|
H5D_space_status_t allocation = H5D_SPACE_STATUS_ERROR;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2020-01-30 01:43:55 +08:00
|
|
|
fill_c.a = 0;
|
|
|
|
fill_c.x = 0;
|
|
|
|
fill_c.y = 0;
|
|
|
|
fill_c.z = 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_INTEGER) {
|
|
|
|
fillval = *(int *)_fillval;
|
2018-09-21 01:40:51 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (datatype == H5T_COMPOUND) {
|
|
|
|
fill_c.a = ((comp_datatype *)_fillval)->a;
|
|
|
|
fill_c.x = ((comp_datatype *)_fillval)->x;
|
|
|
|
fill_c.y = ((comp_datatype *)_fillval)->y;
|
|
|
|
fill_c.z = ((comp_datatype *)_fillval)->z;
|
2018-09-21 01:40:51 +08:00
|
|
|
}
|
|
|
|
else {
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("Invalid type for test");
|
2002-08-27 21:42:22 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
/* Create dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Screate_simple(5, cur_size, cur_size)) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_INTEGER &&
|
|
|
|
(dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_COMPOUND &&
|
|
|
|
(dset2 = H5Dcreate2(file, dname, ctype_id, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
|
|
|
/* Read some data and make sure it's the fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
|
|
|
for (j = 0; j < 5; j++)
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
|
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
|
|
|
goto error;
|
2007-06-20 04:38:49 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* case for atomic datatype */
|
|
|
|
if (datatype == H5T_INTEGER) {
|
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER && val_rd != fillval) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE
|
|
|
|
"}, read: %u, "
|
|
|
|
"Fill value: %u\n",
|
|
|
|
hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], val_rd,
|
|
|
|
fillval);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/* case for compound datatype */
|
2019-08-16 05:46:00 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (datatype == H5T_COMPOUND) {
|
|
|
|
if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0)
|
|
|
|
goto error;
|
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER &&
|
|
|
|
(!H5_FLT_ABS_EQUAL(rd_c.a, fill_c.a) || rd_c.x != fill_c.x ||
|
|
|
|
!H5_DBL_ABS_EQUAL(rd_c.y, fill_c.y) || rd_c.z != fill_c.z)) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt={%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE ",%" PRIuHSIZE
|
|
|
|
"}, read: %f, %d, %f, %c"
|
|
|
|
"Fill value: %f, %d, %f, %c\n",
|
|
|
|
hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], (double)rd_c.a,
|
|
|
|
rd_c.x, rd_c.y, rd_c.z, (double)fill_c.a, fill_c.x, fill_c.y, fill_c.z);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
}
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2007-06-20 04:38:49 +08:00
|
|
|
/* Select all odd data locations in the file dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0, nelmts = 1; i < 5; i++) {
|
|
|
|
hs_size[i] = cur_size[i] / 2;
|
2018-09-21 01:40:51 +08:00
|
|
|
hs_offset[i] = 0;
|
|
|
|
hs_stride[i] = 2;
|
|
|
|
nelmts *= hs_size[i];
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, hs_size, hs_size)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2007-06-20 04:38:49 +08:00
|
|
|
/* Read non-contiguous selection from empty dataset */
|
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
/* case for atomic datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_INTEGER) {
|
2002-04-12 06:53:26 +08:00
|
|
|
/*check for overflow*/
|
2023-06-28 22:31:56 +08:00
|
|
|
assert((nelmts * sizeof(int)) == (hsize_t)((size_t)(nelmts * sizeof(int))));
|
2023-06-29 06:48:12 +08:00
|
|
|
buf = (int *)malloc((size_t)(nelmts * sizeof(int)));
|
2007-06-20 04:38:49 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
/* Verify values, except if no fill value written */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER) {
|
|
|
|
for (u = 0; u < nelmts; u++) {
|
|
|
|
if (buf[u] != fillval) {
|
2007-06-20 04:38:49 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
|
|
|
|
", %" PRIuHSIZE "}, read: %u, "
|
|
|
|
"Fill value: %u\n",
|
|
|
|
hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4], buf[u],
|
|
|
|
fillval);
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end for */
|
|
|
|
} /* end if */
|
2007-06-20 04:38:49 +08:00
|
|
|
}
|
|
|
|
/* case for compound datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (datatype == H5T_COMPOUND) {
|
2007-06-20 04:38:49 +08:00
|
|
|
/*check for overflow*/
|
2023-06-28 22:31:56 +08:00
|
|
|
assert((nelmts * sizeof(comp_datatype)) == (hsize_t)((size_t)(nelmts * sizeof(comp_datatype))));
|
2023-06-29 06:48:12 +08:00
|
|
|
buf_c = (comp_datatype *)malloc((size_t)nelmts * sizeof(comp_datatype));
|
2007-06-20 04:38:49 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
/* Verify values, except if no fill value written */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER) {
|
|
|
|
for (u = 0; u < nelmts; u++) {
|
|
|
|
if (!H5_FLT_ABS_EQUAL(buf_c[u].a, fill_c.a) || buf_c[u].x != fill_c.x ||
|
|
|
|
!H5_DBL_ABS_EQUAL(buf_c[u].y, fill_c.y) || buf_c[u].z != fill_c.z) {
|
2007-06-20 04:38:49 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not a fill value.\n", (unsigned)__LINE__);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt={%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
|
|
|
|
", %" PRIuHSIZE "}, read: %f, %d, %f, %c"
|
|
|
|
"Fill value: %f, %d, %f, %c\n",
|
|
|
|
hs_offset[0], hs_offset[1], hs_offset[2], hs_offset[3], hs_offset[4],
|
|
|
|
(double)buf_c[u].a, buf_c[u].x, buf_c[u].y, buf_c[u].z, (double)fill_c.a,
|
|
|
|
fill_c.x, fill_c.y, fill_c.z);
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end for */
|
|
|
|
} /* end if */
|
2007-06-20 04:38:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Write to all odd data locations */
|
|
|
|
|
|
|
|
/* case for atomic datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_INTEGER) {
|
|
|
|
for (u = 0; u < nelmts; u++)
|
2006-10-24 04:40:14 +08:00
|
|
|
buf[u] = 9999;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dwrite(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, buf) < 0)
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
2005-08-14 04:53:35 +08:00
|
|
|
}
|
|
|
|
/* case for compound datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (datatype == H5T_COMPOUND) {
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(buf_c, 0, ((size_t)nelmts * sizeof(comp_datatype)));
|
2020-09-30 22:27:10 +08:00
|
|
|
for (u = 0; u < nelmts; u++) {
|
|
|
|
buf_c[u].a = 1111.11F;
|
|
|
|
buf_c[u].x = 2222;
|
2021-08-25 12:05:23 +08:00
|
|
|
buf_c[u].y = 3333.3333;
|
2020-09-30 22:27:10 +08:00
|
|
|
buf_c[u].z = 'd';
|
|
|
|
}
|
|
|
|
if (H5Dwrite(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, buf_c) < 0)
|
2007-06-20 04:38:49 +08:00
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if space is allocated */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_INTEGER && H5Dget_space_status(dset1, &allocation) < 0)
|
|
|
|
goto error;
|
|
|
|
if (datatype == H5T_COMPOUND && H5Dget_space_status(dset2, &allocation) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (layout == H5D_CONTIGUOUS && allocation != H5D_SPACE_STATUS_ALLOCATED) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got unallocated space instead of allocated.\n", __LINE__);
|
|
|
|
printf(" Got %d\n", allocation);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2023-06-29 06:48:12 +08:00
|
|
|
free(buf);
|
1998-10-06 05:01:10 +08:00
|
|
|
buf = NULL;
|
|
|
|
H5Sclose(mspace);
|
|
|
|
|
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % cur_size[j];
|
|
|
|
odd += (int)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
/* case for atomic datatype */
|
|
|
|
if (datatype == H5T_INTEGER) {
|
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time == H5D_FILL_TIME_ALLOC) {
|
2002-04-12 06:53:26 +08:00
|
|
|
should_be = odd ? fillval : 9999;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (val_rd != should_be) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
|
|
|
|
"should be: %u\n",
|
|
|
|
(long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
|
|
|
|
(long)hs_offset[4], val_rd, should_be);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else if (fill_time == H5D_FILL_TIME_NEVER && !odd) {
|
|
|
|
should_be = 9999;
|
|
|
|
if (val_rd != should_be) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %u, "
|
|
|
|
"should be: %u\n",
|
|
|
|
(long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
|
|
|
|
(long)hs_offset[4], val_rd, should_be);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2019-08-16 05:46:00 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (fill_time == H5D_FILL_TIME_NEVER && odd) {
|
|
|
|
/*Trash data. Don't compare*/
|
|
|
|
}
|
|
|
|
} /* end for datatype==H5T_INTEGER */
|
|
|
|
/* case for compound datatype */
|
|
|
|
else if (datatype == H5T_COMPOUND) {
|
|
|
|
if (H5Dread(dset2, ctype_id, mspace, fspace, H5P_DEFAULT, &rd_c) < 0)
|
2006-10-24 04:40:14 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time == H5D_FILL_TIME_ALLOC) {
|
|
|
|
if (odd) {
|
|
|
|
should_be_c.a = fill_c.a;
|
|
|
|
should_be_c.x = fill_c.x;
|
|
|
|
should_be_c.y = fill_c.y;
|
|
|
|
should_be_c.z = fill_c.z;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
should_be_c.a = buf_c[0].a;
|
|
|
|
should_be_c.x = buf_c[0].x;
|
|
|
|
should_be_c.y = buf_c[0].y;
|
|
|
|
should_be_c.z = buf_c[0].z;
|
|
|
|
}
|
|
|
|
if (!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
|
|
|
|
!H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
|
|
|
|
"should be: %f,%d,%f,%c\n",
|
|
|
|
(long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
|
|
|
|
(long)hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
|
|
|
|
should_be_c.x, should_be_c.y, should_be_c.z);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
} /* end for fill_time == H5D_FILL_TIME_ALLOC */
|
|
|
|
else if (fill_time == H5D_FILL_TIME_NEVER && !odd) {
|
|
|
|
should_be_c.a = buf_c[0].a;
|
|
|
|
should_be_c.x = buf_c[0].x;
|
|
|
|
should_be_c.y = buf_c[0].y;
|
|
|
|
should_be_c.z = buf_c[0].z;
|
|
|
|
if (!H5_FLT_ABS_EQUAL(rd_c.a, should_be_c.a) || rd_c.x != should_be_c.x ||
|
|
|
|
!H5_DBL_ABS_EQUAL(rd_c.y, should_be_c.y) || rd_c.z != should_be_c.z) {
|
2002-04-12 06:53:26 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" Elmt={%ld,%ld,%ld,%ld,%ld}, read: %f,%d,%f,%c "
|
|
|
|
"should be: %f,%d,%f,%c\n",
|
|
|
|
(long)hs_offset[0], (long)hs_offset[1], (long)hs_offset[2], (long)hs_offset[3],
|
|
|
|
(long)hs_offset[4], (double)rd_c.a, rd_c.x, rd_c.y, rd_c.z, (double)should_be_c.a,
|
|
|
|
should_be_c.x, should_be_c.y, should_be_c.z);
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end for fill_time == H5D_FILL_TIME_NEVER */
|
|
|
|
else if (fill_time == H5D_FILL_TIME_NEVER && odd) {
|
2005-08-14 04:53:35 +08:00
|
|
|
/*Trash data. Don't compare*/
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end for datatype==H5T_COMPOUND */
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
if (datatype == H5T_COMPOUND) {
|
2023-06-29 06:48:12 +08:00
|
|
|
free(buf_c);
|
2006-10-24 04:40:14 +08:00
|
|
|
buf_c = NULL;
|
|
|
|
} /* end if */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (datatype == H5T_INTEGER && H5Dclose(dset1) < 0)
|
|
|
|
goto error;
|
|
|
|
if (datatype == H5T_COMPOUND && H5Dclose(dset2) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(fspace) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
return 0;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
if (datatype == H5T_INTEGER)
|
|
|
|
H5Dclose(dset1);
|
|
|
|
if (datatype == H5T_COMPOUND)
|
|
|
|
H5Dclose(dset2);
|
|
|
|
H5Sclose(fspace);
|
|
|
|
H5Sclose(mspace);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-08-21 00:18:02 +08:00
|
|
|
|
2002-04-12 06:53:26 +08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_rdwr
|
|
|
|
*
|
|
|
|
* Purpose: Tests fill values for datasets.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_rdwr(hid_t fapl, const char *base_name, H5D_layout_t layout)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[1024];
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file = H5I_INVALID_HID, dcpl = H5I_INVALID_HID, ctype_id = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t ch_size[5] = {2, 8, 8, 4, 2};
|
|
|
|
int nerrors = 0;
|
|
|
|
int fillval = 0x4c70f1cd;
|
|
|
|
comp_datatype fill_ctype = {0, 0, 0, 0};
|
|
|
|
|
|
|
|
if (H5D_CHUNKED == layout) {
|
2002-04-12 06:53:26 +08:00
|
|
|
TESTING("chunked dataset I/O");
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else if (H5D_COMPACT == layout) {
|
2002-08-21 00:18:02 +08:00
|
|
|
TESTING("compact dataset I/O");
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
|
|
|
else {
|
2002-04-12 06:53:26 +08:00
|
|
|
TESTING("contiguous dataset I/O");
|
|
|
|
}
|
|
|
|
|
|
|
|
h5_fixname(base_name, fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2002-04-12 06:53:26 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
2018-09-21 01:40:51 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CHUNKED == layout) {
|
|
|
|
if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
|
2018-09-21 01:40:51 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (H5D_COMPACT == layout) {
|
|
|
|
if (H5Pset_layout(dcpl, H5D_COMPACT) < 0)
|
2018-09-21 01:40:51 +08:00
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((ctype_id = create_compound_type()) < 0)
|
2018-09-21 01:40:51 +08:00
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-09-14 00:57:46 +08:00
|
|
|
/* I. Test H5D_ALLOC_TIME_LATE space allocation cases */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_COMPACT != layout) {
|
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
fillval = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset1", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER,
|
|
|
|
(hid_t)-1);
|
2002-08-21 00:18:02 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset2", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
|
|
|
|
(hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
fillval = 0x4c70f1cd;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset3", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER,
|
|
|
|
(hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset4", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
|
|
|
|
(hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */
|
|
|
|
/* This case has been tested in test_create() function */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset5", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER,
|
|
|
|
(hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2002-08-21 00:18:02 +08:00
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
|
|
|
|
* as compound type */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(&fill_ctype, 0, sizeof(fill_ctype));
|
2021-08-25 12:05:23 +08:00
|
|
|
fill_ctype.y = 4444.4444;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset11", &fill_ctype, H5D_FILL_TIME_ALLOC, layout,
|
|
|
|
H5T_COMPOUND, ctype_id);
|
|
|
|
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5D_CHUNKED == layout) {
|
|
|
|
if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
|
|
|
|
goto error;
|
2002-08-21 00:18:02 +08:00
|
|
|
}
|
2002-04-12 06:53:26 +08:00
|
|
|
}
|
|
|
|
|
2002-09-14 00:57:46 +08:00
|
|
|
/* II. Test H5D_ALLOC_TIME_EARLY space allocation cases */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
fillval = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors +=
|
|
|
|
test_rdwr_cases(file, dcpl, "dset6", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, (hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors +=
|
|
|
|
test_rdwr_cases(file, dcpl, "dset7", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2002-04-12 06:53:26 +08:00
|
|
|
fillval = 0x4c70f1cd;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors +=
|
|
|
|
test_rdwr_cases(file, dcpl, "dset8", &fillval, H5D_FILL_TIME_ALLOC, layout, H5T_INTEGER, (hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is user-defined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_value(dcpl, H5T_NATIVE_INT, &fillval) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors +=
|
|
|
|
test_rdwr_cases(file, dcpl, "dset9", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is undefined */
|
|
|
|
/* This case has been tested in test_create() function */
|
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value is undefined */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_fill_value(dcpl, (hid_t)-1, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors +=
|
|
|
|
test_rdwr_cases(file, dcpl, "dset10", &fillval, H5D_FILL_TIME_NEVER, layout, H5T_INTEGER, (hid_t)-1);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value is user-defined
|
|
|
|
* as compound type */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(&fill_ctype, 0, sizeof(fill_ctype));
|
2021-08-25 12:05:23 +08:00
|
|
|
fill_ctype.y = 4444.4444;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, ctype_id, &fill_ctype) < 0)
|
|
|
|
goto error;
|
|
|
|
nerrors += test_rdwr_cases(file, dcpl, "dset12", &fill_ctype, H5D_FILL_TIME_ALLOC, layout, H5T_COMPOUND,
|
|
|
|
ctype_id);
|
2002-04-12 06:53:26 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (nerrors)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Tclose(ctype_id) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Fclose(file) < 0)
|
|
|
|
goto error;
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
1998-10-06 05:01:10 +08:00
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2002-04-12 06:53:26 +08:00
|
|
|
H5Pclose(dcpl);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Tclose(ctype_id);
|
2002-04-12 06:53:26 +08:00
|
|
|
H5Fclose(file);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-04-12 06:53:26 +08:00
|
|
|
return nerrors;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
|
2007-07-04 04:20:34 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_init_integer
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Initializes integer values
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_extend_init_integer(void *_buf, size_t nelmts, const void *_val)
|
|
|
|
{
|
2022-07-27 05:45:46 +08:00
|
|
|
int *buf = (int *)_buf; /* Buffer to initialize */
|
2020-09-30 22:27:10 +08:00
|
|
|
const int *val = (const int *)_val; /* Value to use */
|
2007-07-04 04:20:34 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
while (nelmts) {
|
2007-07-04 04:20:34 +08:00
|
|
|
*buf++ = *val;
|
|
|
|
nelmts--;
|
|
|
|
} /* end while */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
} /* end test_extend_init_integer() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_verify_integer
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Verifies integer values
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-04 04:20:34 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2020-09-30 22:27:10 +08:00
|
|
|
test_extend_verify_integer(unsigned lineno, const hsize_t *offset, const void *_test_val,
|
|
|
|
const void *_compare_val)
|
2007-07-04 04:20:34 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
const int *test_val = (const int *)_test_val; /* Value to test */
|
|
|
|
const int *compare_val = (const int *)_compare_val; /* Value to compare against */
|
2007-07-04 04:20:34 +08:00
|
|
|
|
|
|
|
/* Verify value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (*test_val != *compare_val) {
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not expected.\n", lineno);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
|
|
|
|
"}, read: %d, "
|
|
|
|
"expected: %d\n",
|
|
|
|
offset[0], offset[1], offset[2], offset[3], offset[4], *test_val, *compare_val);
|
2007-07-04 04:20:34 +08:00
|
|
|
goto error;
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
return -1;
|
|
|
|
} /* end test_extend_verify_integer() */
|
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_release_integer
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Release element of integer value
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2015-06-02 03:38:09 +08:00
|
|
|
test_extend_release_integer(void H5_ATTR_UNUSED *_elmt)
|
2007-07-05 23:45:45 +08:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
} /* end test_extend_release_integer() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_init_cmpd_vl
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Initializes compound+vl values
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_extend_init_cmpd_vl(void *_buf, size_t nelmts, const void *_val)
|
|
|
|
{
|
2022-07-27 05:45:46 +08:00
|
|
|
comp_vl_datatype *buf = (comp_vl_datatype *)_buf; /* Buffer to initialize */
|
2020-09-30 22:27:10 +08:00
|
|
|
const comp_vl_datatype *val = (const comp_vl_datatype *)_val; /* Value to use */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
while (nelmts) {
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Shallow copy all fields */
|
|
|
|
*buf = *val;
|
|
|
|
|
|
|
|
/* Deep copy string fields */
|
2023-09-16 06:13:18 +08:00
|
|
|
buf->a = strdup(val->a);
|
|
|
|
buf->b = strdup(val->b);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
buf++;
|
|
|
|
nelmts--;
|
|
|
|
} /* end while */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
} /* end test_extend_init_cmpd_vl() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_verify_cmpd_vl
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Verifies compound+vl values
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2020-09-30 22:27:10 +08:00
|
|
|
test_extend_verify_cmpd_vl(unsigned lineno, const hsize_t *offset, const void *_test_val,
|
|
|
|
const void *_compare_val)
|
2007-07-05 23:45:45 +08:00
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
const comp_vl_datatype *test_val = (const comp_vl_datatype *)_test_val; /* Value to test */
|
|
|
|
const comp_vl_datatype *compare_val =
|
|
|
|
(const comp_vl_datatype *)_compare_val; /* Value to compare against */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify value */
|
2023-09-16 06:13:18 +08:00
|
|
|
if ((test_val->x != compare_val->x) || strcmp(test_val->a, compare_val->a) != 0 ||
|
|
|
|
strcmp(test_val->b, compare_val->b) != 0 || (test_val->y != compare_val->y)) {
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Value read was not expected.\n", lineno);
|
|
|
|
fprintf(stdout,
|
|
|
|
" Elmt = {%" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE ", %" PRIuHSIZE
|
|
|
|
"}, read: {%d, '%s', '%s', %d} "
|
|
|
|
"expected: {%d, '%s', '%s', %d}\n",
|
|
|
|
offset[0], offset[1], offset[2], offset[3], offset[4], test_val->x, test_val->a, test_val->b,
|
|
|
|
test_val->y, compare_val->x, compare_val->a, compare_val->b, compare_val->y);
|
2007-07-05 23:45:45 +08:00
|
|
|
goto error;
|
|
|
|
} /* end if */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
|
|
|
return -1;
|
|
|
|
} /* end test_extend_verify_cmpd_vl() */
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_release_cmpd_vl
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Release element of compound+vl value
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: < 0
|
2007-07-05 23:45:45 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_extend_release_cmpd_vl(void *_elmt)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
comp_vl_datatype *elmt = (comp_vl_datatype *)_elmt; /* Element to free */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Free memory for string fields */
|
2023-06-29 06:48:12 +08:00
|
|
|
free(elmt->a);
|
|
|
|
free(elmt->b);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
} /* end test_extend_release_integer() */
|
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend_cases
|
2007-07-04 02:50:24 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Called to test fill values with various different values
|
2007-07-04 02:50:24 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
|
|
|
* Failure: number of errors
|
2007-07-04 02:50:24 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2021-03-10 00:59:44 +08:00
|
|
|
test_extend_cases(hid_t file, hid_t _dcpl, const char *dset_name, const hsize_t *ch_size, hsize_t *start_size,
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t *max_size, hid_t dtype, void *fillval)
|
2007-07-04 02:50:24 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fspace = H5I_INVALID_HID, mspace = H5I_INVALID_HID; /* File & memory dataspaces */
|
|
|
|
hid_t dset = H5I_INVALID_HID; /* Dataset ID */
|
|
|
|
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */
|
|
|
|
hsize_t extend_size[5]; /* Dimensions to extend to */
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t one[5] = {1, 1, 1, 1, 1}; /* Dimensions of single element dataspace */
|
|
|
|
hsize_t hs_size[5], hs_stride[5], hs_offset[5];
|
|
|
|
size_t nelmts;
|
|
|
|
H5T_class_t dtype_class; /* Class of datatype */
|
|
|
|
int (*init_rtn)(void *, size_t, const void *);
|
|
|
|
int (*verify_rtn)(unsigned, const hsize_t *, const void *, const void *);
|
|
|
|
int (*release_rtn)(void *);
|
|
|
|
size_t val_size; /* Size of element */
|
2022-07-27 05:45:46 +08:00
|
|
|
void *val_rd, *odd_val;
|
|
|
|
const void *init_val, *should_be, *even_val;
|
2020-09-30 22:27:10 +08:00
|
|
|
int val_rd_i, init_val_i = 9999;
|
2020-05-11 00:48:30 +08:00
|
|
|
comp_vl_datatype init_val_c = {87, NULL, NULL, 129};
|
2016-08-13 17:23:53 +08:00
|
|
|
comp_vl_datatype val_rd_c;
|
2022-07-27 05:45:46 +08:00
|
|
|
void *buf = NULL;
|
2020-09-30 22:27:10 +08:00
|
|
|
unsigned odd; /* Whether an odd or even coord. was read */
|
|
|
|
unsigned i, j; /* Local index variables */
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2020-05-11 00:48:30 +08:00
|
|
|
/* Set vl datatype init value strings */
|
2023-09-16 06:13:18 +08:00
|
|
|
init_val_c.a = strdup("baz");
|
|
|
|
init_val_c.b = strdup("mumble");
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
/* Make copy of dataset creation property list */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Pcopy(_dcpl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
|
|
|
#ifndef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_value(dcpl, dtype, fillval) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
#endif
|
|
|
|
|
2007-07-04 04:20:34 +08:00
|
|
|
/* Get class of datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dtype_class = H5Tget_class(dtype)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 04:20:34 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Create a dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Screate_simple(5, start_size, max_size)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
|
|
|
/* Create dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset = H5Dcreate2(file, dset_name, dtype, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2007-07-04 04:20:34 +08:00
|
|
|
/* Set up pointers to elements */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (dtype_class == H5T_INTEGER) {
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Initialize specific values for this datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
val_size = sizeof(int);
|
|
|
|
init_val = &init_val_i;
|
|
|
|
init_rtn = test_extend_init_integer;
|
|
|
|
verify_rtn = test_extend_verify_integer;
|
2007-07-05 23:45:45 +08:00
|
|
|
release_rtn = test_extend_release_integer;
|
2020-09-30 22:27:10 +08:00
|
|
|
val_rd = &val_rd_i;
|
|
|
|
odd_val = fillval;
|
|
|
|
even_val = &init_val_i;
|
2007-07-04 04:20:34 +08:00
|
|
|
} /* end if */
|
2007-07-05 23:45:45 +08:00
|
|
|
else {
|
|
|
|
/* Sanity check */
|
2023-06-28 22:31:56 +08:00
|
|
|
assert(dtype_class == H5T_COMPOUND);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Initialize specific values for this datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
val_size = sizeof(comp_vl_datatype);
|
|
|
|
init_val = &init_val_c;
|
|
|
|
init_rtn = test_extend_init_cmpd_vl;
|
|
|
|
verify_rtn = test_extend_verify_cmpd_vl;
|
2007-07-05 23:45:45 +08:00
|
|
|
release_rtn = test_extend_release_cmpd_vl;
|
2020-09-30 22:27:10 +08:00
|
|
|
val_rd = &val_rd_c;
|
|
|
|
odd_val = fillval;
|
|
|
|
even_val = &init_val_c;
|
2007-07-05 23:45:45 +08:00
|
|
|
} /* end else */
|
2007-07-04 04:20:34 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Read some data and make sure it's the fill value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-04 03:20:02 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0; j < 5; j++)
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % start_size[j];
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-04 02:50:24 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Initialize dataspace & hyperslab info */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0, nelmts = 1; i < 5; i++) {
|
|
|
|
hs_size[i] = (start_size[i] + 1) / 2;
|
|
|
|
hs_offset[i] = 0;
|
|
|
|
hs_stride[i] = 2;
|
|
|
|
nelmts *= hs_size[i];
|
2007-07-04 02:50:24 +08:00
|
|
|
} /* end for */
|
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
/* Check for overflow */
|
2023-06-28 22:31:56 +08:00
|
|
|
assert((nelmts * val_size) == (hsize_t)((size_t)(nelmts * val_size)));
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Allocate & initialize buffer */
|
2023-06-29 06:48:12 +08:00
|
|
|
buf = malloc((size_t)(nelmts * val_size));
|
2007-07-04 04:20:34 +08:00
|
|
|
init_rtn(buf, nelmts, init_val);
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
/* Create dataspace describing memory buffer */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, hs_size, hs_size)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
2008-09-16 23:52:51 +08:00
|
|
|
/* Select elements within file dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, hs_stride, hs_size, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2008-06-26 23:50:13 +08:00
|
|
|
/* Write to all even data locations */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Close memory dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % start_size[j];
|
|
|
|
odd += (unsigned)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
should_be = odd ? odd_val : even_val;
|
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-05 23:45:45 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Extend the dataset one element in each dimension */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 5; i++)
|
2007-07-05 23:45:45 +08:00
|
|
|
extend_size[i] = start_size[i] + 1;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dset_extent(dset, extend_size) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Re-open file dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(fspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Dget_space(dset)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
|
|
|
|
if (hs_offset[j] >= start_size[j])
|
|
|
|
odd = 1;
|
|
|
|
else
|
|
|
|
odd += (unsigned)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
should_be = odd ? odd_val : even_val;
|
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-04 02:50:24 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 03:20:02 +08:00
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Extend the dataset to the maximum dimension sizes */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dset_extent(dset, max_size) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Re-open file dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(fspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Dget_space(dset)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 04:20:34 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % max_size[j];
|
|
|
|
if (hs_offset[j] >= start_size[j])
|
|
|
|
odd = 1;
|
|
|
|
else
|
|
|
|
odd += (unsigned)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
should_be = odd ? odd_val : even_val;
|
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-04 02:50:24 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Shrink the dataset to half of it's maximum size, plus 1/2 of a chunk */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 5; i++)
|
2007-07-05 23:45:45 +08:00
|
|
|
extend_size[i] = (max_size[i] / 2) + (ch_size[i] / 2);
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dset_extent(dset, extend_size) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Re-open file dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(fspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Dget_space(dset)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
|
|
|
|
if (hs_offset[j] >= start_size[j])
|
|
|
|
odd = 1;
|
|
|
|
else
|
|
|
|
odd += (unsigned)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
should_be = odd ? odd_val : even_val;
|
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-05 23:45:45 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Extend the dataset's size by one element, in a dimension that won't
|
|
|
|
* cause additional chunks to be needed */
|
|
|
|
extend_size[2] += 1;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dset_extent(dset, extend_size) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Re-open file dataspace */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(fspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Dget_space(dset)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
2021-12-07 22:27:29 +08:00
|
|
|
/* Create dataspace for single element sized buffer */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((mspace = H5Screate_simple(5, one, NULL)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Set location for "top-most" element in dataset to write */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 5; i++)
|
2007-07-05 23:45:45 +08:00
|
|
|
hs_offset[i] = extend_size[i] - 1;
|
|
|
|
|
|
|
|
/* Select the element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Write one element in a chunk that's 'partial' and overwrite a fill
|
|
|
|
* value that was initialized in the H5Dset_extent() routine. This will
|
|
|
|
* overwrite a fill-value element, which must be de-allocated properly or
|
|
|
|
* next read of another fill-value initialized element in this chunk will
|
|
|
|
* fail.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, buf) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read value back in */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify the element read in is the value written out */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, buf) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2008-09-16 23:52:51 +08:00
|
|
|
|
2008-06-26 23:50:13 +08:00
|
|
|
/* Set the element back to fillval */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dwrite(dset, dtype, mspace, fspace, H5P_DEFAULT, fillval) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Set location for another element initialized by H5Dset_extent() */
|
|
|
|
hs_offset[3] -= 1;
|
|
|
|
|
|
|
|
/* Select the element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read value back in */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify the element read in is the fill-value */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, fillval) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read some data and make sure it's the right value */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < 1000; i++) {
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Set offset for random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (j = 0, odd = 0; j < 5; j++) {
|
|
|
|
hs_offset[j] = (hsize_t)HDrand() % extend_size[j];
|
|
|
|
if (hs_offset[j] >= start_size[j])
|
|
|
|
odd = 1;
|
|
|
|
else
|
|
|
|
odd += (unsigned)(hs_offset[j] % 2);
|
|
|
|
} /* end for */
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Select the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Read the random element */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset, dtype, mspace, fspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Verify the element read in */
|
2020-09-30 22:27:10 +08:00
|
|
|
should_be = odd ? odd_val : even_val;
|
|
|
|
if (verify_rtn((unsigned)__LINE__, hs_offset, val_rd, should_be) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release any VL components */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Treclaim(dtype, mspace, H5P_DEFAULT, val_rd) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Clear the read buffer */
|
2023-06-30 03:33:46 +08:00
|
|
|
memset(val_rd, 0, val_size);
|
2007-07-05 23:45:45 +08:00
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(mspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Release elements & memory buffer */
|
2020-09-30 22:27:10 +08:00
|
|
|
for (i = 0; i < nelmts; i++)
|
2007-07-05 23:45:45 +08:00
|
|
|
release_rtn((void *)((char *)buf + (val_size * i)));
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2023-06-29 06:48:12 +08:00
|
|
|
free(init_val_c.a);
|
|
|
|
free(init_val_c.b);
|
|
|
|
free(buf);
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Cleanup IDs */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(dcpl) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dclose(dset) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(fspace) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
error:
|
2023-06-29 06:48:12 +08:00
|
|
|
free(init_val_c.a);
|
|
|
|
free(init_val_c.b);
|
|
|
|
free(buf);
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Dclose(dset);
|
|
|
|
H5Sclose(fspace);
|
|
|
|
H5Sclose(mspace);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2007-07-04 02:50:24 +08:00
|
|
|
|
|
|
|
return -1;
|
|
|
|
} /* end test_extend_cases() */
|
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_extend
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Test that filling works okay when a dataset is extended.
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure: number of errors
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
1999-06-15 22:58:25 +08:00
|
|
|
test_extend(hid_t fapl, const char *base_name, H5D_layout_t layout)
|
1998-10-06 05:01:10 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file = H5I_INVALID_HID; /* File ID */
|
|
|
|
hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list ID */
|
|
|
|
hid_t cmpd_vl_tid = H5I_INVALID_HID; /* Compound+vl datatype ID */
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t start_size[5] = {8, 8, 8, 4, 2};
|
|
|
|
hsize_t max_size[5] = {32, 32, 32, 16, 8};
|
|
|
|
hsize_t ch_size[5] = {1, 8, 8, 4, 2};
|
1998-10-06 05:01:10 +08:00
|
|
|
#ifdef NO_FILLING
|
2020-09-30 22:27:10 +08:00
|
|
|
int fillval_i = 0;
|
1998-10-06 05:01:10 +08:00
|
|
|
#else
|
2020-09-30 22:27:10 +08:00
|
|
|
int fillval_i = 0x4c70f1cd;
|
1998-10-06 05:01:10 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
comp_vl_datatype fillval_c = {32, NULL, NULL, 64}; /* Fill value for compound+vl datatype tests */
|
|
|
|
char filename[1024];
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Print testing message */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CHUNKED == layout)
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("chunked dataset extend");
|
2007-07-04 02:50:24 +08:00
|
|
|
else
|
2022-05-04 23:49:01 +08:00
|
|
|
TESTING("contiguous dataset extend");
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2020-05-11 00:48:30 +08:00
|
|
|
/* Set vl datatype fill value strings */
|
2023-09-16 06:13:18 +08:00
|
|
|
fillval_c.a = strdup("foo");
|
|
|
|
fillval_c.b = strdup("bar");
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Create dataset creation property list */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CHUNKED == layout)
|
|
|
|
if (H5Pset_chunk(dcpl, 5, ch_size) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
/*
|
|
|
|
* Remove this once contiguous datasets can support extensions in other
|
|
|
|
* than the slowest varying dimension. The purpose of this block is to
|
|
|
|
* make only the slowest varying dimension extendible and yet have the
|
|
|
|
* same total number of elements as originally.
|
|
|
|
*
|
|
|
|
* If this is removed prematurely then you will get an error `only the
|
|
|
|
* first dimension can be extendible' as long as the test isn't skipped
|
|
|
|
* below.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CONTIGUOUS == layout) {
|
|
|
|
max_size[0] = (max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4]) /
|
|
|
|
(start_size[1] * start_size[2] * start_size[3] * start_size[4]);
|
|
|
|
max_size[1] = start_size[1];
|
|
|
|
max_size[2] = start_size[2];
|
|
|
|
max_size[3] = start_size[3];
|
|
|
|
max_size[4] = start_size[4];
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
/*
|
|
|
|
* Remove this once internal contiguous datasets can support
|
|
|
|
* extending. If it's removed prematurely you will get an error
|
|
|
|
* `extendible contiguous non-external dataset' as long as the test isn't
|
|
|
|
* skipped below.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CONTIGUOUS == layout) {
|
|
|
|
int fd;
|
|
|
|
hsize_t nelmts;
|
2007-07-04 02:50:24 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
nelmts = max_size[0] * max_size[1] * max_size[2] * max_size[3] * max_size[4];
|
|
|
|
if ((fd = HDopen(FILE_NAME_RAW, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0 ||
|
|
|
|
HDclose(fd) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_external(dcpl, FILE_NAME_RAW, (off_t)0, (hsize_t)nelmts * sizeof(int)) < 0)
|
|
|
|
goto error;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
/*
|
2021-12-07 22:27:29 +08:00
|
|
|
* Remove this when contiguous datasets can be extended to some
|
1998-10-06 05:01:10 +08:00
|
|
|
* predetermined fininte size, even if it's just in the slowest varying
|
|
|
|
* dimension. If it's removed prematurely then you'll get one of the
|
|
|
|
* errors described above or `unable to select fill value region'.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5D_CONTIGUOUS == layout) {
|
|
|
|
SKIPPED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator");
|
2020-09-30 22:27:10 +08:00
|
|
|
goto skip;
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|
|
|
|
#endif
|
2005-08-14 04:53:35 +08:00
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/* Create a file and dataset */
|
1999-06-15 22:58:25 +08:00
|
|
|
h5_fixname(base_name, fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2007-07-05 23:45:45 +08:00
|
|
|
/* Get the compound+vl datatype */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((cmpd_vl_tid = create_compound_vl_type()) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Test integer datatype case */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_extend_cases(file, dcpl, "dset1", ch_size, start_size, max_size, H5T_NATIVE_INT, &fillval_i) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2007-07-05 23:45:45 +08:00
|
|
|
|
|
|
|
/* Test compound+vl datatype datatype case */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_extend_cases(file, dcpl, "dset2", ch_size, start_size, max_size, cmpd_vl_tid, &fillval_c) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2007-07-04 02:50:24 +08:00
|
|
|
/* Cleanup */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Tclose(cmpd_vl_tid) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pclose(dcpl) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Fclose(file) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2023-06-29 06:48:12 +08:00
|
|
|
free(fillval_c.a);
|
|
|
|
free(fillval_c.b);
|
2020-05-11 00:48:30 +08:00
|
|
|
|
1998-11-24 04:40:35 +08:00
|
|
|
PASSED();
|
2007-07-04 02:50:24 +08:00
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
return 0;
|
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
error:
|
2023-06-29 06:48:12 +08:00
|
|
|
free(fillval_c.a);
|
|
|
|
free(fillval_c.b);
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2007-07-05 23:45:45 +08:00
|
|
|
H5Tclose(cmpd_vl_tid);
|
2020-09-30 22:27:10 +08:00
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Fclose(file);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1998-10-06 05:01:10 +08:00
|
|
|
return 1;
|
1999-01-07 19:42:04 +08:00
|
|
|
|
2007-07-04 03:20:02 +08:00
|
|
|
skip:
|
2023-06-29 06:48:12 +08:00
|
|
|
free(fillval_c.a);
|
|
|
|
free(fillval_c.b);
|
2020-05-11 00:48:30 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Fclose(file);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
1999-01-07 19:42:04 +08:00
|
|
|
return 0;
|
2007-07-04 02:50:24 +08:00
|
|
|
} /* end test_extend() */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_compatible
|
|
|
|
*
|
|
|
|
* Purpose: Tests fill value and dataspace for datasets created by v1.4
|
|
|
|
* library.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
2009-03-11 03:00:39 +08:00
|
|
|
test_compatible(void)
|
2002-04-12 06:53:26 +08:00
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file = H5I_INVALID_HID, dset1 = H5I_INVALID_HID, dset2 = H5I_INVALID_HID;
|
|
|
|
hid_t dcpl1 = H5I_INVALID_HID, dcpl2 = H5I_INVALID_HID, fspace = H5I_INVALID_HID,
|
|
|
|
mspace = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
int rd_fill = 0, fill_val = 4444, val_rd = 0;
|
|
|
|
hsize_t dims[2], one[2] = {1, 1};
|
|
|
|
hsize_t hs_offset[2] = {3, 4};
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
H5D_fill_value_t status;
|
2022-07-27 05:45:46 +08:00
|
|
|
const char *testfile = H5_get_srcdir_filename(FILE_COMPATIBLE); /* Corrected test file name */
|
2002-04-12 06:53:26 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
TESTING("contiguous dataset compatibility with v. 1.4");
|
2002-04-13 05:08:48 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fopen(testfile, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) {
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Could not open file %s. Try set $srcdir to point at the "
|
|
|
|
"source directory of test\n",
|
|
|
|
testfile);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((dset1 = H5Dopen2(file, "dset1", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl1 = H5Dget_create_plist(dset1)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pfill_value_defined(dcpl1, &status) < 0)
|
|
|
|
goto error;
|
|
|
|
if (status != H5D_FILL_VALUE_UNDEFINED) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_UNDEFINED\n", (long)status);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if ((fspace = H5Dget_space(dset1)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sget_simple_extent_dims(fspace, dims, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if (dims[0] != 8 || dims[1] != 8) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got a different dimension size than what was set.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if ((mspace = H5Screate_simple(2, one, NULL)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
|
|
|
|
goto error;
|
|
|
|
if (val_rd != 0) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got a different value than what was set.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %ld, set 0\n", (long)val_rd);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (H5Pclose(dcpl1) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(fspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(mspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset1) < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if ((dset2 = H5Dopen2(file, "dset2", H5P_DEFAULT)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((dcpl2 = H5Dget_create_plist(dset2)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pfill_value_defined(dcpl2, &status) < 0)
|
|
|
|
goto error;
|
|
|
|
if (status != H5D_FILL_VALUE_USER_DEFINED) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got status=%ld, suppose to be H5D_FILL_VALUE_USER_DEFINED\n", (long)status);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (H5Pget_fill_value(dcpl2, H5T_NATIVE_INT, &rd_fill) < 0)
|
|
|
|
goto error;
|
|
|
|
if (rd_fill != fill_val) {
|
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" %d: Got a different fill value than what was set.", __LINE__);
|
|
|
|
printf(" Got %ld, set %ld\n", (long)rd_fill, (long)fill_val);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
fspace = -1;
|
|
|
|
if ((fspace = H5Dget_space(dset2)) < 0)
|
|
|
|
goto error;
|
|
|
|
dims[0] = dims[1] = (hsize_t)-1;
|
|
|
|
if (H5Sget_simple_extent_dims(fspace, dims, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if (dims[0] != 8 || dims[1] != 8) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got a different dimension size than what was set.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got dims[0]=%ld, dims[1]=%ld, set 8x8\n", (long)dims[0], (long)dims[1]);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if ((mspace = H5Screate_simple(2, one, NULL)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sselect_hyperslab(fspace, H5S_SELECT_SET, hs_offset, NULL, one, NULL) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dread(dset2, H5T_NATIVE_INT, mspace, fspace, H5P_DEFAULT, &val_rd) < 0)
|
|
|
|
goto error;
|
|
|
|
if (val_rd != fill_val) {
|
|
|
|
H5_FAILED();
|
2023-09-16 06:13:18 +08:00
|
|
|
puts(" Got a different value than what was set.");
|
2023-06-28 23:31:32 +08:00
|
|
|
printf(" Got %ld, set %ld\n", (long)val_rd, (long)fill_val);
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
if (H5Pclose(dcpl2) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(fspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(mspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset2) < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (H5Fclose(file) < 0)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
PASSED();
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
|
|
|
return 0;
|
2002-04-12 06:53:26 +08:00
|
|
|
|
|
|
|
error:
|
2020-09-30 22:27:10 +08:00
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2002-04-12 06:53:26 +08:00
|
|
|
H5Pclose(dcpl1);
|
|
|
|
H5Sclose(fspace);
|
|
|
|
H5Sclose(mspace);
|
|
|
|
H5Dclose(dset1);
|
|
|
|
H5Pclose(dcpl2);
|
|
|
|
H5Sclose(fspace);
|
|
|
|
H5Dclose(dset2);
|
|
|
|
H5Fclose(file);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2002-04-12 06:53:26 +08:00
|
|
|
return 1;
|
|
|
|
}
|
2005-08-14 04:53:35 +08:00
|
|
|
|
2013-05-03 03:19:06 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: test_partalloc_cases
|
2013-05-03 03:19:06 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests fill values read and write for datasets.
|
2013-05-03 03:19:06 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success: 0
|
2013-05-03 03:19:06 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure: 1
|
2013-05-03 03:19:06 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
test_partalloc_cases(hid_t file, hid_t dcpl, const char *dname, H5D_fill_time_t fill_time)
|
|
|
|
{
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fspace = H5I_INVALID_HID, dset1 = H5I_INVALID_HID, rspace = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
herr_t ret;
|
|
|
|
hsize_t ds_size[2] = {4, 4};
|
|
|
|
hsize_t max_size[2] = {H5S_UNLIMITED, 4};
|
|
|
|
hsize_t chunk_size[2] = {1, 4};
|
|
|
|
int fillval = (-1);
|
|
|
|
int w_values[] = {42}; /* New value to be written */
|
|
|
|
int f_values[4] = {88, 88, 88, 88}; /* pre-seed read buffer with known values */
|
|
|
|
int r_values[4] = {88, 88, 88, 88}; /* pre-seed read buffer with known values */
|
|
|
|
hsize_t coord[1][2]; /* coordinate(s) of point to write */
|
2013-05-03 03:19:06 +08:00
|
|
|
hsize_t start[2], count[2];
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
fillval = 0; /* default fill value is zero */
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* Create dataset with 4x4 integer dataset */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fspace = H5Screate_simple(2, ds_size, max_size)) < 0)
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dset1 = H5Dcreate2(file, dname, H5T_NATIVE_INT, fspace, H5P_DEFAULT, dcpl, H5P_DEFAULT)) < 0)
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Select a point in the file dataspace.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
coord[0][0] = 0;
|
|
|
|
coord[0][1] = 0;
|
|
|
|
if (H5Sselect_elements(fspace, H5S_SELECT_SET, (size_t)1, (const hsize_t *)coord))
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2013-05-03 03:19:06 +08:00
|
|
|
/*
|
|
|
|
* Write single data point to the dataset.
|
|
|
|
*/
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((ret = H5Dwrite(dset1, H5T_NATIVE_INT, H5S_ALL, fspace, H5P_DEFAULT, w_values)) < 0) {
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
}
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2013-05-03 03:19:06 +08:00
|
|
|
/* Read a line/chunk and make sure values are right */
|
|
|
|
rspace = H5Screate_simple(2, chunk_size, NULL);
|
|
|
|
|
|
|
|
/* Read the first row of elements: one known plus three fill */
|
|
|
|
start[0] = 0;
|
|
|
|
start[1] = 0;
|
|
|
|
count[0] = 1;
|
|
|
|
count[1] = 4;
|
|
|
|
if ((ret = H5Sselect_hyperslab(fspace, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
|
|
|
|
goto error;
|
|
|
|
if ((ret = H5Sselect_all(rspace)) < 0)
|
2020-09-30 22:27:10 +08:00
|
|
|
goto error;
|
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &r_values) < 0)
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
2013-05-03 23:39:44 +08:00
|
|
|
|
2013-05-03 03:19:06 +08:00
|
|
|
/* Read the third row of elements: all fill */
|
|
|
|
start[0] = 2;
|
|
|
|
start[1] = 0;
|
|
|
|
count[0] = 1;
|
|
|
|
count[1] = 4;
|
|
|
|
if ((ret = H5Sselect_hyperslab(fspace, H5S_SELECT_SET, start, NULL, count, NULL)) < 0)
|
|
|
|
goto error;
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Dread(dset1, H5T_NATIVE_INT, rspace, fspace, H5P_DEFAULT, &f_values) < 0)
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (fill_time != H5D_FILL_TIME_NEVER) {
|
2013-05-03 03:19:06 +08:00
|
|
|
/* check allocated chunk */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((r_values[0] != w_values[0]) || (r_values[1] != fillval) || (r_values[2] != fillval) ||
|
|
|
|
(r_values[3] != fillval)) {
|
2013-05-03 03:19:06 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Allocated chunk value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)r_values[0],
|
|
|
|
(long)r_values[1], (long)r_values[2], (long)r_values[3], (long)w_values[0], (long)fillval,
|
|
|
|
(long)fillval, (long)fillval);
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/* check unallocated chunk */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((f_values[0] != fillval) || (f_values[1] != fillval) || (f_values[2] != fillval) ||
|
|
|
|
(f_values[3] != fillval)) {
|
2013-05-03 03:19:06 +08:00
|
|
|
H5_FAILED();
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "%u: Unallocated chunk value read was not correct.\n", (unsigned)__LINE__);
|
|
|
|
printf(" {%ld,%ld,%ld,%ld} should be {%ld,%ld,%ld,%ld}\n", (long)f_values[0],
|
|
|
|
(long)f_values[1], (long)f_values[2], (long)f_values[3], (long)fillval, (long)fillval,
|
|
|
|
(long)fillval, (long)fillval);
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
/* for the "never fill" case expect to get trash values, so skip */
|
|
|
|
}
|
2020-09-30 22:27:10 +08:00
|
|
|
else if (fill_time == H5D_FILL_TIME_NEVER) {
|
2013-05-03 03:19:06 +08:00
|
|
|
}
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Sclose(rspace) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Dclose(dset1) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Sclose(fspace) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
|
|
|
H5Dclose(dset1);
|
|
|
|
H5Sclose(fspace);
|
|
|
|
H5Sclose(rspace);
|
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
* Function: test_partalloc
|
|
|
|
*
|
|
|
|
* Purpose: Tests fill values for chunked, partially-allocated datasets.
|
|
|
|
* Regression test for HDFFV-8247.
|
|
|
|
*
|
|
|
|
* Return: Success: 0
|
|
|
|
*
|
|
|
|
* Failure: number of errors
|
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
test_partalloc(hid_t fapl, const char *base_name)
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
char filename[1024];
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t file = H5I_INVALID_HID, dcpl = H5I_INVALID_HID;
|
2020-09-30 22:27:10 +08:00
|
|
|
hsize_t ch_size[2] = {1, 4};
|
|
|
|
int nerrors = 0;
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
TESTING("chunked dataset partially allocated I/O");
|
|
|
|
|
|
|
|
h5_fixname(base_name, fapl, filename, sizeof filename);
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((file = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0)
|
2013-05-03 03:19:06 +08:00
|
|
|
goto error;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((dcpl = H5Pcreate(H5P_DATASET_CREATE)) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Pset_chunk(dcpl, 2, ch_size) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* I. Test H5D_ALLOC_TIME_LATE space allocation cases */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_LATE) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "\nALLOC_TIME_LATE\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_ALLOC\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset1", H5D_FILL_TIME_ALLOC);
|
2019-08-16 05:46:00 +08:00
|
|
|
|
2013-05-03 03:19:06 +08:00
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_NEVER\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset2", H5D_FILL_TIME_NEVER);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_IFSET\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset3", H5D_FILL_TIME_IFSET);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* II. Test H5D_ALLOC_TIME_INCR space allocation cases */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_INCR) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "\nALLOC_TIME_INCR\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_ALLOC\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset4", H5D_FILL_TIME_ALLOC);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_NEVER\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset5", H5D_FILL_TIME_NEVER);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_IFSET\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset6", H5D_FILL_TIME_IFSET);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* III. Test H5D_ALLOC_TIME_EARLY space allocation cases */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_alloc_time(dcpl, H5D_ALLOC_TIME_EARLY) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, "\nALLOC_TIME_EARLY\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_ALLOC as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_ALLOC) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_ALLOC\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset7", H5D_FILL_TIME_ALLOC);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_NEVER as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_NEVER) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_NEVER\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset8", H5D_FILL_TIME_NEVER);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
|
|
|
/* case for H5D_FILL_TIME_IFSET as fill write time and fill value to be default */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_fill_time(dcpl, H5D_FILL_TIME_IFSET) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
#ifdef DEBUG
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stdout, " FILL_TIME_IFSET\n");
|
2013-05-03 03:19:06 +08:00
|
|
|
#endif
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_partalloc_cases(file, dcpl, "dset9", H5D_FILL_TIME_IFSET);
|
2013-05-03 03:19:06 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (nerrors)
|
|
|
|
goto error;
|
|
|
|
if (H5Pclose(dcpl) < 0)
|
|
|
|
goto error;
|
|
|
|
if (H5Fclose(file) < 0)
|
|
|
|
goto error;
|
2013-05-03 03:19:06 +08:00
|
|
|
PASSED();
|
|
|
|
return 0;
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
error:
|
|
|
|
H5E_BEGIN_TRY
|
|
|
|
{
|
2013-05-03 03:19:06 +08:00
|
|
|
H5Pclose(dcpl);
|
|
|
|
H5Fclose(file);
|
2020-09-30 22:27:10 +08:00
|
|
|
}
|
2023-06-16 12:49:02 +08:00
|
|
|
H5E_END_TRY
|
2013-05-03 03:19:06 +08:00
|
|
|
return nerrors;
|
|
|
|
}
|
|
|
|
|
1998-10-06 05:01:10 +08:00
|
|
|
/*-------------------------------------------------------------------------
|
2019-08-16 05:46:00 +08:00
|
|
|
* Function: main
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Purpose: Tests fill values
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Return: Success:
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
2019-08-16 05:46:00 +08:00
|
|
|
* Failure:
|
1998-10-06 05:01:10 +08:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2020-09-30 22:27:10 +08:00
|
|
|
int nerrors = 0, argno, test_contig = 1, test_chunk = 1, test_compact = 1;
|
2023-09-09 07:06:23 +08:00
|
|
|
hid_t fapl = (H5I_INVALID_HID), fapl2 = (H5I_INVALID_HID); /* File access property lists */
|
|
|
|
unsigned new_format; /* Whether to use the new format or not */
|
2023-09-06 04:11:52 +08:00
|
|
|
bool driver_is_default_compatible;
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (argc >= 2) {
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
test_contig = test_chunk = test_compact = 0;
|
2020-09-30 22:27:10 +08:00
|
|
|
for (argno = 1; argno < argc; argno++) {
|
2023-09-16 06:13:18 +08:00
|
|
|
if (!strcmp(argv[argno], "contiguous"))
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
test_contig = 1;
|
2023-09-16 06:13:18 +08:00
|
|
|
else if (!strcmp(argv[argno], "chunked"))
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
test_chunk = 1;
|
2023-09-16 06:13:18 +08:00
|
|
|
else if (!strcmp(argv[argno], "compact"))
|
2020-09-30 22:27:10 +08:00
|
|
|
test_compact = 1;
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
else {
|
2023-06-28 23:31:32 +08:00
|
|
|
fprintf(stderr, "usage: %s [contiguous] [chunked] [compact]\n", argv[0]);
|
2023-06-29 23:18:01 +08:00
|
|
|
exit(EXIT_FAILURE);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
}
|
|
|
|
} /* end for */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end if */
|
1998-10-06 05:01:10 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
h5_reset();
|
|
|
|
fapl = h5_fileaccess();
|
1998-10-06 05:01:10 +08:00
|
|
|
|
Subfiling VFD (#1883)
* Added support for vector I/O calls to the VFD layer, and
associated test code. Note that this includes the optimization
to allow shortened sizes and types arrays to allow more space
efficient representations of vectors in which all entries are
of the same size and/or type. See the Selection I/o RFC for
further details.
Tested serial and parallel, debug and production on Charis.
serial and parallel debug only on Jelly.
* ran code formatter
quick serial build and test on jelly
* Add H5FD_read_selection() and H5FD_write_selection(). Currently only
translate to scalar calls. Fix const buf in H5FD_write_vector().
* Format source
* Fix comments
* Add selection I/O to chunk code, used when: not using chunk cache, no
datatype conversion, no I/O filters, no page buffer, not using collective
I/O. Requires global variable H5_use_selection_io_g be set to TRUE.
Implemented selection to vector I/O transaltion at the file driver
layer.
* Fix formatting unrelated to previous change to stop github from
complaining.
* Add full API support for selection I/O. Add tests for this.
* Implement selection I/O for contiguous datasets. Fix bug in selection
I/O translation. Add const qualifiers to some internal selection I/O
routines to maintain const-correctness while avoiding memcpys.
* Added vector read / write support to the MPIO VFD, with associated
test code (see testpar/t_vfd.c).
Note that this implementation does NOT support vector entries of
size greater than 2 GB. This must be repaired before release,
but it should be good enough for correctness testing.
As MPIO requires vector I/O requests to be sorted in increasing
address order, also added a vector sort utility in H5FDint.c This
function is tested in passing by the MPIO vector I/O extension.
In passing, repaired a bug in size / type vector extension management
in H5FD_read/write_vector()
Tested parallel debug and production on charis and Jelly.
* Ran source code formatter
* Add support for independent parallel I/O with selection I/O. Add
HDF5_USE_SELECTION_IO env var to control selection I/O (default off).
* Implement parallel collective support for selection I/O.
* Fix comments and run formatter.
* Update selection IO branch with develop (#1215)
Merged branch 'develop' into selection_io
* Sync with develop (#1262)
Updated the branch with develop changes.
* Implement big I/O support for vector I/O requests in the MPIO file
driver.
* Free arrays in H5FD__mpio_read/write_vector() as soon as they're not
needed, to cut down on memory usage during I/O.
* Address comments from code review. Fix const warnings with
H5S_SEL_ITER_INIT().
* Committing clang-format changes
* Feature/subfiling (#1464)
* Initial checkin of merged sub-filing VFD.
Passes regression tests (debug/shared/paralle) on Jelly.
However, bugs and many compiler warnings remain -- not suitable
for merge to develop.
* Minor mods to src/H5FDsubfile_mpi.c to address errors reported by autogen.sh
* Code formatting run -- no test
* Merged my subfiling code fixes into the new selection_io_branch
* Forgot to add the FindMERCURY.cmake file. This will probably disappear soon
* attempting to make a more reliable subfile file open which doesn't return errors. For some unknown reason, the regular posix open will occasionally fail to create a subfile. Some better error handling for file close has been added.
* added NULL option for H5FD_subfiling_config_t in H5Pset_fapl_subfiling (#1034)
* NULL option automatically stacks IOC VFD for subfiling and returns a valid fapl.
* added doxygen subfiling APIs
* Various fixes which allow the IOR benchmark to run correctly
* Lots of updates including the packaging up of the mercury_util source files to enable easier builds for our Benchmarking
* Interim checkin of selection_io_with_subfiling_vfd branch
Moddified testpar/t_vfd.c to test the subfiling vfd with default configuration.
Must update this code to run with a variety of configurations -- most particularly
multiple IO concentrators, and stripe depth small enough to test the other IO
concentrators.
testpar/t_vfd.c exposed a large number of race condidtions -- symtoms included:
1) Crashes (usually seg faults)
2) Heap corruption
3) Stack corruption
4) Double frees of heap space
5) Hangs
6) Out of order execution of I/O requests / violations of POSIX semantics
7) Swapped write requests
Items 1 - 4 turned out to be primarily caused by file close issues --
specifically, the main I/O concentrator thread and its pool of worker threads
were not being shut down properly on file close. Addressing this issue in
combination with some other minor fixes seems to have addressed these issues.
Items 5 & 6 appear to have been caused by issue of I/O requests to the
thread pool in an order that did not maintain POSIX semantics. A rewrite of
the I/O request dispatch code appears to have solved these issues.
Item 7 seems to have been caused by multiple write requests from a given
rank being read by the wrong worker thread. Code to issue "unique" tags for
each write request via the ACK message appears to have cleaned this up.
Note that the code is still in poor condtition. A partial list of known
defects includes:
a) Race condiditon on file close that allows superblock writes to arrive
at the I/O concentrator after it has been shutdown. This defect is
most evident when testpar/t_subfiling_vfd is run with 8 ranks.
b) No error reporting from I/O concentrators -- must design and implement
this. For now, mostly just asserts, which suggests that it should be
run in debug mode.
c) Much commented out and/or un-used code.
d) Code orgnaization
e) Build system with bits of Mercury is awkward -- think of shifting
to pthreads with our own thread pool code.
f) Need to add native support for vector and selection I/O to the subfiling
VFD.
g) Need to review, and posibly rework configuration code.
h) Need to store subfile configuration data in a superblock extension message,
and add code to use this data on file open.
i) Test code is inadequate -- expect more issues as it is extended.
In particular, there is no unit test code for the I/O request dispatch code.
While I think it is correct at present, we need test code to verify this.
Similarly, we need to test with multiple I/O concentrators and much smaller
stripe depth.
My actual code changes were limited to:
src/H5FDioc.c
src/H5FDioc_threads.c
src/H5FDsubfile_int.c
src/H5FDsubfile_mpi.c
src/H5FDsubfiling.c
src/H5FDsubfiling.h
src/H5FDsubfiling_priv.h
testpar/t_subfiling_vfd.c
testpar/t_vfd.c
I'm not sure what is going on with the deletions in src/mercury/src/util.
Tested parallel/debug on Charis and Jelly
* subfiling with selection IO (#1219)
Merged branch 'selection_io' into subfiling branch.
* Subfile name fixes (#1250)
* fixed subfiling naming convention, and added leading zero to rank names.
* Merge branch 'selection_io' into selection_io_with_subfiling_vfd (#1265)
* Added script to join subfiles into a single HDF5 file (#1350)
* Modified H5FD__subfiling_query() to report that the sub-filing VFD supports MPI
This exposed issues with truncate and get EOF in the sub-filing VFD.
I believe I have addressed these issues (get EOF not as fully tested as it should be), howeer,
it exposed race conditions resulting in hangs. As of this writing, I have not been able
to chase these down.
Note that the tests that expose these race conditions are in testpar/t_subfiling_vfd.c, and
are currently skipped. Unskip these tests to reproduce the race conditions.
tested (to the extent possible) debug/parallel on charis and jelly.
* Committing clang-format changes
* fixed H5MM_free
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Move Subfiling VFD components into H5FDsubfiling source directory
* Update Autotools build and add H5_HAVE_SUBFILING_VFD macro to H5pubconf.h
* Tidy up CMake build of subfiling sources
* Merge branch 'develop' into feature/subfiling (#1539)
Merge branch 'develop' into feature/subfiling
* Add VFD interface version field to Subfiling and IOC VFDs
* Merge branch 'develop' into feature/subfiling (#1557)
Merge branch 'develop' into feature/subfiling
* Merge branch 'develop' into feature/subfiling (#1563)
Merge branch 'develop' into feature/subfiling
* Tidy up merge artifacts after rebase on develop
* Fix incorrect variable in mirror VFD utils CMake
* Ensure VFD values are always defined
* Add subfiling to CMake VFD_LIST if built
* Mark MPI I/O driver self-initialization global as static
* Add Subfiling VFD to predefined VFDs for HDF5_DRIVER env. variable
* Initial progress towards separating private vs. public subfiling code
* include libgen.h in t_vfd tests for correct dirname/basename
* Committing clang-format changes
* removed mercury option, included subfiling header path (#1577)
Added subfiling status to configure output, installed h5fuse.sh to build directory for use in future tests.
* added check for stdatomic.h (#1578)
* added check for stdatomic.h with subfiling
* added H5_HAVE_SUBFILING_VFD for cmake
* fix old-style-definition warning (#1582)
* fix old-style-definition warning
* added test for enable parallel with subfiling VFD (#1586)
Fails if subfiling VFD is not used with parallel support.
* Subfiling/IOC VFD fixes and tidying (#1619)
* Rename CMake option for Subfiling VFD to be consistent with other VFDs
* Miscellaneous Subfiling fixes
Add error message for unset MPI communicator
Support dynamic loading of subfiling VFD with default configuration
* Temporary fix for subfile name issue
* Added subfile checks (#1634)
* added subfile checks
* Feature/subfiling (#1655)
* Subfiling/IOC VFD cleanup
Fix misuse of MPI_COMM_WORLD in IOC VFD
Propagate Subfiling FAPL MPI settings down to IOC FAPL in default
configuration case
Cleanup IOC VFD debugging code
Change sprintf to snprintf in a few places
* Major work on separating Subfiling and IOC VFDs from each other
* Re-write async_completion func to not overuse stack
* Replace usage of MPI_COMM_WORLD with file's actual MPI communicator
* Refactor H5FDsubfile_mpi.c
* Remove empty file H5FDsubfile_mpi.c
* Separate IOC VFD errors to its own error stack
* Committing clang-format changes
* Remove H5TRACE macros from H5FDioc.c
* Integrate H5FDioc_threads.c with IOC error stack
* Fix for subfile name generation
Use number of I/O concentrators from existing subfiling configuration file, if one exists
* Add temporary barrier in "Get EOF" operation to prevent races on EOF
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for retrieval of machine Host ID
* Default to MPI_COMM_WORLD if no MPI params set
* added libs rt and pthreads (#1673)
* added libs rt and pthreads
* Feature/subfiling (#1689)
* More tidying of IOC VFD and subfiling debug code
* Remove old unused log file code
* Clear FID from active file map on failure
* Fix bug in generation of subfile names when truncating file
* Change subfile names to start from 1 instead of 0
* Use long long for user-specified stripe size from environment variable
* Skip 0-sized I/Os in low-level IOC I/O routines
* Don't update EOF on read
* Convert printed warning about data size mismatch to assertion
* Don't add base file address to I/O addresses twice
Base address should already be applied as part of H5FDwrite/read_vector calls
* Account for 0-sized I/O vector entries in subfile write/read functions
* Rewrite init_indep_io for clarity
* Correction for IOC wraparound calculations
* Some corrections to iovec calculations
* Remove temporary barrier on EOF retrieval
* Complete work request queue entry on error instead of skipping over
* Account for stripe size wraparound for sf_col_offset calculation
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Re-write and fix bugs in I/O vector filling routines (#1703)
* Rewrite I/O vector filling routines for clarity
* Fix bug with iovec_fill_last when last I/O size is 0
* added subfiling_dir line read (#1714)
* added subfiling_dir line read and use it
* shellcheck fixes
* I/O request dispatch logic update (#1731)
Short-circuit I/O request dispatch when head of I/O queue is an
in-progress get EOF or truncate operation. This prevents an issue where
a write operation can be dispatched alongside a get EOF/truncate
operation, whereas all I/O requests are supposed to be ineligible for
dispatch until the get EOF/truncate is completed
* h5fuse.sh.in clean-up (#1757)
* Added command-line options
* Committing clang-format changes
* Align with changes from develop
* Mimic MPI I/O VFD for EOF handling
* Initialize context_id field for work request objects
* Use logfile for some debugging information
* Use atomic store to set IOC ready flag
* Use separate communicator for sending file EOF data
Minor IOC cleanup
* Use H5_subfile_fid_to_context to get context ID for file in Subfiling
VFD
* IOVEC calculation fixes
* Updates for debugging code
* Minor fixes for threaded code
* Committing clang-format changes
* Use separate MPI communicator for barrier operations
* Committing clang-format changes
* Rewrite EOF routine to use nonblocking MPI communication
* Committing clang-format changes
* Always dispatch I/O work requests in IOC main loop
* Return distinct MPI communicator to library when requested
* Minor warning cleanup
* Committing clang-format changes
* Generate h5fuse.sh from h5fuse.sh.in in CMake
* Send truncate messages to correct IOC rank
* Committing clang-format changes
* Miscellaneous cleanup
Post some MPI receives before sends
Free some duplicated MPI communicator/Info objects
Remove unnecessary extra MPI_Barrier
* Warning cleanup
* Fix for leaked MPI communicator
* Retrieve file EOF on single rank and bcast it
* Fixes for a few failure paths
* Cleanup of IOC file opens
* Committing clang-format changes
* Use plan MPI_Send for send of EOF messages
* Always check MPI thread support level during Subfiling init
* Committing clang-format changes
* Handle a hang on failure when IOCs can't open subfiles
* Committing clang-format changes
* Refactor file open status consensus check
* Committing clang-format changes
* Fix for MPI_Comm_free being called after MPI_Finalize
* Fix VFD test by setting MPI params before setting subfiling on FAPL
* Update Subfiling VFD error handling and error stack usage
* Improvements for Subfiling logfiles
* Remove prototypes for currently unused routines
* Disable I/O queue stat collecting by default
* Remove unused serialization mutex variable
* Update VFD testing to take subfiling VFD into account
* Fix usage of global subfiling application layout object
* Minor fixes for failure pathways
* Keep track of the number of failures in an IOC I/O queue
* Make sure not to exceed MPI_TAG_UB value for data communication messages
* Committing clang-format changes
* Update for rename of some H5FD 'ctl' opcodes
* Always include Subfiling's public header files in hdf5.h
* Remove old unused code and comments
* Implement support for per-file I/O queues
Allows the subfiling VFD to have multiple HDF5 files open simultaneously
* Use simple MPI_Iprobe over unnecessary MPI_Improbe
* Committing clang-format changes
* Update HDF5 testing to query driver for H5FD_FEAT_DEFAULT_VFD_COMPATIBLE
flag
* Fix a few bugs related to file multi-opens
* Avoid calling MPI routines if subfiling gets reinitialized
* Fix issue when files are closed in a random order
* Update HDF5 testing to query VFD for "using MPI" feature flag
* Register atexit handler in subfiling VFD to call MPI_Finalize after HDF5
closes
* Fail for collective I/O requests until support is implemented
* Correct VOL test function prototypes
* Minor cleanup of old code and comments
* Update mercury dependency
* Cleanup of subfiling configuration structure
* Committing clang-format changes
* Build system updates for Subfiling VFD
* Fix possible hang on failure in t_vfd tests caused by mismatched
MPI_Barrier calls
* Copy subfiling IOC fapl in "fapl get" method
* Mirror subfiling superblock writes to stub file for legacy POSIX-y HDF5
applications
* Allow collective I/O for MPI_BYTE types and rank 0 bcast strategy
* Committing clang-format changes
* Use different scheme for subfiling write message MPI tag calculations
* Committing clang-format changes
* Avoid performing fstat calls on all MPI ranks
* Add MPI_Barrier before finalizing IOC threads
* Use try_lock in I/O queue dispatch to minimize contention from worker threads
* Use simple Waitall for nonblocking I/O waits
* Add configurable IOC main thread delay and try_lock option to I/O queue dispatch
* Fix bug that could cause serialization of non-overlapping I/O requests
* Temporarily treat collective subfiling vector I/O calls as independent
* Removed unused mercury bits
* Add stubs for subfiling and IOC file delete callback
* Update VFD testing for Subfiling VFD
* Work around HDF5 metadata cache bug for Subfiling VFD when MPI Comm size
= 1
* Committing clang-format changes
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
2022-07-23 04:03:12 +08:00
|
|
|
if (h5_driver_is_default_vfd_compatible(fapl, &driver_is_default_compatible) < 0)
|
|
|
|
TEST_ERROR;
|
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Property list tests */
|
|
|
|
nerrors += test_getset();
|
|
|
|
nerrors += test_getset_vl(fapl);
|
1998-10-06 05:01:10 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Copy the file access property list */
|
2020-09-30 22:27:10 +08:00
|
|
|
if ((fapl2 = H5Pcopy(fapl)) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Set the "use the latest version of the format" bounds for creating objects in the file */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (H5Pset_libver_bounds(fapl2, H5F_LIBVER_LATEST, H5F_LIBVER_LATEST) < 0)
|
2022-05-04 23:49:01 +08:00
|
|
|
TEST_ERROR;
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Loop over using new group format */
|
2023-09-06 04:11:52 +08:00
|
|
|
for (new_format = false; new_format <= true; new_format++) {
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
hid_t my_fapl;
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Set the FAPL for the type of format */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (new_format) {
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("\nTesting with new file format:");
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
my_fapl = fapl2;
|
|
|
|
} /* end if */
|
|
|
|
else {
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("Testing with old file format:");
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
my_fapl = fapl;
|
|
|
|
} /* end else */
|
|
|
|
|
|
|
|
/* Chunked storage layout tests */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_chunk) {
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
nerrors += test_create(my_fapl, FILENAME[0], H5D_CHUNKED);
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_rdwr(my_fapl, FILENAME[2], H5D_CHUNKED);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
nerrors += test_extend(my_fapl, FILENAME[4], H5D_CHUNKED);
|
2013-05-03 03:19:06 +08:00
|
|
|
nerrors += test_partalloc(my_fapl, FILENAME[8]);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
} /* end if */
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Contiguous storage layout tests */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_contig) {
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
nerrors += test_create(my_fapl, FILENAME[1], H5D_CONTIGUOUS);
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_rdwr(my_fapl, FILENAME[3], H5D_CONTIGUOUS);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
nerrors += test_extend(my_fapl, FILENAME[5], H5D_CONTIGUOUS);
|
2021-09-30 02:28:12 +08:00
|
|
|
|
Subfiling VFD (#1883)
* Added support for vector I/O calls to the VFD layer, and
associated test code. Note that this includes the optimization
to allow shortened sizes and types arrays to allow more space
efficient representations of vectors in which all entries are
of the same size and/or type. See the Selection I/o RFC for
further details.
Tested serial and parallel, debug and production on Charis.
serial and parallel debug only on Jelly.
* ran code formatter
quick serial build and test on jelly
* Add H5FD_read_selection() and H5FD_write_selection(). Currently only
translate to scalar calls. Fix const buf in H5FD_write_vector().
* Format source
* Fix comments
* Add selection I/O to chunk code, used when: not using chunk cache, no
datatype conversion, no I/O filters, no page buffer, not using collective
I/O. Requires global variable H5_use_selection_io_g be set to TRUE.
Implemented selection to vector I/O transaltion at the file driver
layer.
* Fix formatting unrelated to previous change to stop github from
complaining.
* Add full API support for selection I/O. Add tests for this.
* Implement selection I/O for contiguous datasets. Fix bug in selection
I/O translation. Add const qualifiers to some internal selection I/O
routines to maintain const-correctness while avoiding memcpys.
* Added vector read / write support to the MPIO VFD, with associated
test code (see testpar/t_vfd.c).
Note that this implementation does NOT support vector entries of
size greater than 2 GB. This must be repaired before release,
but it should be good enough for correctness testing.
As MPIO requires vector I/O requests to be sorted in increasing
address order, also added a vector sort utility in H5FDint.c This
function is tested in passing by the MPIO vector I/O extension.
In passing, repaired a bug in size / type vector extension management
in H5FD_read/write_vector()
Tested parallel debug and production on charis and Jelly.
* Ran source code formatter
* Add support for independent parallel I/O with selection I/O. Add
HDF5_USE_SELECTION_IO env var to control selection I/O (default off).
* Implement parallel collective support for selection I/O.
* Fix comments and run formatter.
* Update selection IO branch with develop (#1215)
Merged branch 'develop' into selection_io
* Sync with develop (#1262)
Updated the branch with develop changes.
* Implement big I/O support for vector I/O requests in the MPIO file
driver.
* Free arrays in H5FD__mpio_read/write_vector() as soon as they're not
needed, to cut down on memory usage during I/O.
* Address comments from code review. Fix const warnings with
H5S_SEL_ITER_INIT().
* Committing clang-format changes
* Feature/subfiling (#1464)
* Initial checkin of merged sub-filing VFD.
Passes regression tests (debug/shared/paralle) on Jelly.
However, bugs and many compiler warnings remain -- not suitable
for merge to develop.
* Minor mods to src/H5FDsubfile_mpi.c to address errors reported by autogen.sh
* Code formatting run -- no test
* Merged my subfiling code fixes into the new selection_io_branch
* Forgot to add the FindMERCURY.cmake file. This will probably disappear soon
* attempting to make a more reliable subfile file open which doesn't return errors. For some unknown reason, the regular posix open will occasionally fail to create a subfile. Some better error handling for file close has been added.
* added NULL option for H5FD_subfiling_config_t in H5Pset_fapl_subfiling (#1034)
* NULL option automatically stacks IOC VFD for subfiling and returns a valid fapl.
* added doxygen subfiling APIs
* Various fixes which allow the IOR benchmark to run correctly
* Lots of updates including the packaging up of the mercury_util source files to enable easier builds for our Benchmarking
* Interim checkin of selection_io_with_subfiling_vfd branch
Moddified testpar/t_vfd.c to test the subfiling vfd with default configuration.
Must update this code to run with a variety of configurations -- most particularly
multiple IO concentrators, and stripe depth small enough to test the other IO
concentrators.
testpar/t_vfd.c exposed a large number of race condidtions -- symtoms included:
1) Crashes (usually seg faults)
2) Heap corruption
3) Stack corruption
4) Double frees of heap space
5) Hangs
6) Out of order execution of I/O requests / violations of POSIX semantics
7) Swapped write requests
Items 1 - 4 turned out to be primarily caused by file close issues --
specifically, the main I/O concentrator thread and its pool of worker threads
were not being shut down properly on file close. Addressing this issue in
combination with some other minor fixes seems to have addressed these issues.
Items 5 & 6 appear to have been caused by issue of I/O requests to the
thread pool in an order that did not maintain POSIX semantics. A rewrite of
the I/O request dispatch code appears to have solved these issues.
Item 7 seems to have been caused by multiple write requests from a given
rank being read by the wrong worker thread. Code to issue "unique" tags for
each write request via the ACK message appears to have cleaned this up.
Note that the code is still in poor condtition. A partial list of known
defects includes:
a) Race condiditon on file close that allows superblock writes to arrive
at the I/O concentrator after it has been shutdown. This defect is
most evident when testpar/t_subfiling_vfd is run with 8 ranks.
b) No error reporting from I/O concentrators -- must design and implement
this. For now, mostly just asserts, which suggests that it should be
run in debug mode.
c) Much commented out and/or un-used code.
d) Code orgnaization
e) Build system with bits of Mercury is awkward -- think of shifting
to pthreads with our own thread pool code.
f) Need to add native support for vector and selection I/O to the subfiling
VFD.
g) Need to review, and posibly rework configuration code.
h) Need to store subfile configuration data in a superblock extension message,
and add code to use this data on file open.
i) Test code is inadequate -- expect more issues as it is extended.
In particular, there is no unit test code for the I/O request dispatch code.
While I think it is correct at present, we need test code to verify this.
Similarly, we need to test with multiple I/O concentrators and much smaller
stripe depth.
My actual code changes were limited to:
src/H5FDioc.c
src/H5FDioc_threads.c
src/H5FDsubfile_int.c
src/H5FDsubfile_mpi.c
src/H5FDsubfiling.c
src/H5FDsubfiling.h
src/H5FDsubfiling_priv.h
testpar/t_subfiling_vfd.c
testpar/t_vfd.c
I'm not sure what is going on with the deletions in src/mercury/src/util.
Tested parallel/debug on Charis and Jelly
* subfiling with selection IO (#1219)
Merged branch 'selection_io' into subfiling branch.
* Subfile name fixes (#1250)
* fixed subfiling naming convention, and added leading zero to rank names.
* Merge branch 'selection_io' into selection_io_with_subfiling_vfd (#1265)
* Added script to join subfiles into a single HDF5 file (#1350)
* Modified H5FD__subfiling_query() to report that the sub-filing VFD supports MPI
This exposed issues with truncate and get EOF in the sub-filing VFD.
I believe I have addressed these issues (get EOF not as fully tested as it should be), howeer,
it exposed race conditions resulting in hangs. As of this writing, I have not been able
to chase these down.
Note that the tests that expose these race conditions are in testpar/t_subfiling_vfd.c, and
are currently skipped. Unskip these tests to reproduce the race conditions.
tested (to the extent possible) debug/parallel on charis and jelly.
* Committing clang-format changes
* fixed H5MM_free
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Move Subfiling VFD components into H5FDsubfiling source directory
* Update Autotools build and add H5_HAVE_SUBFILING_VFD macro to H5pubconf.h
* Tidy up CMake build of subfiling sources
* Merge branch 'develop' into feature/subfiling (#1539)
Merge branch 'develop' into feature/subfiling
* Add VFD interface version field to Subfiling and IOC VFDs
* Merge branch 'develop' into feature/subfiling (#1557)
Merge branch 'develop' into feature/subfiling
* Merge branch 'develop' into feature/subfiling (#1563)
Merge branch 'develop' into feature/subfiling
* Tidy up merge artifacts after rebase on develop
* Fix incorrect variable in mirror VFD utils CMake
* Ensure VFD values are always defined
* Add subfiling to CMake VFD_LIST if built
* Mark MPI I/O driver self-initialization global as static
* Add Subfiling VFD to predefined VFDs for HDF5_DRIVER env. variable
* Initial progress towards separating private vs. public subfiling code
* include libgen.h in t_vfd tests for correct dirname/basename
* Committing clang-format changes
* removed mercury option, included subfiling header path (#1577)
Added subfiling status to configure output, installed h5fuse.sh to build directory for use in future tests.
* added check for stdatomic.h (#1578)
* added check for stdatomic.h with subfiling
* added H5_HAVE_SUBFILING_VFD for cmake
* fix old-style-definition warning (#1582)
* fix old-style-definition warning
* added test for enable parallel with subfiling VFD (#1586)
Fails if subfiling VFD is not used with parallel support.
* Subfiling/IOC VFD fixes and tidying (#1619)
* Rename CMake option for Subfiling VFD to be consistent with other VFDs
* Miscellaneous Subfiling fixes
Add error message for unset MPI communicator
Support dynamic loading of subfiling VFD with default configuration
* Temporary fix for subfile name issue
* Added subfile checks (#1634)
* added subfile checks
* Feature/subfiling (#1655)
* Subfiling/IOC VFD cleanup
Fix misuse of MPI_COMM_WORLD in IOC VFD
Propagate Subfiling FAPL MPI settings down to IOC FAPL in default
configuration case
Cleanup IOC VFD debugging code
Change sprintf to snprintf in a few places
* Major work on separating Subfiling and IOC VFDs from each other
* Re-write async_completion func to not overuse stack
* Replace usage of MPI_COMM_WORLD with file's actual MPI communicator
* Refactor H5FDsubfile_mpi.c
* Remove empty file H5FDsubfile_mpi.c
* Separate IOC VFD errors to its own error stack
* Committing clang-format changes
* Remove H5TRACE macros from H5FDioc.c
* Integrate H5FDioc_threads.c with IOC error stack
* Fix for subfile name generation
Use number of I/O concentrators from existing subfiling configuration file, if one exists
* Add temporary barrier in "Get EOF" operation to prevent races on EOF
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Fix for retrieval of machine Host ID
* Default to MPI_COMM_WORLD if no MPI params set
* added libs rt and pthreads (#1673)
* added libs rt and pthreads
* Feature/subfiling (#1689)
* More tidying of IOC VFD and subfiling debug code
* Remove old unused log file code
* Clear FID from active file map on failure
* Fix bug in generation of subfile names when truncating file
* Change subfile names to start from 1 instead of 0
* Use long long for user-specified stripe size from environment variable
* Skip 0-sized I/Os in low-level IOC I/O routines
* Don't update EOF on read
* Convert printed warning about data size mismatch to assertion
* Don't add base file address to I/O addresses twice
Base address should already be applied as part of H5FDwrite/read_vector calls
* Account for 0-sized I/O vector entries in subfile write/read functions
* Rewrite init_indep_io for clarity
* Correction for IOC wraparound calculations
* Some corrections to iovec calculations
* Remove temporary barrier on EOF retrieval
* Complete work request queue entry on error instead of skipping over
* Account for stripe size wraparound for sf_col_offset calculation
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
* Re-write and fix bugs in I/O vector filling routines (#1703)
* Rewrite I/O vector filling routines for clarity
* Fix bug with iovec_fill_last when last I/O size is 0
* added subfiling_dir line read (#1714)
* added subfiling_dir line read and use it
* shellcheck fixes
* I/O request dispatch logic update (#1731)
Short-circuit I/O request dispatch when head of I/O queue is an
in-progress get EOF or truncate operation. This prevents an issue where
a write operation can be dispatched alongside a get EOF/truncate
operation, whereas all I/O requests are supposed to be ineligible for
dispatch until the get EOF/truncate is completed
* h5fuse.sh.in clean-up (#1757)
* Added command-line options
* Committing clang-format changes
* Align with changes from develop
* Mimic MPI I/O VFD for EOF handling
* Initialize context_id field for work request objects
* Use logfile for some debugging information
* Use atomic store to set IOC ready flag
* Use separate communicator for sending file EOF data
Minor IOC cleanup
* Use H5_subfile_fid_to_context to get context ID for file in Subfiling
VFD
* IOVEC calculation fixes
* Updates for debugging code
* Minor fixes for threaded code
* Committing clang-format changes
* Use separate MPI communicator for barrier operations
* Committing clang-format changes
* Rewrite EOF routine to use nonblocking MPI communication
* Committing clang-format changes
* Always dispatch I/O work requests in IOC main loop
* Return distinct MPI communicator to library when requested
* Minor warning cleanup
* Committing clang-format changes
* Generate h5fuse.sh from h5fuse.sh.in in CMake
* Send truncate messages to correct IOC rank
* Committing clang-format changes
* Miscellaneous cleanup
Post some MPI receives before sends
Free some duplicated MPI communicator/Info objects
Remove unnecessary extra MPI_Barrier
* Warning cleanup
* Fix for leaked MPI communicator
* Retrieve file EOF on single rank and bcast it
* Fixes for a few failure paths
* Cleanup of IOC file opens
* Committing clang-format changes
* Use plan MPI_Send for send of EOF messages
* Always check MPI thread support level during Subfiling init
* Committing clang-format changes
* Handle a hang on failure when IOCs can't open subfiles
* Committing clang-format changes
* Refactor file open status consensus check
* Committing clang-format changes
* Fix for MPI_Comm_free being called after MPI_Finalize
* Fix VFD test by setting MPI params before setting subfiling on FAPL
* Update Subfiling VFD error handling and error stack usage
* Improvements for Subfiling logfiles
* Remove prototypes for currently unused routines
* Disable I/O queue stat collecting by default
* Remove unused serialization mutex variable
* Update VFD testing to take subfiling VFD into account
* Fix usage of global subfiling application layout object
* Minor fixes for failure pathways
* Keep track of the number of failures in an IOC I/O queue
* Make sure not to exceed MPI_TAG_UB value for data communication messages
* Committing clang-format changes
* Update for rename of some H5FD 'ctl' opcodes
* Always include Subfiling's public header files in hdf5.h
* Remove old unused code and comments
* Implement support for per-file I/O queues
Allows the subfiling VFD to have multiple HDF5 files open simultaneously
* Use simple MPI_Iprobe over unnecessary MPI_Improbe
* Committing clang-format changes
* Update HDF5 testing to query driver for H5FD_FEAT_DEFAULT_VFD_COMPATIBLE
flag
* Fix a few bugs related to file multi-opens
* Avoid calling MPI routines if subfiling gets reinitialized
* Fix issue when files are closed in a random order
* Update HDF5 testing to query VFD for "using MPI" feature flag
* Register atexit handler in subfiling VFD to call MPI_Finalize after HDF5
closes
* Fail for collective I/O requests until support is implemented
* Correct VOL test function prototypes
* Minor cleanup of old code and comments
* Update mercury dependency
* Cleanup of subfiling configuration structure
* Committing clang-format changes
* Build system updates for Subfiling VFD
* Fix possible hang on failure in t_vfd tests caused by mismatched
MPI_Barrier calls
* Copy subfiling IOC fapl in "fapl get" method
* Mirror subfiling superblock writes to stub file for legacy POSIX-y HDF5
applications
* Allow collective I/O for MPI_BYTE types and rank 0 bcast strategy
* Committing clang-format changes
* Use different scheme for subfiling write message MPI tag calculations
* Committing clang-format changes
* Avoid performing fstat calls on all MPI ranks
* Add MPI_Barrier before finalizing IOC threads
* Use try_lock in I/O queue dispatch to minimize contention from worker threads
* Use simple Waitall for nonblocking I/O waits
* Add configurable IOC main thread delay and try_lock option to I/O queue dispatch
* Fix bug that could cause serialization of non-overlapping I/O requests
* Temporarily treat collective subfiling vector I/O calls as independent
* Removed unused mercury bits
* Add stubs for subfiling and IOC file delete callback
* Update VFD testing for Subfiling VFD
* Work around HDF5 metadata cache bug for Subfiling VFD when MPI Comm size
= 1
* Committing clang-format changes
Co-authored-by: mainzer <mainzer#hdfgroup.org>
Co-authored-by: Neil Fortner <nfortne2@hdfgroup.org>
Co-authored-by: Scot Breitenfeld <brtnfld@hdfgroup.org>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: jrmainzer <72230804+jrmainzer@users.noreply.github.com>
Co-authored-by: Richard Warren <Richard.Warren@hdfgroup.org>
Co-authored-by: Richard.Warren <richard.warren@jelly.ad.hdfgroup.org>
2022-07-23 04:03:12 +08:00
|
|
|
if (driver_is_default_compatible) {
|
2021-09-30 02:28:12 +08:00
|
|
|
nerrors += test_compatible();
|
|
|
|
}
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
} /* end if */
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Compact dataset storage tests */
|
2020-09-30 22:27:10 +08:00
|
|
|
if (test_compact) {
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
nerrors += test_create(my_fapl, FILENAME[6], H5D_COMPACT);
|
2020-09-30 22:27:10 +08:00
|
|
|
nerrors += test_rdwr(my_fapl, FILENAME[7], H5D_COMPACT);
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
} /* end if */
|
2020-09-30 22:27:10 +08:00
|
|
|
} /* end for */
|
2006-10-11 04:36:33 +08:00
|
|
|
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
/* Close 2nd FAPL */
|
|
|
|
H5Pclose(fapl2);
|
|
|
|
|
2011-04-16 06:05:23 +08:00
|
|
|
/* Verify symbol table messages are cached */
|
|
|
|
nerrors += (h5_verify_cached_stabs(FILENAME, fapl) < 0 ? 1 : 0);
|
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (nerrors)
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
goto error;
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("All fill value tests passed.");
|
[svn-r15868] Description:
Correct a minor error in file free space allocation which was affecting
the 'multi' VFD and preventing some tests from fully working with it.
Wholesale revisitation of all the places where tests were disabled
with various VFDs and remove or correct all these so that _only_ the tests
which _really_ can't work with particular VFDs are skipped during a
'make check-vfd' test.
Tested on:
Mac OS X/32 10.5.5 (amazon) in debug mode
Mac OS X/32 10.5.5 (amazon) w/C++ & FORTRAN, w/threadsafe,
in production mode
FreeBSD/32 6.3 (duty) in debug mode
FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode
Linux/32 2.6 (kagiso) w/PGI compilers, 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 production mode
Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
2008-10-15 09:46:34 +08:00
|
|
|
|
2020-09-30 22:27:10 +08:00
|
|
|
if (h5_cleanup(FILENAME, fapl))
|
2009-01-30 02:18:39 +08:00
|
|
|
HDremove(FILE_NAME_RAW);
|
1998-10-06 05:01:10 +08:00
|
|
|
|
2023-06-29 23:18:01 +08:00
|
|
|
exit(EXIT_SUCCESS);
|
2006-08-01 03:46:16 +08:00
|
|
|
|
2006-10-11 04:36:33 +08:00
|
|
|
error:
|
2023-09-16 06:13:18 +08:00
|
|
|
puts("***** FILL VALUE TESTS FAILED *****");
|
2023-06-29 23:18:01 +08:00
|
|
|
exit(EXIT_FAILURE);
|
1998-10-06 05:01:10 +08:00
|
|
|
}
|