[Darshan-commits] [Git][darshan/darshan][autoperf-mod-update] Add pydarshan support for external modules
Kevin Harms
xgitlab at cels.anl.gov
Mon Feb 1 22:37:08 CST 2021
Kevin Harms pushed to branch autoperf-mod-update at darshan / darshan
Commits:
a7fa9a2f by Kevin Harms at 2021-02-02T04:36:59+00:00
Add pydarshan support for external modules
- - - - -
3 changed files:
- darshan-util/pydarshan/darshan/api_def_c.py
- darshan-util/pydarshan/darshan/backend/cffi_backend.py
- darshan-util/pydarshan/setup.py
Changes:
=====================================
darshan-util/pydarshan/darshan/api_def_c.py
=====================================
@@ -118,14 +118,6 @@ typedef struct segment_info {
double end_time;
} segment_info;
-struct darshan_apmpi_perf_record
-{
- struct darshan_base_record base_rec;
- uint64_t counters[24];
- double fcounters[3];
-};
-
-
/* counter names */
extern char *bgq_counter_names[];
extern char *bgq_f_counter_names[];
@@ -142,8 +134,6 @@ extern char *posix_counter_names[];
extern char *posix_f_counter_names[];
extern char *stdio_counter_names[];
extern char *stdio_f_counter_names[];
-extern char *apmpi_counter_names[];
-extern char *apmpi_f_counter_names[];
/* Supported Functions */
void* darshan_log_open(char *);
@@ -164,10 +154,10 @@ void darshan_log_get_filtered_name_records(void*, struct darshan_name_record **,
-def load_darshan_header():
+def load_darshan_header(addins=''):
"""
Returns a CFFI compatible header for darshan-utlil as a string.
:return: String with a CFFI compatible header for darshan-util.
"""
- return header
+ return header + addins
=====================================
darshan-util/pydarshan/darshan/backend/cffi_backend.py
=====================================
@@ -14,7 +14,18 @@ from darshan.api_def_c import load_darshan_header
from darshan.discover_darshan import find_utils
from darshan.discover_darshan import check_version
-API_def_c = load_darshan_header()
+addins = ""
+
+#
+# Optional APMPI module
+#
+try:
+ from darshan.backend.apmpi import *
+ addins += get_apmpi_defs()
+except:
+ pass
+
+API_def_c = load_darshan_header(addins)
ffi = cffi.FFI()
@@ -351,7 +362,7 @@ def log_get_generic_record(log, mod_name, mod_type, dtype='numpy'):
return rec
-def counter_names(mod_name, fcnts=False):
+def counter_names(mod_name, fcnts=False, special=''):
"""
Returns a list of available counter names for the module.
By default only integer counter names are listed, unless fcnts is set to
@@ -377,8 +388,8 @@ def counter_names(mod_name, fcnts=False):
else:
F = ""
- end = "{0}_{1}NUM_INDICES".format(mod_name.upper(), F.upper())
- var_name = "{0}_{1}counter_names".format(mod_name.lower(), F.lower())
+ end = "{0}_{1}{2}NUM_INDICES".format(mod_name.upper(), F.upper(), special.upper())
+ var_name = "{0}_{1}{2}counter_names".format(mod_name.lower(), F.lower(), special.lower())
while True:
try:
=====================================
darshan-util/pydarshan/setup.py
=====================================
@@ -3,6 +3,7 @@
from setuptools import setup, find_packages, Extension
import sys
+import os
with open('README.rst') as readme_file:
@@ -26,6 +27,16 @@ if '--with-extension' in sys.argv:
))
sys.argv.remove('--with-extension')
+#
+# Find backend python files in modules and copy them into lib
+#
+for root, dirs, files in os.walk("../../modules"):
+ for f in files:
+ if f.endswith("-backend.py"):
+ fname = f.replace("-backend", "")
+ os.symlink("../../" + os.path.join(root, f), f"darshan/backend/{fname}")
+ print("Adding {0} to backends.".format(os.path.join(root,f)))
+
setup(
author='',
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/a7fa9a2fe99f771436f11da0238bd9a2e3bc1584
--
View it on GitLab: https://xgitlab.cels.anl.gov/darshan/darshan/-/commit/a7fa9a2fe99f771436f11da0238bd9a2e3bc1584
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/20210201/9433ee61/attachment-0001.html>
More information about the Darshan-commits
mailing list