Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/usr/bin/env python
###############################################################################
# (c) Copyright 2022 CERN for the benefit of the LHCb Collaboration #
# #
# This software is distributed under the terms of the GNU General Public #
# Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". #
# #
# In applying this licence, CERN does not waive the privileges and immunities #
# granted to it by virtue of its status as an Intergovernmental Organization #
# or submit itself to any jurisdiction. #
###############################################################################
""" Launch one Moore job to produce MDF output for bandwidth measurement.
The corresponding option files are under:
$HLT2CONFROOT/tests/options/bandwidth/
"""
from __future__ import print_function, division
import argparse
import logging
import subprocess
import os
def run_gaudi_job(args, n_events):
# build command line
extra_options = """
from Moore import options
options.n_threads = {n_threads!r}
options.n_event_slots = {evt_slots!r}
options.evt_max = {n_evts!r}
options.input_type = 'MDF'
options.set_input_and_conds_from_testfiledb({TFDBkey!r})
""".format(
n_evts=n_events,
evt_slots=args.evtSlots,
n_threads=args.threads,
TFDBkey=args.test_file_db_key)
cmd = ['gaudirun.py', '--option', extra_options
] + [os.path.expandvars(x) for x in args.options]
cmd.insert(1, '-T')
# run the test
subprocess.run(cmd)
if __name__ == '__main__':
parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
parser.add_argument('options', nargs='+', help='Gaudi options files.')
parser.add_argument(
'-t',
'--threads',
type=int,
default=1,
help='Number of threads per job (defaults to # logical cpus')
parser.add_argument(
'-e',
'--evtSlots',
type=int,
default=None,
help='Number of event slots per job (defaults to max(1.2 * # threads, '
'1 + # threads)')
parser.add_argument(
'-n',
'--events',
default=100,
type=lambda x: int(round(float(x))),
help='nb of events to process per job')
parser.add_argument(
'--test-file-db-key',
default='UpgradeHLT1FilteredWithGEC',
help='TestFileDB key defining input files and tags.')
parser.add_argument(
'--debug', action='store_true', help='Debugging output')
args = parser.parse_args()
logging.basicConfig(
format='%(levelname)-7s %(message)s',
level=(logging.DEBUG if args.debug else logging.INFO))
# run at most 1e5 events for each test
n_events = args.events
if n_events == -1 or n_events > 1e5: n_events = 1e5
if args.evtSlots is None:
args.evtSlots = max(int(round(1.2 * args.threads)), 1 + args.threads)
run_gaudi_job(args, n_events)