| The Gaudi Framework v32r1 (f65d50dc)

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