The Gaudi Framework  v36r9p1 (5c15b2bb)
prepareBenchmark.py
Go to the documentation of this file.
1 
11 from __future__ import print_function
12 
13 import commands
14 
15 # File to prepare the configs and commands to be executed for the benchmark
16 
17 
19  template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10
20 ):
21  template = open(template_filename)
22  new_filename = "%s_%i_%i_%i.py" % (
23  template_filename.rstrip(".py"),
24  n_threads,
25  n_parallel_events,
26  n_parallel_algorithms,
27  )
28  new_config = open(new_filename, "w")
29  for line in template.readlines():
30  if line.startswith("n_threads"):
31  line = "n_threads = %i\n" % n_threads
32  elif line.startswith("n_parallel_events"):
33  line = "n_parallel_events = %i\n" % n_parallel_events
34  elif line.startswith("n_parallel_algorithms"):
35  line = "n_parallel_algorithms = %i\n" % n_parallel_algorithms
36  new_config.write(line)
37  new_config.close()
38  return new_filename
39 
40 
41 
42 if __name__ == "__main__":
43 
44  n_threads = 10
45  for n_algos in range(1, 11):
46  for n_events in range(1, n_algos + 1):
47  config = prepareConfig(
48  "../options/BrunelScenario.py",
49  n_threads=n_threads,
50  n_parallel_events=n_events,
51  n_parallel_algorithms=n_algos,
52  )
53  # config.replace(".py",".log"))
54  print(
55  "/usr/bin/time -f %%S -o %s.time `alias gaudirun` %s > %s"
56  % (config.replace(".py", ""), config, "/dev/null")
57  )
prepareBenchmark.prepareConfig
def prepareConfig(template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10)
Definition: prepareBenchmark.py:18
Gaudi::Functional::details::zip::range
decltype(auto) range(Args &&... args)
Zips multiple containers together to form a single range.
Definition: FunctionalDetails.h:102