[MOAB-dev] r4424 - MOAB/trunk/src/io

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Fri Jan 7 12:33:21 CST 2011


Author: kraftche
Date: 2011-01-07 12:33:20 -0600 (Fri, 07 Jan 2011)
New Revision: 4424

Modified:
   MOAB/trunk/src/io/ReadHDF5.cpp
Log:
verify that filesystem is GPFS before prepending bglockless: to filenames

Modified: MOAB/trunk/src/io/ReadHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/ReadHDF5.cpp	2011-01-06 21:36:08 UTC (rev 4423)
+++ MOAB/trunk/src/io/ReadHDF5.cpp	2011-01-07 18:33:20 UTC (rev 4424)
@@ -50,6 +50,12 @@
 #include <limits>
 #include <functional>
 
+#ifdef BLUEGENE
+# include <sys/vfs.h>
+  // Magic number for GPFS file system (ASCII for 'G' 'P' 'F' 'S')
+# define BG_LOCKLESS_GPFS 0x47504653
+#endif
+
 #include "IODebugTrack.hpp"
 #include "ReadHDF5Dataset.hpp"
 #include "ReadHDF5VarLen.hpp"
@@ -289,9 +295,15 @@
       // lockless file IO on IBM BlueGene
     std::string pfilename(filename);
 #ifdef BLUEGENE
-    if (0 != pfilename.find("bglockless:"))
-      pfilename = std::string("bglockless:") + pfilename;
-    dbgOut.printf( 1, "Enabling lockless IO for BlueGene (filename: \"%s\")\n", pfilename.c_str() );
+    if (0 != pfilename.find("bglockless:")) {
+        // check for GPFS file system
+      struct statfs fsdata;
+      statfs( filename, &fsdata );
+      if (fsdata.f_type == BG_LOCKLESS_GPFS) {
+        pfilename = std::string("bglockless:") + pfilename;
+        dbgOut.printf( 1, "Enabling lockless IO for BlueGene (filename: \"%s\")\n", pfilename.c_str() );
+      }
+    }
 #endif
     
 #ifndef HDF5_PARALLEL

















More information about the moab-dev mailing list