예제 #1
0
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
예제 #2
0
    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)
예제 #3
0
 def __init__(self):
   PyLithApp.__init__(self, name="dislocation")
   return
예제 #4
0
 def __init__(self):
     PyLithApp.__init__(self, name="faultx")
     return
예제 #5
0
 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
예제 #8
0
 def __init__(self):
   PyLithApp.__init__(self, name="lgdeformtraction")
   return
예제 #9
0
 def __init__(self):
   PyLithApp.__init__(self, name="slipweakening_opening")
   return
예제 #10
0
 def __init__(self):
     PyLithApp.__init__(self, name="dislocation")
     return
예제 #11
0
 def __init__(self):
     PyLithApp.__init__(self, name="shearrotate")
     return
예제 #12
0
 def __init__(self):
   PyLithApp.__init__(self, name="friction_shear_sliding")
   return
예제 #13
0
 def __init__(self):
     PyLithApp.__init__(self, name="lgdeformrigidbody")
     return
예제 #14
0
 def __init__(self):
     PyLithApp.__init__(self, name="friction_opening")
     return
예제 #15
0
 def __init__(self):
   PyLithApp.__init__(self, name="compressrotate")
   return
예제 #16
0
 def __init__(self):
   PyLithApp.__init__(self, name="sliponefault")
   return
예제 #17
0
 def __init__(self):
     PyLithApp.__init__(self, name="rigidrotate")
     return
예제 #18
0
 def __init__(self):
   PyLithApp.__init__(self, name="lgdeformrigidbody")
   return
예제 #19
0
 def __init__(self):
   PyLithApp.__init__(self, name="frictionnoslip")
   return
예제 #20
0
 def __init__(self):
   PyLithApp.__init__(self, name="sheardispnoslip")
   return
예제 #21
0
 def __init__(self):
   PyLithApp.__init__(self, name="slipweakening_compression")
   return
예제 #22
0
 def __init__(self):
   PyLithApp.__init__(self, name="axialextension")
   return
예제 #23
0
 def __init__(self):
   PyLithApp.__init__(self, name="rigidrotate")
   return
예제 #24
0
 def __init__(self):
     PyLithApp.__init__(self, name="sliponefault")
     return
예제 #25
0
 def __init__(self):
     PyLithApp.__init__(self, name="friction_compression")
     return
예제 #26
0
 def __init__(self):
   PyLithApp.__init__(self, name="slipweakening_shear_stick")
   return
예제 #27
0
 def __init__(self):
   PyLithApp.__init__(self, name="friction_compression")
   return
예제 #28
0
 def __init__(self):
     PyLithApp.__init__(self, name="sheardisp")
     return
예제 #29
0
 def __init__(self):
   PyLithApp.__init__(self, name="extensionforce")
   return
예제 #30
0
 def __init__(self):
   PyLithApp.__init__(self, name="shearrotate")
   return
예제 #31
0
 def __init__(self):
   PyLithApp.__init__(self, name="lgdeformtraction")
   return
예제 #32
0
 def __init__(self):
   PyLithApp.__init__(self, name="faultxyn")
   return
예제 #33
0
 def __init__(self):
   PyLithApp.__init__(self, name="axialdisp")
   return
예제 #34
0
 def __init__(self):
     PyLithApp.__init__(self, name="sheardispnosliprefine")
     return
예제 #35
0
 def __init__(self):
   PyLithApp.__init__(self, name="sheardispfriction")
   return
예제 #36
0
 def __init__(self):
     PyLithApp.__init__(self, name="sliptwofaults")
     return
예제 #37
0
 def test_constructor(self):
     app = PyLithApp()
예제 #38
0
 def __init__(self):
     PyLithApp.__init__(self, name="faultsintersect")
     return
예제 #39
0
 def __init__(self):
     PyLithApp.__init__(self, name="frictionnoslip")
     return
예제 #40
0
 def __init__(self):
   PyLithApp.__init__(self, name="friction_shear_stick")
   return
예제 #41
0
 def __init__(self):
   PyLithApp.__init__(self, name="friction_opening")
   return
 def __init__(self):
   PyLithApp.__init__(self, name="faultsintersectnoslip")
   return
예제 #43
0
 def __init__(self):
   PyLithApp.__init__(self, name="extensiondisp")
   return
예제 #44
0
 def __init__(self):
   PyLithApp.__init__(self, name="sliptwofaults_np2")
   return
예제 #45
0
 def __init__(self):
     PyLithApp.__init__(self, name="compressrotate")
     return