ATLAS Offline Software
Functions | Variables
vtune_athena Namespace Reference

Functions

def checkAthenaSetup ()
 Check Athena Setup. More...
 
def checkVTuneSetup ()
 Check VTune Setup. More...
 
def generateJOFragment (fileName, firstEvent, lastEvent)
 AutoGen a jobOptions fragment. More...
 
def main ()
 Main Function. More...
 

Variables

string fmt = '%(asctime)s :: %(levelname)-8s :: %(message)s'
 
string datefmt = '%m/%d/%Y %H:%M'
 
 logger = logging.getLogger(__name__)
 
 level
 
 format
 
 filename
 
 filemode
 
 console = logging.StreamHandler()
 
 formatter = logging.Formatter(fmt,datefmt=datefmt)
 

Function Documentation

◆ checkAthenaSetup()

def vtune_athena.checkAthenaSetup ( )

Check Athena Setup.

Definition at line 26 of file vtune_athena.py.

26 def checkAthenaSetup():
27  try:
28  a = subprocess.check_output(['athena','--version'])
29  logger.debug('Athena version information \n %s',a)
30  except Exception:
31  logger.fatal('Athena is not setup!')
32  sys.exit(-1)
33 

◆ checkVTuneSetup()

def vtune_athena.checkVTuneSetup ( )

Check VTune Setup.

Definition at line 37 of file vtune_athena.py.

37 def checkVTuneSetup():
38  try:
39  a = subprocess.check_output(['vtune','--version'])
40  logger.debug('VTune version information \n %s',a)
41  except Exception:
42  logger.fatal('VTune is not setup!')
43  sys.exit(-1)
44 

◆ generateJOFragment()

def vtune_athena.generateJOFragment (   fileName,
  firstEvent,
  lastEvent 
)

AutoGen a jobOptions fragment.

Definition at line 48 of file vtune_athena.py.

48 def generateJOFragment(fileName,firstEvent,lastEvent):
49  logger.info('Creating jOptions fragment %s', fileName)
50  with open('{}'.format(fileName),'w') as f:
51  f.write('# Auto generated jobOptions fragment to setup Athena VTune profiler')
52  f.write('\ninclude(\'PerfMonVTune/VTuneProfileEventLoop_preInclude.py\')')
53  f.write('\n\nfrom AthenaCommon.AppMgr import ServiceMgr')
54  f.write('\nServiceMgr.VTuneProfilerService.ResumeEvent = {}'.format(firstEvent))
55  f.write('\nServiceMgr.VTuneProfilerService.PauseEvent = {}'.format(lastEvent))
56 

◆ main()

def vtune_athena.main ( )

Main Function.

Main function that parses user inputs, prepares and runs the tests 

Definition at line 60 of file vtune_athena.py.

60 def main():
61  ''' Main function that parses user inputs, prepares and runs the tests '''
62 
63  from optparse import OptionParser
64  parser=OptionParser(usage='%prog [options]',
65  version='%prog 0.1.0')
66 
67  parser.add_option('--log-level',
68  type='choice',
69  action='store',
70  dest='logLevel',
71  choices=['critical','error','warning','info','debug'],
72  default='info',
73  help='Logging level (default: info)')
74 
75  parser.add_option('--collect',
76  type='choice',
77  action='store',
78  dest='collect',
79  choices=['hotspots','threading','memory-consumption',
80  'hpc-performance','memory-access','cpugpu-concurrency',
81  'gpu-hotspots','gpu-profiling','graphics-rendering',
82  'fpga-interaction','io','system-overview'],
83  default='hotspots',
84  help='Run the specified analysis type and collect data into a result (default: hotspots)')
85 
86  parser.add_option('--strategy',
87  type='string',
88  dest='strategy',
89  default=':trace:trace',
90  help='Run the specified strategy and collect data into a result. (default: :trace:trace)')
91 
92  parser.add_option('--tf',
93  type='string',
94  dest='tf',
95  default='',
96  help='Run the specified transformation command and collect data into a result.')
97 
98  parser.add_option('--resumeEvent',
99  type='int',
100  dest='start',
101  default=0,
102  help='Start the profiling from the specified event (default: 0).')
103 
104  parser.add_option('--pauseEvent',
105  type='int',
106  dest='stop',
107  default=-1,
108  help='Start the profiling at the specified event (default: -1).')
109 
110  (options,args) = parser.parse_args()
111 
112  logger.info(76*'-')
113 
114  # Set logging level
115  logger.setLevel(options.logLevel.upper())
116 
117  # Check the Athena and VTune setups
120 
121  # Perpare the JO fragment
122  joFragment = 'PerfMonVTune_autoSetup.py'
123  generateJOFragment(joFragment, options.start, options.stop)
124 
125  # Prepare the transformation command to execute
126  if not options.tf:
127  logger.fatal('The transformation command is empty, quitting...')
128  sys.exit(-1)
129 
130  args = options.tf.split()
131  if 'preInclude' in args:
132  index = args.index('--preInclude')
133  args.insert(index+1,joFragment)
134  else:
135  args.extend(['--preInclude',joFragment])
136 
137  # Run the command
138  cmd = ( 'vtune' +
139  ' -collect ' + options.collect +
140  ' -strategy ' + options.strategy +
141  ' -start-paused -- ' )
142  cmd += ' '.join(args)
143 
144  logger.info('Running the full command "{}"'.format(cmd))
145  subprocess.call(cmd,shell=True)
146 
147  logger.info('All done...')
148  logger.info(76*'-')
149 

Variable Documentation

◆ console

vtune_athena.console = logging.StreamHandler()

Definition at line 18 of file vtune_athena.py.

◆ datefmt

vtune_athena.datefmt = '%m/%d/%Y %H:%M'

Definition at line 11 of file vtune_athena.py.

◆ filemode

vtune_athena.filemode

Definition at line 17 of file vtune_athena.py.

◆ filename

vtune_athena.filename

Definition at line 16 of file vtune_athena.py.

◆ fmt

string vtune_athena.fmt = '%(asctime)s :: %(levelname)-8s :: %(message)s'

Definition at line 10 of file vtune_athena.py.

◆ format

vtune_athena.format

Definition at line 14 of file vtune_athena.py.

◆ formatter

vtune_athena.formatter = logging.Formatter(fmt,datefmt=datefmt)

Definition at line 19 of file vtune_athena.py.

◆ level

vtune_athena.level

Definition at line 13 of file vtune_athena.py.

◆ logger

vtune_athena.logger = logging.getLogger(__name__)

Definition at line 12 of file vtune_athena.py.

vtune_athena.format
format
Definition: vtune_athena.py:14
vtune_athena.checkVTuneSetup
def checkVTuneSetup()
Check VTune Setup.
Definition: vtune_athena.py:37
vtune_athena.main
def main()
Main Function.
Definition: vtune_athena.py:60
vtune_athena.generateJOFragment
def generateJOFragment(fileName, firstEvent, lastEvent)
AutoGen a jobOptions fragment.
Definition: vtune_athena.py:48
vtune_athena.checkAthenaSetup
def checkAthenaSetup()
Check Athena Setup.
Definition: vtune_athena.py:26
TCS::join
std::string join(const std::vector< std::string > &v, const char c=',')
Definition: Trigger/TrigT1/L1Topo/L1TopoCommon/Root/StringUtils.cxx:10
Trk::open
@ open
Definition: BinningType.h:40