| The Gaudi Framework v27r1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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 def prepareConfig(template_filename, n_threads=10, n_parallel_events=10,n_parallel_algorithms=10):
6 template = open(template_filename)
7 new_filename = "%s_%i_%i_%i.py" %(template_filename.rstrip(".py"),n_threads,n_parallel_events,n_parallel_algorithms)
8 new_config = open(new_filename,"w")
9 for line in template.readlines():
10 if line.startswith("n_threads"):
11 line = "n_threads = %i\n" %n_threads
12 elif line.startswith("n_parallel_events"):
13 line = "n_parallel_events = %i\n" %n_parallel_events
14 elif line.startswith("n_parallel_algorithms"):
15 line = "n_parallel_algorithms = %i\n" %n_parallel_algorithms
16 new_config.write(line)
17 new_config.close()
18 return new_filename
19
20
21 ##########################
22 if __name__ == "__main__":
23
24 n_threads = 10
25 for n_algos in xrange(1,11):
26 for n_events in xrange(1,n_algos+1):
27 config = prepareConfig("../options/BrunelScenario.py",n_threads=n_threads,n_parallel_events=n_events,n_parallel_algorithms=n_algos)
28 print "/usr/bin/time -f %%S -o %s.time `alias gaudirun` %s > %s" %(config.replace(".py",""), config, "/dev/null") #config.replace(".py",".log"))
29
prepareBenchmark.prepareConfig
def prepareConfig
Definition: prepareBenchmark.py:5