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