The Gaudi Framework  master (bdbe7744)
Loading...
Searching...
No Matches
prepareBenchmark.py
Go to the documentation of this file.
11
12# File to prepare the configs and commands to be executed for the benchmark
13
14
16 template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10
17):
18 template = open(template_filename)
19 new_filename = f"{template_filename.rstrip('.py')}_{n_threads}_{n_parallel_events}_{n_parallel_algorithms}.py"
20 new_config = open(new_filename, "w")
21 for line in template.readlines():
22 if line.startswith("n_threads"):
23 line = f"n_threads = {n_threads}\n"
24 elif line.startswith("n_parallel_events"):
25 line = f"n_parallel_events = {n_parallel_events}\n"
26 elif line.startswith("n_parallel_algorithms"):
27 line = f"n_parallel_algorithms = {n_parallel_algorithms}\n"
28 new_config.write(line)
29 new_config.close()
30 return new_filename
31
32
33
34if __name__ == "__main__":
35 n_threads = 10
36 for n_algos in range(1, 11):
37 for n_events in range(1, n_algos + 1):
38 config = prepareConfig(
39 "../options/BrunelScenario.py",
40 n_threads=n_threads,
41 n_parallel_events=n_events,
42 n_parallel_algorithms=n_algos,
43 )
44 # config.replace(".py",".log"))
45 print(
46 "/usr/bin/time -f %S -o {}.time `alias gaudirun` {} > {}".format(
47 config.replace(".py", ""), config, "/dev/null"
48 )
49 )
GAUDI_API std::string format(const char *,...)
MsgStream format utility "a la sprintf(...)".
Definition MsgStream.cpp:93
prepareConfig(template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10)
(c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations # # This software i...