Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-02-21 23:14:22

0001 import os.path, glob, sys
0002 import ROOT
0003 import array
0004 import math
0005 
0006 # N.B.: Consult ./xeon_scripts/benchmark-cmssw-ttbar-fulldet-build.sh for info on nTHs, nVUs, and text file names
0007 
0008 arch   = sys.argv[1] # SNB, KNL, SKL-SP
0009 sample = sys.argv[2]
0010 build  = sys.argv[3] # CE, FV
0011 
0012 g = ROOT.TFile('benchmarkMEIF_'+arch+'_'+sample+'_'+build+'.root','recreate')
0013 
0014 # Parallelization datapoints
0015 if arch == 'KNL' :
0016     nvu = '16int'
0017     thvals = ['1','2','4','8','16','32','64','96','128','160','192','224','256']
0018     evvals = ['1','2','4','8','16','32','64','128']
0019 elif arch == 'SNB' :
0020     nvu = '8int'
0021     thvals = ['1','2','4','6','8','12','16','20','24']
0022     evvals = ['1','2','4','8','12']
0023 elif arch == 'SKL-SP' :
0024     nvu = '16int'
0025     thvals = ['1','2','4','8','16','32','48','64']
0026     evvals = ['1','2','4','8','16','32','64']
0027 elif arch == 'LNX-G' :
0028     nvu = '16int'
0029     thvals = ['1','2','4','8','16','32','48','64']
0030     evvals = ['1','2','4','8','16','32','64']
0031 elif arch == 'LNX-S' :
0032     nvu = '16int'
0033     thvals = ['1','2','4','8','16','32','48','64']
0034     evvals = ['1','2','4','8','16','32','64']
0035 else :
0036     print arch,"is not a valid architecture! Exiting..."
0037     sys.exit(0)
0038 
0039 # extra text label
0040 text = 'MEIF'
0041 
0042 # text for grepping
0043 grepnEV  = '=== TOTAL for'
0044 grepTime = 'Total event loop time'
0045 
0046 # needed for speedups
0047 xval0 = array.array('d',[0])
0048 yval0 = array.array('d',[0])
0049 
0050 # time    
0051 for evval in evvals :
0052     print arch,sample,build,"nEV:",evval
0053     
0054     # define event float
0055     ev = float(evval)
0056         
0057     # define tgraphs vs absolute time and speedup
0058     g_time    = ROOT.TGraph()
0059     g_speedup = ROOT.TGraph()
0060 
0061     point = 0
0062     for thval in thvals :
0063         xval = float(thval)
0064         if ev > xval: continue;
0065             
0066         # extracted time
0067         yval = float(0)
0068         nev  = float(1)
0069 
0070         # open log file, grep for relevant lines
0071         with open('log_'+arch+'_'+sample+'_'+build+'_NVU'+nvu+'_NTH'+thval+'_NEV'+evval+'.txt') as f :
0072             for line in f :
0073                 if grepnEV in line :
0074                     lsplit = line.split()                
0075                     nev  = float(lsplit[3])
0076                 elif grepTime in line :
0077                     lsplit = line.split()                
0078                     yval = float(lsplit[4])
0079 
0080         yval /= nev
0081 
0082         # Printout value for good measure
0083         print xval,yval
0084 
0085         # store val
0086         g_time.SetPoint(point,xval,yval)
0087         point = point+1
0088 
0089     # write out the plot
0090     g_time.Write('g_'+build+'_'+text+'_nEV'+evval+'_time')
0091 
0092     # needed for speedup calculation
0093     if evval is '1' :
0094         g_time.GetPoint(0,xval0,yval0)        
0095         
0096     # speedup plots
0097     point = 0
0098     for thval in thvals :
0099         xval = float(thval)
0100         if ev > xval: continue;
0101 
0102         # set up inputs
0103         xval = array.array('d',[0])
0104         yval = array.array('d',[0])
0105         
0106         # get point from time
0107         g_time.GetPoint(point,xval,yval)
0108 
0109         speedup  = 0.
0110         if yval[0] > 0. : 
0111             speedup  = yval0[0]/yval[0]
0112                 
0113         # store in speedup plot
0114         g_speedup.SetPoint(point,xval[0],speedup)
0115         point = point+1
0116 
0117     # always write out speedup
0118     g_speedup.Write('g_'+build+'_'+text+'_nEV'+evval+'_speedup')
0119 
0120 g.Write()
0121 g.Close()