__init__.py 1.18 KB
Newer Older
Kevin Harms's avatar
Kevin Harms committed
1 2 3 4 5
"""
PyDarshan provides direct log access for reading binary Darshan logs.
PyDarshan also provides a suite of analysis utilities.
"""

6 7
__version__ = '3.3.0.2'
__darshanutil_version__ = '3.3.0'
8

9 10 11
import logging
logger = logging.getLogger(__name__)

12 13 14 15 16 17

options = {

}


18 19
#from darshan.backend.cffi_backend import *
from darshan.report import DarshanReport
20 21 22



23
def enable_experimental(verbose=False):
24 25 26 27 28 29 30
    """
    Enable experimental features such as aggregation methods for reports.

    Args:
        verbose (bool): Display log of enabled features. (Default: True)

    """
31 32 33 34 35
    import os
    import glob
    import importlib
    import darshan    

Jakob Luettgau's avatar
Jakob Luettgau committed
36 37 38 39 40 41 42 43 44 45 46
    for subdir in ['aggregators', 'operations']:
        paths = glob.glob(darshan.__path__[0] + f"/experimental/{subdir}/*.py")
        for path in paths:
            base = os.path.basename(path)
            name = os.path.splitext(base)[0]
            
            if name == "__init__":
                continue

            mod = importlib.import_module(f"darshan.experimental.{subdir}.{name}")
            setattr(DarshanReport, name, getattr(mod, name))
47
        
Jakob Luettgau's avatar
Jakob Luettgau committed
48 49
            if verbose:
                print(f"Added method {mod.__name__} to DarshanReport.")