def test_generateRuns_product(self): mSuite = ModelSuite(os.path.join("output","genSuiteTest"), templateMRun = self.mRun1) #TODO: since currently mVariants implemented as a dict, the order # these are added doesn't currently matter. mSuite.addVariant("depthVary", self.stgI1) mSuite.addVariant("ZVary", self.stgI2) mSuite.addVariant("scaleTests", self.jobI1) mSuite.generateRuns(msuite.product) self.assertEqual(len(mSuite.runs), len(self.yRange) * len(self.zRange) * len(self.procRange)) # These are indices into lists above, created manually for testing # TODO: below is an experimentally-determined order - bad! expIndices = list(msuite.product( range(len(self.procRange)), range(len(self.yRange)), range(len(self.zRange)) )) for ii, expIndexTuple in enumerate(expIndices): pIndex, yIndex, zIndex = expIndexTuple self.assertEqual(mSuite.runs[ii].paramOverrides['minY'], self.yRange[yIndex]) self.assertEqual(mSuite.runs[ii].paramOverrides['maxZ'], self.zRange[zIndex]) self.assertEqual(mSuite.runs[ii].jobParams['nproc'], self.procRange[pIndex]) self.assertEqual(mSuite.runs[ii].outputPath, os.path.join("output", "genSuiteTest", mSuite.subOutputPathGenFunc(mSuite.runs[ii], mSuite.modelVariants, expIndexTuple, ii))) # Now test regenerating produces correct length again mSuite.generateRuns() self.assertEqual(len(mSuite.runs), len(self.yRange) * len(self.zRange) * len(self.procRange))
def test_generateRuns_customSubdirs(self): mSuite = ModelSuite(os.path.join("output","genSuiteTest"), templateMRun = self.mRun1) mSuite.addVariant("depthVary", self.stgI1) mSuite.addVariant("ZVary", self.stgI2) mSuite.subOutputPathGenFunc = msuite.getSubdir_RunIndex mSuite.generateRuns(itertools.izip) self.assertEqual(len(mSuite.runs), min(len(self.yRange), len(self.zRange))) for runI in range(len(mSuite.runs)): # This should just be a very simple output path based on # run index self.assertEqual(mSuite.runs[runI].outputPath, os.path.join("output", "genSuiteTest", msuite.getSubdir_RunIndex(None, None, None, runI))) mSuite.subOutputPathGenFunc = msuite.getSubdir_TextParamVals mSuite.generateRuns(itertools.izip) expIndices = [(0,0),(1,1)] for runI, expIndexTuple in enumerate(expIndices): self.assertEqual(mSuite.runs[runI].outputPath, os.path.join("output", "genSuiteTest", msuite.getSubdir_TextParamVals(mSuite.runs[runI], mSuite.modelVariants, expIndexTuple, runI)))
def __init__(self, testName, outputPathBase=None, basePath=None, nproc=1, timeout=None): if basePath is None: # Since expect this class to be used directly, # get calling path 1 levels up basePath = credo.utils.getCallingPath(1) if outputPathBase == None: outputPathBase = os.path.join("output", testName) SysTest.__init__(self, "SciBenchmark", testName, basePath, outputPathBase, nproc, timeout) # In the case of SciBenchmarks, we will auto-create the # ModelSuite here, since it's up to the user to configure # this rather than being done automatically in getSuite(). self.mSuite = ModelSuite(outputPathBase=self.outputPathBase)
def test_generateRuns_izip(self): mSuite = ModelSuite(os.path.join("output","genSuiteTest"), templateMRun = self.mRun1) mSuite.addVariant("depthVary", self.stgI1) mSuite.addVariant("ZVary", self.stgI2) mSuite.generateRuns(itertools.izip) self.assertEqual(len(mSuite.runs), min(len(self.yRange), len(self.zRange))) # These are indices into lists above, created manually for testing expIndices = [(0,0),(1,1)] for ii, expIndexTuple in enumerate(expIndices): yIndex, zIndex = expIndexTuple self.assertEqual(mSuite.runs[ii].paramOverrides['minY'], self.yRange[yIndex]) self.assertEqual(mSuite.runs[ii].paramOverrides['maxZ'], self.zRange[zIndex]) self.assertEqual(mSuite.runs[ii].outputPath, os.path.join("output", "genSuiteTest", mSuite.subOutputPathGenFunc(mSuite.runs[ii], mSuite.modelVariants, expIndexTuple, ii)))
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)) stdResults = jobRunner.runSuite(stdSuite) ppcResults = jobRunner.runSuite(ppcSuite) #----------------------------- cpuRegs = [] cpuPPCs = []
def genSuite(self): # an empty suite self.mSuite = ModelSuite(outputPathBase=self.outputPathBase) return self.mSuite