def run_pylith(appName, cfgfiles=[], dbClass=None, nprocs=1): """Helper function to generate spatial databases and run PyLith. """ # Skip running if already run. if str(appName) in dir(run_pylith): return # Generate spatial databases if necessary. if not dbClass is None: db = dbClass() db.run() # Limit number of processes to number of local CPUs or maximum specified by environment. import os if "MAX_PYLITH_PROCS" in os.environ: appNumProcs = min(int(os.environ["MAX_PYLITH_PROCS"]), nprocs) if appNumProcs < nprocs: print( "WARNING: Detected environment with MAX_PYLITH_PROCS=%d. Reducing number of processes from %d to %d." % (appNumProcs, nprocs, appNumProcs)) else: import pylith.utils.CollectVersionInfo import multiprocessing cpuCount = multiprocessing.cpu_count() mpiVersion = pylith.utils.CollectVersionInfo.CollectVersionInfo._collectVersionMPI( ) if mpiVersion["implementation"] == "OpenMPI" and mpiVersion[ "standard"].startswith("3"): cpuCount /= 2 # Assume hyperthreading is turned on and OpenMPI 3 doesn't allow oversubscribing appNumProcs = min(cpuCount, nprocs) if appNumProcs < nprocs: print( "WARNING: Detected %d CPUs. Reducing number of processes from %d to %d." % (appNumProcs, nprocs, appNumProcs)) # Run Pylith app = PyLithApp() app.nodes = appNumProcs setattr(run_pylith, str(appName), True) app.run(argv=["pylith"] + cfgfiles) return
def _run_pylith(self, filename, arguments): """Run PyLith simulation using given arguments. Args: filename (str) Path to simulation parameter file. arguments (list of str) Command line arguments. """ workdir = filename.parent cwd = os.getcwd() args = " ".join(arguments) if workdir.name: os.chdir(workdir) print(f"RUNNING {workdir} - pylith {args}...") else: print(f"RUNNING: pylith {args}...") app = PyLithApp() app.run(argv=["pylith"] + arguments) os.chdir(cwd)
def __init__(self): PyLithApp.__init__(self, name="dislocation") return
def __init__(self): PyLithApp.__init__(self, name="faultx") return
def __init__(self): PyLithApp.__init__(self, name="axialdisp") return
def __init__(self): PyLithApp.__init__(self, name="slipweakening_shear_stick") return
def __init__(self): PyLithApp.__init__(self, name="slipweakening_opening") return
def __init__(self): PyLithApp.__init__(self, name="lgdeformtraction") return
def __init__(self): PyLithApp.__init__(self, name="shearrotate") return
def __init__(self): PyLithApp.__init__(self, name="friction_shear_sliding") return
def __init__(self): PyLithApp.__init__(self, name="lgdeformrigidbody") return
def __init__(self): PyLithApp.__init__(self, name="friction_opening") return
def __init__(self): PyLithApp.__init__(self, name="compressrotate") return
def __init__(self): PyLithApp.__init__(self, name="sliponefault") return
def __init__(self): PyLithApp.__init__(self, name="rigidrotate") return
def __init__(self): PyLithApp.__init__(self, name="frictionnoslip") return
def __init__(self): PyLithApp.__init__(self, name="sheardispnoslip") return
def __init__(self): PyLithApp.__init__(self, name="slipweakening_compression") return
def __init__(self): PyLithApp.__init__(self, name="axialextension") return
def __init__(self): PyLithApp.__init__(self, name="friction_compression") return
def __init__(self): PyLithApp.__init__(self, name="sheardisp") return
def __init__(self): PyLithApp.__init__(self, name="extensionforce") return
def __init__(self): PyLithApp.__init__(self, name="faultxyn") return
def __init__(self): PyLithApp.__init__(self, name="sheardispnosliprefine") return
def __init__(self): PyLithApp.__init__(self, name="sheardispfriction") return
def __init__(self): PyLithApp.__init__(self, name="sliptwofaults") return
def test_constructor(self): app = PyLithApp()
def __init__(self): PyLithApp.__init__(self, name="faultsintersect") return
def __init__(self): PyLithApp.__init__(self, name="friction_shear_stick") return
def __init__(self): PyLithApp.__init__(self, name="faultsintersectnoslip") return
def __init__(self): PyLithApp.__init__(self, name="extensiondisp") return
def __init__(self): PyLithApp.__init__(self, name="sliptwofaults_np2") return