def processData(eInfo, mInfo, sInfo, testMode, verbose, opt=None): if mInfo: try: resIdx = ResourceIndex() Hardware.getHardwareInfo(resIdx, mInfo.machineFile) writeList = resIdx.PTdF() f = open(mInfo.machinePTdF, 'w') for w in writeList: f.write(w) f.close() print "PTDF machine data generation complete." except PTexception, a: raise if testMode: print a raise PTexception(a) else: print a.value return -1
def main(argv=sys.argv): try: options = checkInputs(argv) resIdx = ResourceIndex() grids = getHardwareInfo(resIdx, options.dataFile) ptdfname = options.ptdfFile f = open(ptdfname, 'w') for grid in grids: f.write(grid.PTdF("", " ")) f.close() return 0 except PTexception, a: print a.value return 1
def focusTests(pf): print "Focus Tests" try: # try getting a focus template ri = ResourceIndex() build = Resource("mybuild","build") env = Resource("myenv", "environment") lib = Resource(env.name+"|libmpi.so","environment|module") ri.addResource(lib) lib = Resource(env.name+"|libelf.so","environment|module") ri.addResource(lib) compiler = Resource("theCompiler","compiler") execution = Execution("myexec") process0 = Resource(execution.name+"|Process-0","execution|process") ri.addResources([compiler,build,env]) metric = Resource("MFLOPS","metric") pt = Resource("Paradyn","performanceTool") ri.addResources([build,env,process0,metric,pt]) fl = ri.createContextTemplate() except: pf.failed("non-PTexception raised when getting focusTemplate") raise else: if len(fl) != 4: pf.failed("wrong number of resources. %d" % len(fl)) else: pf.passed("got focus template successfully") try: # try getting a focus template with two top-level resources withthe # same type ri =ResourceIndex() build = Resource("mybuild","build") env = Resource("myenv", "environment") lib = Resource(env.name+"|libmpi.so","environment|module") ri.addResource(lib) lib = Resource(env.name+"|libelf.so","environment|module") ri.addResource(lib) compiler = Resource("theCompiler","compiler") execution = Execution("myexec") process0 = Resource(execution.name+"|Process-0","execution|process") ri.addResources([compiler,build,env]) compiler = Resource("theOtherCompiler","compiler") process1 = Resource(execution.name+"|Process-1","execution|process") ri.addResources([compiler,build,env]) ri.addResources([build,env,process0,process1]) fl = ri.createContextTemplate() except: pf.failed("non-PTexception raised when getting focusTemplate same types") raise else: if len(fl) != 6: pf.failed("wrong number of resources same types. %d" % len(fl)) else: pf.passed("got focus template successfully same types") try: # try adding a specific focus resources that is a child of a resource # in the template ri = ResourceIndex() build = Resource("mybuild","build") env = Resource("myenv", "environment") lib = Resource(env.name+"|libmpi.so","environment|module") ri.addResource(lib) lib = Resource(env.name+"|libelf.so","environment|module") ri.addResource(lib) compiler = Resource("theCompiler","compiler") execution = Execution("myexec") process0 = Resource(execution.name+"|Process-0","execution|process") ri.addResources([compiler,build,env]) ri.addResources([build,env,process0]) fl = ri.createContextTemplate() newfl = ri.addSpecificContextResource(fl,process0) except: pf.failed("non-PTexception raised when adding specific focus child") raise else: if len(newfl) != 4: pf.failed("wrong number of resources when adding specific focus child. %d" % len(newfl)) else: pf.passed("got focus template successfully when adding specific focus child") try: # try adding a list of specific focus resources that is a child of # a resource in the template ri = ResourceIndex() build = Resource("mybuild","build") env = Resource("myenv", "environment") lib = Resource(env.name+"|libmpi.so","environment|module") ri.addResource(lib) lib = Resource(env.name+"|libelf.so","environment|module") ri.addResource(lib) compiler = Resource("theCompiler","compiler") execution = Execution("myexec") process0 = Resource(execution.name+"|Process-0","execution|process") ri.addResources([compiler,build,env]) process1 = Resource(execution.name+"|Process-1","execution|process") ri.addResources([compiler,build,env]) ri.addResources([build,env,process0,process1]) fl = ri.createContextTemplate() newfl = ri.addSpecificContextResources(fl,[process0,process1]) except: pf.failed("non-PTexception raised when adding specific focus child list") raise else: if len(newfl) != 5: pf.failed("wrong number of resources when adding specific focus child list. %d" % len(newfl)) else: pf.passed("got focus template successfully when adding specific focus child list")
p = Resource("eddie","atype") c = Resource("eddie|schild","atype|btype") theVerdict = p.isChild(c) except PTexception, a: pf.failed(a.value) except: pf.failed("non-PTexception when try isChild actual child") else: if theVerdict == True: pf.passed("isChild pass actual child") else: pf.failed("isChild fail actual child") try: # try finding a static library ri = ResourceIndex() build = Resource("mybuild","build") lib = Resource(build.name+"|libmpi.a","build|module") ri.addResource(lib) env = Resource("myenv", "environment") execution = Execution("myexec") ri.addResources([build,env]) resList = ri.findResourcesByShortType("module") libname = "" for r in resList: if r.name.find("libmpi") >= 0: libname = r.name break except PTexception, a: pf.failed("PTexception raised when trying to find good static lib with findResourceByShortType: " + a.value) except:
def focusTests(pf): print "Focus Tests" try: # try getting a focus template ri = ResourceIndex() build = Resource("mybuild", "build") env = Resource("myenv", "environment") lib = Resource(env.name + "|libmpi.so", "environment|module") ri.addResource(lib) lib = Resource(env.name + "|libelf.so", "environment|module") ri.addResource(lib) compiler = Resource("theCompiler", "compiler") execution = Execution("myexec") process0 = Resource(execution.name + "|Process-0", "execution|process") ri.addResources([compiler, build, env]) metric = Resource("MFLOPS", "metric") pt = Resource("Paradyn", "performanceTool") ri.addResources([build, env, process0, metric, pt]) fl = ri.createContextTemplate() except: pf.failed("non-PTexception raised when getting focusTemplate") raise else: if len(fl) != 4: pf.failed("wrong number of resources. %d" % len(fl)) else: pf.passed("got focus template successfully") try: # try getting a focus template with two top-level resources withthe # same type ri = ResourceIndex() build = Resource("mybuild", "build") env = Resource("myenv", "environment") lib = Resource(env.name + "|libmpi.so", "environment|module") ri.addResource(lib) lib = Resource(env.name + "|libelf.so", "environment|module") ri.addResource(lib) compiler = Resource("theCompiler", "compiler") execution = Execution("myexec") process0 = Resource(execution.name + "|Process-0", "execution|process") ri.addResources([compiler, build, env]) compiler = Resource("theOtherCompiler", "compiler") process1 = Resource(execution.name + "|Process-1", "execution|process") ri.addResources([compiler, build, env]) ri.addResources([build, env, process0, process1]) fl = ri.createContextTemplate() except: pf.failed( "non-PTexception raised when getting focusTemplate same types") raise else: if len(fl) != 6: pf.failed("wrong number of resources same types. %d" % len(fl)) else: pf.passed("got focus template successfully same types") try: # try adding a specific focus resources that is a child of a resource # in the template ri = ResourceIndex() build = Resource("mybuild", "build") env = Resource("myenv", "environment") lib = Resource(env.name + "|libmpi.so", "environment|module") ri.addResource(lib) lib = Resource(env.name + "|libelf.so", "environment|module") ri.addResource(lib) compiler = Resource("theCompiler", "compiler") execution = Execution("myexec") process0 = Resource(execution.name + "|Process-0", "execution|process") ri.addResources([compiler, build, env]) ri.addResources([build, env, process0]) fl = ri.createContextTemplate() newfl = ri.addSpecificContextResource(fl, process0) except: pf.failed("non-PTexception raised when adding specific focus child") raise else: if len(newfl) != 4: pf.failed( "wrong number of resources when adding specific focus child. %d" % len(newfl)) else: pf.passed( "got focus template successfully when adding specific focus child" ) try: # try adding a list of specific focus resources that is a child of # a resource in the template ri = ResourceIndex() build = Resource("mybuild", "build") env = Resource("myenv", "environment") lib = Resource(env.name + "|libmpi.so", "environment|module") ri.addResource(lib) lib = Resource(env.name + "|libelf.so", "environment|module") ri.addResource(lib) compiler = Resource("theCompiler", "compiler") execution = Execution("myexec") process0 = Resource(execution.name + "|Process-0", "execution|process") ri.addResources([compiler, build, env]) process1 = Resource(execution.name + "|Process-1", "execution|process") ri.addResources([compiler, build, env]) ri.addResources([build, env, process0, process1]) fl = ri.createContextTemplate() newfl = ri.addSpecificContextResources(fl, [process0, process1]) except: pf.failed( "non-PTexception raised when adding specific focus child list") raise else: if len(newfl) != 5: pf.failed( "wrong number of resources when adding specific focus child list. %d" % len(newfl)) else: pf.passed( "got focus template successfully when adding specific focus child list" )
p = Resource("eddie", "atype") c = Resource("eddie|schild", "atype|btype") theVerdict = p.isChild(c) except PTexception, a: pf.failed(a.value) except: pf.failed("non-PTexception when try isChild actual child") else: if theVerdict == True: pf.passed("isChild pass actual child") else: pf.failed("isChild fail actual child") try: # try finding a static library ri = ResourceIndex() build = Resource("mybuild", "build") lib = Resource(build.name + "|libmpi.a", "build|module") ri.addResource(lib) env = Resource("myenv", "environment") execution = Execution("myexec") ri.addResources([build, env]) resList = ri.findResourcesByShortType("module") libname = "" for r in resList: if r.name.find("libmpi") >= 0: libname = r.name break except PTexception, a: pf.failed( "PTexception raised when trying to find good static lib with findResourceByShortType: "
def main(argv=sys.argv): usage = "usage: %prog [options]\nexecute '%prog --help' to see options" version = "%prog 1.0" parser = OptionParser(usage=usage,version=version) parser.add_option("-n","--name", dest="machine_name", action="store", help="machine name of system") parser.add_option("-o", "--output_ptdf", dest="ptdf", help="output name of the ptdf", default="-") (options, args) = parser.parse_args(argv[1:]) if (options.machine_name == None): print "Need machine name specified by -n" sys.exit(1) machine = options.machine_name repo = "/home/crzysdrs/PerfTrack/" process_list = [ ("%s/benchmarks/blocked_multiplication/blocked_Reports/XML/blocked_*.xml", 'blocked'), ("%s/benchmarks/2d_image_processing/2d_img_processing_Reports/XML/2d_img_processing_*.xml", '2d_img_processing'), ("%s/benchmarks/unblocked_multiplication/un_blocked_Reports/XML/un_blocked_*.xml", 'un_blocked'), ("%s/benchmarks/int_multiplication/int_multiplication_Reports/XML/matrixMult_int_*.xml", 'matrixMult_int'), ("%s/benchmarks/int_multiplication/int_multiplication_Reports/XML/multOMP_int_*.xml", 'multOMP_int'), ("%s/benchmarks/float_multiplication/float_multiplication_Reports/XML/matrixMult_float_*.xml", 'matrixMult_float'), ("%s/benchmarks/float_multiplication/float_multiplication_Reports/XML/multOMP_float_*.xml", 'multOMP_float'), ("%s/benchmarks/float_multiplication/float_multiplication_Reports/XML/multOMP_random*.xml", 'multOMP_random'), ("%s/benchmarks/float_multiplication/float_multiplication_Reports/XML/matrixMult_random*.xml", 'matrixMult_random') ] full_env = ['%s/benchmarks/Benchmark2-XML-reports/*.xml'] resIdx = ResourceIndex() resIdx.addResource(Resource(machine, Resource.resDelim.join(["grid", "machine"]))) app = Application("oprofile") global_e = Execution("oprofile-exec", []) resIdx.addResource(global_e) resIdx.addResource(app) for p in process_list: files = glob(p[0] % repo) tool_res = resIdx.findOrCreateResource(Resource.resDelim.join([p[1]]), Resource.resDelim.join(["performanceTool"])) resIdx.addResource(tool_res) for f in files: exec_re = re.match("^.*/([^/]+).xml$", f) tool_args = tool_res.extend(exec_re.group(1), "args") resIdx.addResource(tool_args) context = resIdx.addSpecificContextResources([],[global_e, tool_args]) prepare(resIdx, tool_args) oprof = ParseOprof() countables = oprof.processOPROF(f) countable_binary_execution(resIdx, global_e, context, tool_args, find_binary(countables, p[1])) if (options.ptdf == "-"): f = sys.stdout else: f = open(options.ptdf, "w") writeLst = resIdx.PTdF() for w in writeLst: f.write(w) f.close()
f.write(w) f.close() print "PTDF machine data generation complete." except PTexception, a: raise if testMode: print a raise PTexception(a) else: print a.value return -1 if sInfo: ptds = None try: resIdx = ResourceIndex() ptds = connectToDB(testMode, opt) ## set the machine name from command line arg: fullname,type = getMachineName(ptds, sInfo.machineName, "machine") mach = Resource(fullname, type) resIdx.addResource(mach) parsePerf.getSysPerfInfo(resIdx, sInfo.dataDir, sInfo.perfTools, ptds) ptdfname = sInfo.dataDir + "/sys.ptdf" f = open(ptdfname,'w') # ResourceIndex.PTdF returns a list of strings to write writeLst = resIdx.PTdF() for w in writeLst: f.write(w) f.close() print "PTDF system data generation complete."
f.write(w) f.close() print "PTDF machine data generation complete." except PTexception, a: raise if testMode: print a raise PTexception(a) else: print a.value return -1 if sInfo: ptds = None try: resIdx = ResourceIndex() ptds = connectToDB(testMode, opt) ## set the machine name from command line arg: fullname, type = getMachineName(ptds, sInfo.machineName, "machine") mach = Resource(fullname, type) resIdx.addResource(mach) parsePerf.getSysPerfInfo(resIdx, sInfo.dataDir, sInfo.perfTools, ptds) ptdfname = sInfo.dataDir + "/sys.ptdf" f = open(ptdfname, 'w') # ResourceIndex.PTdF returns a list of strings to write writeLst = resIdx.PTdF() for w in writeLst: f.write(w) f.close()