Exemplo n.º 1
0
 def setUp(self):
     self.basedir = os.path.realpath(tempfile.mkdtemp())
     self.mRun1 = ModelRun("testRun1",["Input1.xml"],"./output/tr1")
     self.yRange = [-16000, -10000, -3000]
     self.zRange = [10000, 11000]
     self.procRange = [1, 2, 4, 8]
     self.stgI1 = StgXMLVariant("minY", self.yRange)
     self.stgI2 = StgXMLVariant("maxZ", self.zRange)
     self.jobI1 = JobParamVariant("nproc", self.procRange)
     self.varDict = {"Y":self.stgI1, "Z":self.stgI2}
Exemplo n.º 2
0
#! /usr/bin/env python
import os, copy
import csv
from credo.modelrun import ModelRun, SimParams
from credo.modelsuite import ModelSuite
import credo.jobrunner

jobRunner = credo.jobrunner.defaultRunner()

outPathBase = os.path.join('output', 'PPC_Compare')
if not os.path.exists(outPathBase):
    os.makedirs(outPathBase)

defParams = SimParams(nsteps=2)
stdRun = ModelRun("Arrhenius-normal",
                  os.path.join('..', '..', 'Underworld', 'InputFiles',
                               'Arrhenius.xml'),
                  simParams=defParams)
ppcRun = ModelRun("Arrhenius-ppc",
                  "Arrhenius.xml",
                  basePath=os.path.join("Ppc_Testing", "udw_inputfiles"),
                  simParams=defParams)

stdSuite = ModelSuite(os.path.join(outPathBase, "arrBasic"))
ppcSuite = ModelSuite(os.path.join(os.getcwd(), outPathBase, "arrPIC"))

for ii in range(10):
    stdRun.outputPath = os.path.join(stdSuite.outputPathBase, "%.5d" % ii)
    ppcRun.outputPath = os.path.join(ppcSuite.outputPathBase, "%.5d" % ii)
    stdSuite.addRun(copy.deepcopy(stdRun))
    ppcSuite.addRun(copy.deepcopy(ppcRun))
Exemplo n.º 3
0
opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])

#For now just copy all args as input files
inputFiles = args
modelName, ext = os.path.splitext(args[0])
nproc = 1

# For a restart test, these are standard fields to be tested.
modelName += "-restartTest"
outputPath = 'output' + os.sep + modelName
standardFields = ['VelocityField', 'PressureField']
runSteps = 20
assert runSteps % 2 == 0

print "Initial run:"
mRun = ModelRun(modelName + "-initial", inputFiles, outputPath, nproc=nproc)
initialOutputPath = outputPath + os.sep + "initial"
mRun.outputPath = initialOutputPath
mRun.simParams = SimParams(nsteps=runSteps, cpevery=runSteps / 2, dumpevery=0)
mRun.cpFields = standardFields

mRun.writeInfoXML()
credo.prepareOutputLogDirs(mRun.outputPath, mRun.logPath)
# This will run the model, and also save basic results (e.g. walltime)
analysisXML = mRun.analysisXMLGen()
results = credo.modelrun.runModel(mRun)
credo.modelresult.writeModelResultsXML(results, path=mRun.outputPath)

print "Restart run:"
mRun.name = modelName + "-restart"
mRun.outputPath = outputPath + os.sep + "restart"
Exemplo n.º 4
0
# This is where we create the key data structure, the mRun.
# It will be a key data structure storing info about the directories
# used, timestep, fields checkpointed, and be used in APIs to access info.

opts, args = getopt.getopt(sys.argv[1:], "h", ["help"])

#For now just copy all args as input files
inputFiles = args
modelName, ext = os.path.splitext(args[0])
modelName += "-referenceTest"
# Do the following live on an options struct?
outputPath = 'output' + os.sep + modelName
expectedPath = 'expected' + os.sep + modelName
nproc = 1

mRun = ModelRun(modelName, inputFiles, outputPath, nproc=nproc)

# TODO: responsibility of SystemTest class?
createReference = False
# For a reference test, these are standard fields to be tested.
standardFields = ['VelocityField', 'PressureField']
runSteps = 10

if createReference:
    mRun.outputPath = expectedPath
    mRun.simParams = SimParams(nsteps=runSteps, cpevery=runSteps, dumpevery=0)
    mRun.cpFields = standardFields
else:
    mRun.simParams = SimParams(nsteps=runSteps, cpevery=0, dumpevery=0)
    fTests = mRun.analysis['fieldTests']
    fTests.testTimestep = runSteps