-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_hadoop.py
53 lines (44 loc) · 1.48 KB
/
run_hadoop.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from subprocess import call
import sys
single_threaded =[
"grep-map0",
"grep-map1",
"grep-map2",
"grep-map3",
"grep-reduce0",
]
workloads=[[
"grep-map0",
"grep-map1",
"grep-map2",
"grep-map3",
]]
ramulator_bin = "/home/tianshi/tianshi-Workspace/ramulator/ramulator"
if not len(sys.argv) == 7:
print "python run_hadoop.py trace_dir output_dir config_dir workloadid DRAM [multicore|single-threaded]"
sys.exit(0)
option = sys.argv[6]
DRAM = sys.argv[5]
workload_id = int(sys.argv[4])
config_dir = sys.argv[3]
output_dir = sys.argv[2]
trace_dir = sys.argv[1]
if option == "multicore":
output_dir += "/workload" + str(workload_id)
print output_dir
else:
output_dir += "/" + single_threaded[workload_id]
print output_dir
call(["mkdir", "-p", output_dir])
output = output_dir + "/" + DRAM + ".stats"
config = config_dir + "/" + DRAM + "-config.cfg"
if option == "multicore":
traces = [trace_dir + "/" + t + ".trace" for t in workloads[workload_id]]
cmds = [ramulator_bin, "--config", config, "--mode", "cpu", "--stats", output, "--trace"] + traces
print " ".join(cmds)
call(cmds)
elif option == "single-threaded":
trace = trace_dir + "/" + single_threaded[workload_id] + ".trace"
cmds = [ramulator_bin, "--config", config, "--mode", "cpu", "--stats", output, "--trace", trace]
print " ".join(cmds)
call(cmds)