[Darshan-commits] [Git][darshan/darshan][autoperf-mod-update] APMPI python util script corrections

Sudheer Chunduri xgitlab at cels.anl.gov
Mon Feb 15 16:57:31 CST 2021



Sudheer Chunduri pushed to branch autoperf-mod-update at darshan / darshan


Commits:
a899a9b0 by Sudheer Chunduri at 2021-02-15T22:57:02+00:00
APMPI python util script corrections

- - - - -


2 changed files:

- darshan-util/pydarshan/darshan/report.py
- + darshan-util/pydarshan/examples/01_darshan-apmpi.ipynb


Changes:

=====================================
darshan-util/pydarshan/darshan/report.py
=====================================
@@ -50,8 +50,10 @@ _structdefs = {
     "PNETCDF": "struct darshan_pnetcdf_file **",
     "POSIX": "struct darshan_posix_file **",
     "STDIO": "struct darshan_stdio_file **",
-    "APXC": "struct darshan_apxc_perf_record **",
-    "APMPI": "struct darshan_apmpi_perf_record **",
+    "APXC-HEADER": "struct darshan_apxc_header_record **",
+    "APXC-PERF": "struct darshan_apxc_perf_record **",
+    "APMPI-HEADER": "struct darshan_apmpi_header_record **",
+    "APMPI-PERF": "struct darshan_apmpi_perf_record **",
 }
 
 
@@ -394,7 +396,64 @@ class DarshanReport(object):
 
         pass
 
+    def mod_read_all_apmpi_records(self, mod, dtype=None, warnings=True):
+        """ 
+        Reads all APMPI records for provided module.
 
+        Args:
+            mod (str): Identifier of module to fetch all records
+            dtype (str): 'numpy' for ndarray (default), 'dict' for python dictionary
+
+        Return:
+            None
+
+        """
+        if mod not in self.data['modules']:
+            if warnings:
+                logger.warning(f"Skipping. Log does not contain data for mod: {mod}")
+            return
+
+
+        supported =  ['APMPI'] 
+        if mod not in supported:
+            if warnings:
+                logger.warning(f" Skipping. Unsupported module: {mod} in in mod_read_all_apmpi_records(). Supported: {supported}")
+            # skip mod
+            return
+
+        print(mod+"-HEADER")
+        print(_structdefs[mod+"-HEADER"])
+        # handling options
+        dtype = dtype if dtype else self.dtype
+
+        self.records[mod] = []
+        # update module metadata
+        self.modules[mod]['num_records'] = 0
+        if mod not in self.counters:
+            self.counters[mod] = {}
+
+        # fetch header record
+        header_rec = backend.log_get_apmpi_record(self.log, _structdefs[mod+"-HEADER"])
+
+        # fetch records
+        rec = backend.log_get_apmpi_record(self.log, _structdefs[mod+"-PERF"])
+        while rec != None:
+            if dtype == 'numpy':
+                self.records[mod].append(rec)
+            else:
+                self.records[mod].append(rec)
+
+            self.data['modules'][mod]['num_records'] += 1
+
+            # fetch next
+            rec = backend.log_get_apmpi_record(self.log, _structdefs[mod+"-PERF"])
+
+
+        if self.lookup_name_records:
+            self.update_name_records()
+   
+        pass 
+ 
     def mod_read_all_dxt_records(self, mod, dtype=None, warnings=True, reads=True, writes=True):
         """
         Reads all dxt records for provided module.


=====================================
darshan-util/pydarshan/examples/01_darshan-apmpi.ipynb
=====================================
The diff for this file was not included because it is too large.


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

-- 
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/a899a9b0dddb0c35a777b627aba6deeea13eab5c
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/20210215/5e6fce9c/attachment-0001.html>


More information about the Darshan-commits mailing list