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