6 def prepareConfig(template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10):
7 template = open(template_filename)
8 new_filename =
"%s_%i_%i_%i.py" % (template_filename.rstrip(
9 ".py"), n_threads, n_parallel_events, n_parallel_algorithms)
10 new_config = open(new_filename,
"w")
11 for line
in template.readlines():
12 if line.startswith(
"n_threads"):
13 line =
"n_threads = %i\n" % n_threads
14 elif line.startswith(
"n_parallel_events"):
15 line =
"n_parallel_events = %i\n" % n_parallel_events
16 elif line.startswith(
"n_parallel_algorithms"):
17 line =
"n_parallel_algorithms = %i\n" % n_parallel_algorithms
18 new_config.write(line)
24 if __name__ ==
"__main__":
27 for n_algos
in xrange(1, 11):
28 for n_events
in xrange(1, n_algos + 1):
29 config =
prepareConfig(
"../options/BrunelScenario.py", n_threads=n_threads,
30 n_parallel_events=n_events, n_parallel_algorithms=n_algos)
32 print "/usr/bin/time -f %%S -o %s.time `alias gaudirun` %s > %s" % (
33 config.replace(
".py",
""), config,
"/dev/null")
def prepareConfig(template_filename, n_threads=10, n_parallel_events=10, n_parallel_algorithms=10)