8
8
#include < H5public.h>
9
9
#include < std_compat/utility.h>
10
10
11
- #if H5_HAVE_PARALLEL
11
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
12
12
#include < H5FDmpi.h>
13
13
#endif
14
14
@@ -159,7 +159,7 @@ struct hdf5_io: public libpressio_io_plugin {
159
159
virtual struct pressio_data * read_impl (struct pressio_data * buffer) override {
160
160
cleanup cleanup_facl;
161
161
hid_t fapl_plist = H5P_DEFAULT;
162
- #if H5_HAVE_PARALLEL
162
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
163
163
if (use_parallel) {
164
164
fapl_plist = H5Pcreate (H5P_FILE_ACCESS);
165
165
MPI_Info info = MPI_INFO_NULL;
@@ -254,7 +254,7 @@ struct hdf5_io: public libpressio_io_plugin {
254
254
255
255
hid_t dxpl_plist = H5P_DEFAULT;
256
256
cleanup dxpl_cleanup;
257
- #if H5_HAVE_PARALLEL
257
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
258
258
if (use_parallel) {
259
259
hid_t dxpl_plist = H5Pcreate (H5P_DATASET_XFER);
260
260
dxpl_cleanup = make_cleanup ([&]{ H5Pclose (dxpl_plist);});
@@ -280,7 +280,7 @@ struct hdf5_io: public libpressio_io_plugin {
280
280
int perms_ok = access (filename.c_str (), W_OK);
281
281
cleanup cleanup_facl;
282
282
hid_t fapl_plist = H5P_DEFAULT;
283
- #if H5_HAVE_PARALLEL
283
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
284
284
if (use_parallel) {
285
285
fapl_plist = H5Pcreate (H5P_FILE_ACCESS);
286
286
MPI_Info info = MPI_INFO_NULL;
@@ -378,7 +378,7 @@ struct hdf5_io: public libpressio_io_plugin {
378
378
379
379
hid_t dxpl_plist = H5P_DEFAULT;
380
380
cleanup dxpl_cleanup;
381
- #if H5_HAVE_PARALLEL
381
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
382
382
if (use_parallel) {
383
383
hid_t dxpl_plist = H5Pcreate (H5P_DATASET_XFER);
384
384
dxpl_cleanup = make_cleanup ([&]{ H5Pclose (dxpl_plist);});
@@ -400,7 +400,13 @@ struct hdf5_io: public libpressio_io_plugin {
400
400
virtual struct pressio_options get_configuration_impl () const override {
401
401
pressio_options options;
402
402
set (options, " pressio:thread_safe" , static_cast <int32_t >(pressio_thread_safety_single));
403
- set (options, " hdf5:parallel" , static_cast <int32_t >(H5_HAVE_PARALLEL));
403
+ set (options, " hdf5:parallel" , static_cast <int32_t >(
404
+ #ifdef H5_HAVE_PARALLEL
405
+ H5_HAVE_PARALLEL
406
+ #else
407
+ 0
408
+ #endif
409
+ ));
404
410
return options;
405
411
}
406
412
@@ -428,7 +434,7 @@ struct hdf5_io: public libpressio_io_plugin {
428
434
auto file_extent_t = tmp.to_vector <uint64_t >();
429
435
file_extent.assign (std::begin (file_extent_t ), std::end (file_extent_t ));
430
436
}
431
- #if H5_HAVE_PARALLEL
437
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
432
438
get (options, " hdf5:use_parallel" , &use_parallel);
433
439
get (options, " hdf5:mpi_comm" , (void **)(&comm));
434
440
#endif
@@ -447,7 +453,7 @@ struct hdf5_io: public libpressio_io_plugin {
447
453
set (opts, " hdf5:file_stride" , to_uint64v (file_stride));
448
454
set (opts, " hdf5:file_start" , to_uint64v (file_stride));
449
455
set (opts, " hdf5:file_extent" , to_uint64v (file_extent));
450
- #if H5_HAVE_PARALLEL
456
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
451
457
set (opts, " hdf5:use_parallel" , use_parallel);
452
458
set (opts, " hdf5:mpi_comm" , (void *)(comm));
453
459
#endif
@@ -524,7 +530,7 @@ struct hdf5_io: public libpressio_io_plugin {
524
530
std::string filename;
525
531
std::string dataset_name;
526
532
std::vector<hsize_t > file_block, file_start, file_count, file_stride, file_extent;
527
- #if H5_HAVE_PARALLEL
533
+ #if defined(H5_HAVE_PARALLEL) && H5_HAVE_PARALLEL
528
534
int use_parallel = false ;
529
535
MPI_Comm comm = MPI_COMM_WORLD;
530
536
#endif
0 commit comments