Fix for parallel compression examples on Windows (#1459)

This commit is contained in:
jhendersonHDF 2022-02-27 23:15:38 -06:00 committed by GitHub
parent f46e5db184
commit 80954e8272
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 11 deletions

View File

@ -43,6 +43,10 @@
#define HDF5_DATATYPE H5T_NATIVE_INT #define HDF5_DATATYPE H5T_NATIVE_INT
typedef int C_DATATYPE; typedef int C_DATATYPE;
#ifndef PATH_MAX
#define PATH_MAX 512
#endif
/* Global variables */ /* Global variables */
int mpi_rank, mpi_size; int mpi_rank, mpi_size;
@ -234,16 +238,16 @@ write_dataset_no_overlap(hid_t file_id, hid_t dxpl_id)
static void static void
write_dataset_overlap(hid_t file_id, hid_t dxpl_id) write_dataset_overlap(hid_t file_id, hid_t dxpl_id)
{ {
C_DATATYPE data[mpi_size][EXAMPLE_DSET_CHUNK_DIM_SIZE]; C_DATATYPE *data = NULL;
hsize_t dataset_dims[EXAMPLE_DSET_DIMS]; hsize_t dataset_dims[EXAMPLE_DSET_DIMS];
hsize_t chunk_dims[EXAMPLE_DSET_DIMS]; hsize_t chunk_dims[EXAMPLE_DSET_DIMS];
hsize_t start[EXAMPLE_DSET_DIMS]; hsize_t start[EXAMPLE_DSET_DIMS];
hsize_t stride[EXAMPLE_DSET_DIMS]; hsize_t stride[EXAMPLE_DSET_DIMS];
hsize_t count[EXAMPLE_DSET_DIMS]; hsize_t count[EXAMPLE_DSET_DIMS];
size_t i, j; size_t i, j;
hid_t dset_id = H5I_INVALID_HID; hid_t dset_id = H5I_INVALID_HID;
hid_t dcpl_id = H5I_INVALID_HID; hid_t dcpl_id = H5I_INVALID_HID;
hid_t file_dataspace = 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); H5Dwrite(dset_id, HDF5_DATATYPE, H5S_BLOCK, file_dataspace, dxpl_id, data);
free(data);
/* /*
* -------------- * --------------
* Close HDF5 IDs * Close HDF5 IDs

View File

@ -43,6 +43,10 @@
#define HDF5_DATATYPE H5T_NATIVE_INT #define HDF5_DATATYPE H5T_NATIVE_INT
typedef int C_DATATYPE; typedef int C_DATATYPE;
#ifndef PATH_MAX
#define PATH_MAX 512
#endif
/* Global variables */ /* Global variables */
int mpi_rank, mpi_size; int mpi_rank, mpi_size;