[cig-commits] r19925 - short/3D/PyLith/benchmarks/trunk/static/performance/solvertest
brad at geodynamics.org
brad at geodynamics.org
Thu Apr 5 16:55:18 PDT 2012
Author: brad
Date: 2012-04-05 16:55:18 -0700 (Thu, 05 Apr 2012)
New Revision: 19925
Added:
short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/table_pctests.py
Modified:
short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/run_pctests.py
Log:
Create script to generate table of iterates for pctests.
Modified: short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/run_pctests.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/run_pctests.py 2012-04-05 00:39:10 UTC (rev 19924)
+++ short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/run_pctests.py 2012-04-05 23:55:18 UTC (rev 19925)
@@ -23,10 +23,18 @@
os.mkdir(d)
# ----------------------------------------------------------------------
-def runPyLith(args, logFilename):
- log = open("logs/" + logFilename, "w")
- subprocess.call("pylith " + args, stdout=log, stderr=log, shell=True)
- log.close()
+def runPyLith(args, pcname):
+ for cell in ["tet4","hex8"]:
+ for nprocs in [1,2,4]:
+ job = "%s_%s_np%03d" % (cell, pcname, nprocs)
+ jargs = args + " %s.cfg %s_np%03d.cfg --nodes=%d" % \
+ (cell, cell, nprocs, 1)
+ jargs += " --petsc.log_summary_python=logs/%s.py" % job
+ logFilename = "logs/" + job + ".log"
+ log = open(logFilename, "w")
+ print " pylith "+jargs
+ subprocess.call("pylith "+jargs, stdout=log, stderr=log, shell=True)
+ log.close()
return
# ----------------------------------------------------------------------
@@ -35,8 +43,7 @@
#
# STATUS: OK
print "ASM preconditioner"
- runPyLith("tet4.cfg asm.cfg", "tet4_asm.log")
- runPyLith("hex8.cfg asm.cfg", "hex8_asm.log")
+ runPyLith("asm.cfg", "asm")
# ----------------------------------------------------------------------
if sim == "all" or sim == "fieldsplit":
@@ -45,22 +52,19 @@
#
# STATUS: OK
print "field split, additive"
- runPyLith("tet4.cfg fieldsplit_add.cfg", "tet4_fieldsplit_add.log")
- runPyLith("hex8.cfg fieldsplit_add.cfg", "hex8_fieldsplit_add.log")
+ runPyLith("fieldsplit_add.cfg", "fieldsplit_add")
# field split, multiplicative
#
# STATUS: OK
print "field split, multiplicative"
- runPyLith("tet4.cfg fieldsplit_mult.cfg", "tet4_fieldsplit_mult.log")
- runPyLith("hex8.cfg fieldsplit_mult.cfg", "hex8_fieldsplit_mult.log")
+ runPyLith("fieldsplit_mult.cfg", "fieldsplit_mult")
# field split, multiplicative w/custom fault preconditioner
#
# STATUS: OK
print "field split, multiplicative w/custom pc"
- runPyLith("tet4.cfg fieldsplit_mult.cfg custompc.cfg", "tet4_fieldsplit_mult_custompc.log")
- runPyLith("hex8.cfg fieldsplit_mult.cfg custompc.cfg", "hex8_fieldsplit_mult_custompc.log")
+ runPyLith("fieldsplit_mult.cfg custompc.cfg", "fieldsplit_mult_custompc")
# ----------------------------------------------------------------------
if sim == "all" or sim == "schur":
@@ -70,32 +74,28 @@
# STATUS: BUG, hangs at very beginning of solve for tet4
# true residual does not decrease for hex8
print "schur, diag"
- runPyLith("tet4.cfg schur_diag.cfg", "tet4_schur_diag.log")
- runPyLith("hex8.cfg schur_diag.cfg", "hex8_schur_diag.log")
+ runPyLith("schur_diag.cfg", "schur_diag")
# Schur complement, lower
#
# STATUS: BUG, hangs at very beginning of solve for tet4
# hangs at iteration 8 for hex8
print "schur, lower"
- runPyLith("tet4.cfg schur_lower.cfg", "tet4_schur_lower.log")
- runPyLith("hex8.cfg schur_lower.cfg", "hex8_schur_lower.log")
+ runPyLith("schur_lower.cfg", "schur_lower")
# Schur complement, upper
#
# STATUS: BUG, hangs at very beginning of solve for tet4
# works for hex8
print "schur, upper"
- runPyLith("tet4.cfg schur_upper.cfg", "tet4_schur_upper.log")
- runPyLith("hex8.cfg schur_upper.cfg", "hex8_schur_upper.log")
+ runPyLith("schur_upper.cfg", "schur_upper")
# Schur complement, full
#
# STATUS: BUG, hangs at very beginning of solve for tet4
# works for hex8
print "schur, full"
- runPyLith("tet4.cfg schur_full.cfg", "tet4_schur_full.log")
- runPyLith("hex8.cfg schur_full.cfg", "hex8_schur_full.log")
+ runPyLith("schur_full.cfg", "schur_full")
# End of file
Added: short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/table_pctests.py
===================================================================
--- short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/table_pctests.py (rev 0)
+++ short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/table_pctests.py 2012-04-05 23:55:18 UTC (rev 19925)
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# ----------------------------------------------------------------------
+#
+# Brad T. Aagaard, U.S. Geological Survey
+#
+# ----------------------------------------------------------------------
+#
+# Tabulate performance of preconditioners.
+#
+# Uses subdirectory 'logs' with python log summaries.
+
+import os
+import sys
+import numpy
+
+
+style = "latex"
+if len(sys.argv) > 2:
+ raise ValueError("usage: table_pc.py [text | latex (default)]")
+if len(sys.argv) == 2:
+ style = sys.argv[1]
+
+if not style in ["text",
+ "latex",
+ ]:
+ raise ValueError("Unknown format (%s) requested." % style)
+
+
+preconditioners = [('asm', 'ASM'),
+ ('fieldsplit_add', 'FieldSplit (add)'),
+ ('fieldsplit_mult', 'FieldSplit (mult)'),
+ ('fieldsplit_mult_custompc', 'FieldSplit (mult,custom)'),
+ ]
+cells = ['Tet4',
+ 'Hex8']
+problems = [('np001','S1'),
+ ('np002','S2'),
+ ('np004','S4'),
+ ]
+
+
+# Allocate storage for stats
+niters = {}
+for pc in preconditioners:
+ niters[pc[0]] = {}
+ for c in cells:
+ niters[pc[0]][c] = numpy.zeros(len(problems), dtype=numpy.int32)
+
+# Get stats
+for pc in preconditioners:
+ for c in cells:
+ ip = 0
+ for p in problems:
+ sys.path.append("logs")
+ log = __import__("%s_%s_%s" % (c.lower(), pc[0], p[0]))
+ niters[pc[0]][c][ip] = log.Solve.event['VecMDot'].Count[0]
+ ip += 1
+
+
+if style == "text":
+ print "PC"+" "*24 + "Cell"+" "*2 + " "*6+"Iterates"
+ print " "+" "*24 + " "+" "*2 + " S1 S2 S4"
+ for pc in preconditioners:
+ line = "%-26s" % pc[1]
+ for c in cells:
+ if line is None:
+ line = " "*26
+ line += "%-6s" % c
+ ip = 0
+ for p in problems:
+ line += "%6d" % niters[pc[0]][c][ip]
+ ip += 1
+ print line
+ line = None
+
+else:
+ print "\\begin{tabular}{lcrrr}"
+ print " PC & Cell & \multicolumn[c]{3}{Iterates} \\\\"
+ print " & & S1 & S2 & S4 \\\\"
+ print " \hline"
+ for pc in preconditioners:
+ print " %s" % pc[1]
+ for c in cells:
+ line = " & " + c
+ ip = 0
+ for p in problems:
+ line += " & %d" % niters[pc[0]][c][ip]
+ ip += 1
+ print line + " \\\\"
+ line = None
+ print " \hline"
+ print "\\end{tabular}"
+
+
Property changes on: short/3D/PyLith/benchmarks/trunk/static/performance/solvertest/table_pctests.py
___________________________________________________________________
Name: svn:executable
+ *
More information about the CIG-COMMITS
mailing list