[Darshan-commits] [Git][darshan/darshan][dev-hdf5-mpi-issue287] properly ifdef wrap MPI logic in HDF5 module

Shane Snyder xgitlab at cels.anl.gov
Mon Oct 19 15:04:47 CDT 2020



Shane Snyder pushed to branch dev-hdf5-mpi-issue287 at darshan / darshan


Commits:
560a8324 by Shane Snyder at 2020-10-19T15:03:51-05:00
properly ifdef wrap MPI logic in HDF5 module

Fixes 287

- - - - -


1 changed file:

- darshan-runtime/lib/darshan-hdf5.c


Changes:

=====================================
darshan-runtime/lib/darshan-hdf5.c
=====================================
@@ -168,14 +168,20 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
     char* tmp;
     double tm1, tm2;
     unsigned majnum, minnum, relnum;
+    int tmp_rank = my_rank;
 
     H5get_libversion(&majnum, &minnum, &relnum);
 #ifdef DARSHAN_HDF5_VERS_1_10_PLUS
     if((majnum == 1) && (minnum < 10))
     {
-        if(my_rank < 0)
-            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
-        if(my_rank == 0)
+        if(tmp_rank < 0)
+#ifdef HAVE_MPI
+            MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+#else
+            tmp_rank = 0;
+#endif
+
+        if(tmp_rank == 0)
         {
             darshan_core_fprintf(stderr, "Darshan HDF5 module error: runtime library version (%d.%d) incompatible with Darshan module (1.10+).\n", majnum, minnum);
         }
@@ -184,9 +190,14 @@ hid_t DARSHAN_DECL(H5Fcreate)(const char *filename, unsigned flags,
 #else
     if((majnum > 1) || (minnum >= 10))
     {
-        if(my_rank < 0)
-            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
-        if(my_rank == 0)
+        if(tmp_rank < 0)
+#ifdef HAVE_MPI
+            MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+#else
+            tmp_rank = 0;
+#endif
+
+        if(tmp_rank == 0)
         {
             darshan_core_fprintf(stderr, "Darshan HDF5 module error: runtime library version (%d.%d) incompatible with Darshan module (1.10-).\n", majnum, minnum);
         }
@@ -227,14 +238,20 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
     char* tmp;
     double tm1, tm2;
     unsigned majnum, minnum, relnum;
+    int tmp_rank = my_rank;
 
     H5get_libversion(&majnum, &minnum, &relnum);
 #ifdef DARSHAN_HDF5_VERS_1_10_PLUS
     if((majnum == 1) && (minnum < 10))
     {
-        if(my_rank < 0)
-            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
-        if(my_rank == 0)
+        if(tmp_rank < 0)
+#ifdef HAVE_MPI
+            MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+#else
+            tmp_rank = 0;
+#endif
+
+        if(tmp_rank == 0)
         {
             darshan_core_fprintf(stderr, "Darshan HDF5 module error: runtime library version (%d.%d) incompatible with Darshan module (1.10+).\n", majnum, minnum);
         }
@@ -243,9 +260,14 @@ hid_t DARSHAN_DECL(H5Fopen)(const char *filename, unsigned flags,
 #else
     if((majnum > 1) || (minnum >= 10))
     {
-        if(my_rank < 0)
-            MPI_Comm_rank(MPI_COMM_WORLD, &my_rank);
-        if(my_rank == 0)
+        if(tmp_rank < 0)
+#ifdef HAVE_MPI
+            MPI_Comm_rank(MPI_COMM_WORLD, &tmp_rank);
+#else
+            tmp_rank = 0;
+#endif
+
+        if(tmp_rank == 0)
         {
             darshan_core_fprintf(stderr, "Darshan HDF5 module error: runtime library version (%d.%d) incompatible with Darshan module (1.10-).\n", majnum, minnum);
         }



View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/560a8324e698ff266d08b1847a646f40b3b2428f

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/560a8324e698ff266d08b1847a646f40b3b2428f
You're receiving this email because of your account on xgitlab.cels.anl.gov.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/darshan-commits/attachments/20201019/80257c73/attachment-0001.html>


More information about the Darshan-commits mailing list