Orion Poplawski f619cae
commit 435d8a03ed28bb5ad63aff12cbc6ab91531b6bc8
Orion Poplawski f619cae
Author: Quincey Koziol <quincey@koziol.cc>
Orion Poplawski f619cae
Date:   Wed May 7 08:45:15 2014 -0500
Orion Poplawski f619cae
Orion Poplawski f619cae
    Account for the HDF5 library not having the MPI-POSIX VFD configured in.
Orion Poplawski f619cae
Orion Poplawski f619cae
diff --git a/libsrc4/nc4file.c b/libsrc4/nc4file.c
Orion Poplawski f619cae
index ec3bb0c..5c957be 100644
Orion Poplawski f619cae
--- a/libsrc4/nc4file.c
Orion Poplawski f619cae
+++ b/libsrc4/nc4file.c
Orion Poplawski f619cae
@@ -308,12 +308,21 @@ nc4_create_file(const char *path, int cmode, MPI_Comm comm, MPI_Info info,
Orion Poplawski f619cae
 	 if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
Orion Poplawski f619cae
 	    BAIL(NC_EPARINIT);
Orion Poplawski f619cae
       }
Orion Poplawski f619cae
+#ifdef USE_PARALLEL_POSIX
Orion Poplawski f619cae
       else /* MPI/POSIX */
Orion Poplawski f619cae
       {
Orion Poplawski f619cae
 	 LOG((4, "creating parallel file with MPI/posix"));
Orion Poplawski f619cae
 	 if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0)
Orion Poplawski f619cae
 	    BAIL(NC_EPARINIT);
Orion Poplawski f619cae
       }
Orion Poplawski f619cae
+#else /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
+      /* Should not happen! Code in NC4_create/NC4_open should alias the
Orion Poplawski f619cae
+       *        NC_MPIPOSIX flag to NC_MPIIO, if the MPI-POSIX VFD is not
Orion Poplawski f619cae
+       *        available in HDF5. -QAK
Orion Poplawski f619cae
+       */
Orion Poplawski f619cae
+      else /* MPI/POSIX */
Orion Poplawski f619cae
+         BAIL(NC_EPARINIT);
Orion Poplawski f619cae
+#endif /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
 
Orion Poplawski f619cae
       /* Keep copies of the MPI Comm & Info objects */
Orion Poplawski f619cae
       if (MPI_SUCCESS != MPI_Comm_dup(comm, &nc4_info->comm))
Orion Poplawski f619cae
@@ -465,6 +474,17 @@ NC4_create(const char* path, int cmode, size_t initialsz, int basepe,
Orion Poplawski f619cae
       )
Orion Poplawski f619cae
       return NC_EINVAL;
Orion Poplawski f619cae
 
Orion Poplawski f619cae
+#ifndef USE_PARALLEL_POSIX
Orion Poplawski f619cae
+/* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
Orion Poplawski f619cae
+ *      the NC_MPIPOSIX flag to NC_MPIIO. -QAK
Orion Poplawski f619cae
+ */
Orion Poplawski f619cae
+   if(cmode & NC_MPIPOSIX)
Orion Poplawski f619cae
+   {
Orion Poplawski f619cae
+      cmode &= ~NC_MPIPOSIX;
Orion Poplawski f619cae
+      cmode |= NC_MPIIO;
Orion Poplawski f619cae
+   }
Orion Poplawski f619cae
+#endif /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
+
Orion Poplawski f619cae
    cmode |= NC_NETCDF4;
Orion Poplawski f619cae
 
Orion Poplawski f619cae
    /* Apply default create format. */
Orion Poplawski f619cae
@@ -2168,12 +2188,21 @@ nc4_open_file(const char *path, int mode, MPI_Comm comm,
Orion Poplawski f619cae
 	 if (H5Pset_fapl_mpio(fapl_id, comm, info) < 0)
Orion Poplawski f619cae
 	    BAIL(NC_EPARINIT);
Orion Poplawski f619cae
       }
Orion Poplawski f619cae
+#ifdef USE_PARALLEL_POSIX
Orion Poplawski f619cae
       else /* MPI/POSIX */
Orion Poplawski f619cae
       {
Orion Poplawski f619cae
 	 LOG((4, "opening parallel file with MPI/posix"));
Orion Poplawski f619cae
 	 if (H5Pset_fapl_mpiposix(fapl_id, comm, 0) < 0)
Orion Poplawski f619cae
 	    BAIL(NC_EPARINIT);
Orion Poplawski f619cae
       }
