summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2022-02-28 05:15:38 (GMT)
committerGitHub <noreply@github.com>2022-02-28 05:15:38 (GMT)
commit80954e82723086e573af37b31e85d0f3d562e9b3 (patch)
tree731b147adf47b8b43fe8813ba783215d461e0c4a
parentf46e5db184b22a2a53cf901f23c7561e596f39ca (diff)
downloadhdf5-80954e82723086e573af37b31e85d0f3d562e9b3.zip
hdf5-80954e82723086e573af37b31e85d0f3d562e9b3.tar.gz
hdf5-80954e82723086e573af37b31e85d0f3d562e9b3.tar.bz2
Fix for parallel compression examples on Windows (#1459)
-rw-r--r--examples/ph5_filtered_writes.c30
-rw-r--r--examples/ph5_filtered_writes_no_sel.c4
2 files changed, 23 insertions, 11 deletions
diff --git a/examples/ph5_filtered_writes.c b/examples/ph5_filtered_writes.c
index 8b55528..0f399dd 100644
--- a/examples/ph5_filtered_writes.c
+++ b/examples/ph5_filtered_writes.c
@@ -43,6 +43,10 @@
#define HDF5_DATATYPE H5T_NATIVE_INT
typedef int C_DATATYPE;
+#ifndef PATH_MAX
+#define PATH_MAX 512
+#endif
+
/* Global variables */
int mpi_rank, mpi_size;
@@ -234,16 +238,16 @@ write_dataset_no_overlap(hid_t file_id, hid_t dxpl_id)
static void
write_dataset_overlap(hid_t file_id, hid_t dxpl_id)
{
- C_DATATYPE data[mpi_size][EXAMPLE_DSET_CHUNK_DIM_SIZE];
- hsize_t dataset_dims[EXAMPLE_DSET_DIMS];
- hsize_t chunk_dims[EXAMPLE_DSET_DIMS];
- hsize_t start[EXAMPLE_DSET_DIMS];
- hsize_t stride[EXAMPLE_DSET_DIMS];
- hsize_t count[EXAMPLE_DSET_DIMS];
- size_t i, j;
- hid_t dset_id = H5I_INVALID_HID;
- hid_t dcpl_id = H5I_INVALID_HID;
- hid_t file_dataspace = H5I_INVALID_HID;
+ C_DATATYPE *data = NULL;
+ hsize_t dataset_dims[EXAMPLE_DSET_DIMS];
+ hsize_t chunk_dims[EXAMPLE_DSET_DIMS];
+ hsize_t start[EXAMPLE_DSET_DIMS];
+ hsize_t stride[EXAMPLE_DSET_DIMS];
+ hsize_t count[EXAMPLE_DSET_DIMS];
+ size_t i, j;
+ hid_t dset_id = H5I_INVALID_HID;
+ hid_t dcpl_id = H5I_INVALID_HID;
+ hid_t file_dataspace = H5I_INVALID_HID;
/*
* ------------------------------------
@@ -324,7 +328,9 @@ write_dataset_overlap(hid_t file_id, hid_t dxpl_id)
* --------------------------------------
*/
- fill_databuf(start, count, stride, &data[0][0]);
+ data = malloc(mpi_size * EXAMPLE_DSET_CHUNK_DIM_SIZE * sizeof(C_DATATYPE));
+
+ fill_databuf(start, count, stride, data);
/*
* ---------------------------------
@@ -334,6 +340,8 @@ write_dataset_overlap(hid_t file_id, hid_t dxpl_id)
H5Dwrite(dset_id, HDF5_DATATYPE, H5S_BLOCK, file_dataspace, dxpl_id, data);
+ free(data);
+
/*
* --------------
* Close HDF5 IDs
diff --git a/examples/ph5_filtered_writes_no_sel.c b/examples/ph5_filtered_writes_no_sel.c
index 14c68c8..2e29838 100644
--- a/examples/ph5_filtered_writes_no_sel.c
+++ b/examples/ph5_filtered_writes_no_sel.c
@@ -43,6 +43,10 @@
#define HDF5_DATATYPE H5T_NATIVE_INT
typedef int C_DATATYPE;
+#ifndef PATH_MAX
+#define PATH_MAX 512
+#endif
+
/* Global variables */
int mpi_rank, mpi_size;