netcdf-4.3.2-HDF5-1.8.13+-compat.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. From 435d8a03ed28bb5ad63aff12cbc6ab91531b6bc8 Mon Sep 17 00:00:00 2001
  2. From: Quincey Koziol <quincey@koziol.cc>
  3. Date: Wed, 7 May 2014 08:45:15 -0500
  4. Subject: [PATCH] Account for the HDF5 library not having the MPI-POSIX VFD
  5. configured in.
  6. ---
  7. RELEASE_NOTES.md | 2 ++
  8. libsrc4/nc4file.c | 40 ++++++++++++++++++++++++++++++++++++++++
  9. nc_test4/tst_nc4perf.c | 5 +++++
  10. nc_test4/tst_parallel3.c | 5 +++++
  11. 4 files changed, 52 insertions(+)
  12. diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
  13. index 27f228c..1a69d17 100644
  14. --- a/RELEASE_NOTES.md
  15. +++ b/RELEASE_NOTES.md
  16. @@ -9,6 +9,8 @@ This file contains a high-level description of this package's evolution. Release
  17. ### 4.3.3-rc1 Released TBD
  18. +* When the NC_MPIPOSIX flag is given for parallel I/O access and the HDF5 library does not have the MPI-POSIX VFD configured in, the NC_MPIPOSIX flag is transparently aliased to the NC_MPIIO flag within the netCDF-4 library.
  19. +
  20. ## 4.3.2 Released 2014-04-23
  21. * As part of an ongoing project, the Doxygen-generated netcdf documentation has been reorganized. The goal is to make the documentation easier to parse, and to eliminate redundant material. This project is ongoing.
  22. diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
  23. index ec3bb0c..5c957be 100644
  24. --- a/libsrc4/nc4file.c
  25. +++ b/libsrc4/nc4file.c
  26. @@ -308,12 +308,21 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
  27. if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
  28. BAIL(NC_EPARINIT);
  29. }
  30. +#ifdef USE_PARALLEL_POSIX
  31. else /* MPI/POSIX */
  32. {
  33. LOG((4, "creating parallel file with MPI/posix"));
  34. if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0)
  35. BAIL(NC_EPARINIT);
  36. }
  37. +#else /* USE_PARALLEL_POSIX */
  38. + /* Should not happen! Code in NC4_create/NC4_open should alias the
  39. + * NC_MPIPOSIX flag to NC_MPIIO, if the MPI-POSIX VFD is not
  40. + * available in HDF5. -QAK
  41. + */
  42. + else /* MPI/POSIX */
  43. + BAIL(NC_EPARINIT);
  44. +#endif /* USE_PARALLEL_POSIX */
  45. /* Keep copies of the MPI Comm & Info objects */
  46. if (MPI_SUCCESS != MPI_Comm_dup(comm, &nc4_info->comm))
  47. @@ -465,6 +474,17 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
  48. )
  49. return NC_EINVAL;
  50. +#ifndef USE_PARALLEL_POSIX
  51. +/* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
  52. + * the NC_MPIPOSIX flag to NC_MPIIO. -QAK
  53. + */
  54. + if(cmode & NC_MPIPOSIX)
  55. + {
  56. + cmode &= ~NC_MPIPOSIX;
  57. + cmode |= NC_MPIIO;
  58. + }
  59. +#endif /* USE_PARALLEL_POSIX */
  60. +
  61. cmode |= NC_NETCDF4;
  62. /* Apply default create format. */
  63. @@ -2168,12 +2188,21 @@ nc4_open_file(const char *path, int mode, MPI_Comm comm,
  64. if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
  65. BAIL(NC_EPARINIT);
  66. }
  67. +#ifdef USE_PARALLEL_POSIX
  68. else /* MPI/POSIX */
  69. {
  70. LOG((4, "opening parallel file with MPI/posix"));
  71. if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0)
  72. BAIL(NC_EPARINIT);
  73. }
  74. +#else /* USE_PARALLEL_POSIX */
  75. + /* Should not happen! Code in NC4_create/NC4_open should alias the
  76. + * NC_MPIPOSIX flag to NC_MPIIO, if the MPI-POSIX VFD is not
  77. + * available in HDF5. -QAK
  78. + */
  79. + else /* MPI/POSIX */
  80. + BAIL(NC_EPARINIT);
  81. +#endif /* USE_PARALLEL_POSIX */
  82. /* Keep copies of the MPI Comm & Info objects */
  83. if (MPI_SUCCESS != MPI_Comm_dup(comm, &nc4_info->comm))
  84. @@ -2640,6 +2669,17 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
  85. (mode & NC_MPIIO && mode & NC_MPIPOSIX))
  86. return NC_EINVAL;
  87. +#ifndef USE_PARALLEL_POSIX
  88. +/* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
  89. + * the NC_MPIPOSIX flag to NC_MPIIO. -QAK
  90. + */
  91. + if(mode & NC_MPIPOSIX)
  92. + {
  93. + mode &= ~NC_MPIPOSIX;
  94. + mode |= NC_MPIIO;
  95. + }
  96. +#endif /* USE_PARALLEL_POSIX */
  97. +
  98. /* Depending on the type of file, open it. */
  99. diff --git a/nc_test4/tst_nc4perf.c b/nc_test4/tst_nc4perf.c
  100. index 47af70e..3528b82 100644
  101. --- a/nc_test4/tst_nc4perf.c
  102. +++ b/nc_test4/tst_nc4perf.c
  103. @@ -244,6 +244,11 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
  104. return 0;
  105. }
  106. +/* Note: When the MPI-POSIX VFD is not compiled in to HDF5, the NC_MPIPOSIX
  107. + * flag will be aliased to the NC_MPIIO flag within the library, and
  108. + * therefore this test will exercise the aliasing, with the MPI-IO VFD,
  109. + * under that configuration. -QAK
  110. + */
  111. #define NUM_MODES 2
  112. #define NUM_FACC 2
  113. #define NUM_CHUNK_COMBOS_2D 3
  114. diff --git a/nc_test4/tst_parallel3.c b/nc_test4/tst_parallel3.c
  115. index 27f9c98..9fa534f 100644
  116. --- a/nc_test4/tst_parallel3.c
  117. +++ b/nc_test4/tst_parallel3.c
  118. @@ -129,6 +129,11 @@ int main(int argc, char **argv)
  119. if (mpi_rank == 0)
  120. SUMMARIZE_ERR;
  121. +/* Note: When the MPI-POSIX VFD is not compiled in to HDF5, the NC_MPIPOSIX
  122. + * flag will be aliased to the NC_MPIIO flag within the library, and
  123. + * therefore this test will exercise the aliasing, with the MPI-IO VFD,
  124. + * under that configuration. -QAK
  125. + */
  126. if (mpi_rank == 0)
  127. printf("*** Testing parallel IO for raw-data with MPIPOSIX-IO (driver)...");
  128. facc_type = NC_NETCDF4|NC_MPIPOSIX;
  129. --
  130. 2.0.3