Orion Poplawski f619cae
+#else /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
+      /* Should not happen! Code in NC4_create/NC4_open should alias the
Orion Poplawski f619cae
+       *        NC_MPIPOSIX flag to NC_MPIIO, if the MPI-POSIX VFD is not
Orion Poplawski f619cae
+       *        available in HDF5. -QAK
Orion Poplawski f619cae
+       */
Orion Poplawski f619cae
+      else /* MPI/POSIX */
Orion Poplawski f619cae
+         BAIL(NC_EPARINIT);
Orion Poplawski f619cae
+#endif /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
 
Orion Poplawski f619cae
       /* Keep copies of the MPI Comm & Info objects */
Orion Poplawski f619cae
       if (MPI_SUCCESS != MPI_Comm_dup(comm, &nc4_info->comm))
Orion Poplawski f619cae
@@ -2640,6 +2669,17 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp,
Orion Poplawski f619cae
        (mode & NC_MPIIO && mode & NC_MPIPOSIX))
Orion Poplawski f619cae
       return NC_EINVAL;
Orion Poplawski f619cae
 
Orion Poplawski f619cae
+#ifndef USE_PARALLEL_POSIX
Orion Poplawski f619cae
+/* If the HDF5 library has been compiled without the MPI-POSIX VFD, alias
Orion Poplawski f619cae
+ *      the NC_MPIPOSIX flag to NC_MPIIO. -QAK
Orion Poplawski f619cae
+ */
Orion Poplawski f619cae
+   if(mode & NC_MPIPOSIX)
Orion Poplawski f619cae
+   {
Orion Poplawski f619cae
+      mode &= ~NC_MPIPOSIX;
Orion Poplawski f619cae
+      mode |= NC_MPIIO;
Orion Poplawski f619cae
+   }
Orion Poplawski f619cae
+#endif /* USE_PARALLEL_POSIX */
Orion Poplawski f619cae
+
Orion Poplawski f619cae
 
Orion Poplawski f619cae
    /* Depending on the type of file, open it. */
Orion Poplawski f619cae
 
Orion Poplawski f619cae
diff --git a/nc_test4/tst_nc4perf.c b/nc_test4/tst_nc4perf.c
Orion Poplawski f619cae
index 47af70e..3528b82 100644
Orion Poplawski f619cae
--- a/nc_test4/tst_nc4perf.c
Orion Poplawski f619cae
+++ b/nc_test4/tst_nc4perf.c
Orion Poplawski f619cae
@@ -244,6 +244,11 @@ int test_pio_4d(size_t cache_size, int facc_type, int access_flag, MPI_Comm comm
Orion Poplawski f619cae
    return 0;
Orion Poplawski f619cae
 }
Orion Poplawski f619cae
 
Orion Poplawski f619cae
+/* Note: When the MPI-POSIX VFD is not compiled in to HDF5, the NC_MPIPOSIX
Orion Poplawski f619cae
+ *      flag will be aliased to the NC_MPIIO flag within the library, and
Orion Poplawski f619cae
+ *      therefore this test will exercise the aliasing, with the MPI-IO VFD,
Orion Poplawski f619cae
+ *      under that configuration. -QAK
Orion Poplawski f619cae
+ */
Orion Poplawski f619cae
 #define NUM_MODES 2
Orion Poplawski f619cae
 #define NUM_FACC 2
Orion Poplawski f619cae
 #define NUM_CHUNK_COMBOS_2D 3
Orion Poplawski f619cae
diff --git a/nc_test4/tst_parallel3.c b/nc_test4/tst_parallel3.c
Orion Poplawski f619cae
index 27f9c98..9fa534f 100644
Orion Poplawski f619cae
--- a/nc_test4/tst_parallel3.c
Orion Poplawski f619cae
+++ b/nc_test4/tst_parallel3.c
Orion Poplawski f619cae
@@ -129,6 +129,11 @@ int main(int argc, char **argv)
Orion Poplawski f619cae
    if (mpi_rank == 0)
Orion Poplawski f619cae
       SUMMARIZE_ERR;
Orion Poplawski f619cae
 
Orion Poplawski f619cae
+/* Note: When the MPI-POSIX VFD is not compiled in to HDF5, the NC_MPIPOSIX
Orion Poplawski f619cae
+ *      flag will be aliased to the NC_MPIIO flag within the library, and
Orion Poplawski f619cae
+ *      therefore this test will exercise the aliasing, with the MPI-IO VFD,
Orion Poplawski f619cae
+ *      under that configuration. -QAK
Orion Poplawski f619cae
+ */
Orion Poplawski f619cae
    if (mpi_rank == 0)
Orion Poplawski f619cae
       printf("*** Testing parallel IO for raw-data with MPIPOSIX-IO (driver)...");
Orion Poplawski f619cae
    facc_type = NC_NETCDF4|NC_MPIPOSIX;