-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
197 lines (148 loc) · 10.8 KB
/
Makefile
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
.PHONY: lmbench_wave lmbench_raw_syscalls lmbench_wasmtime sqlite_run_wasmtime sqlite_run_wasm2c sqlite_run_raw_syscalls run_sqlite run_lmbench run_all
SQLITE_ROOT ?= sqlite/sqlite
WASI_SDK_ROOT=../tools/wasi-sdk
#WASI_SDK_INSTALL=$(WASI_SDK_ROOT)/build/install/opt/wasi-sdk/bin/
WASI_SDK_INSTALL=$(WASI_SDK_ROOT)/build/install/opt/wasi-sdk/
WASM2C_ROOT=../tools/wasm2c_sandbox_compiler
#WASI_SDK_ROOT=../../../tools/wasi-sdk
#WASI_SDK_INSTALL=$(WASI_SDK_ROOT)/build/install/opt/wasi-sdk/
#WASM2C_ROOT=../../../tools/wasm2c_sandbox_compiler
WASM2C_SRC_ROOT = $(WASM2C_ROOT)/wasm2c
WASM2C_BIN_ROOT = $(WASM2C_ROOT)/bin
SQLITE_BUILD = build/sqlite
WASMTIME_ROOT=runtimes/wasmtime
# These CPU numbers are for elk
PINNED_CPU = 8
# SIBLING_CPU = 48
#SETUP_BENCH = nice -n -20 taskset -c $(PINNED_CPU)
SETUP_BENCH =
INVOKE_WAVE = LD_LIBRARY_PATH=../build/wave/release $(SETUP_BENCH) ../$(WASM2C_BIN_ROOT)/wasm2c-runner
INVOKE_WAVE_RAW_SYSCALLS = LD_LIBRARY_PATH=../build/raw_syscalls/release $(SETUP_BENCH) ../$(WASM2C_BIN_ROOT)/wasm2c-runner
INVOKE_WASMTIME = $(SETUP_BENCH) ../runtimes/wasmtime/target/release/wasmtime run --allow-unknown-exports --allow-precompiled
INVOKE_WAVE_WITH_SYSCALLS = LD_LIBRARY_PATH=../build/wave_with_syscalls/release $(SETUP_BENCH) ../$(WASM2C_BIN_ROOT)/wasm2c-runner
#NOW=`date '+%F_%H:%M:%S'`
#RESULTS_BASE=results/$(date "+%Y_%m_%d-%H_%M_%S")
#RESULTS_BASE=results/$(NOW)
RESULTS_BASE:= results/$(shell date --iso=seconds)
# shared commands
# ==============================================================================
build_raw_syscalls:
cargo build --target-dir=build/raw_syscalls --release --features=time_syscalls
build_wave:
cargo build --target-dir=build/wave --release --features=time_hostcalls
build_wave_with_syscalls:
cargo build --target-dir=build/wave_with_syscalls --release --features=time_hostcalls --features=time_syscalls
clean:
cd wasi-lmbench && $(MAKE) clean
rm -rf build
# lmbench benchmarks
# ==============================================================================
lmbench_wave: build_wave_lmbench
mkdir -p $(RESULTS_BASE)/lmbench
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 null data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_null.txt
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 read data/tmp.txt" --homedir="/"
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_read.txt
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 write data/tmp.txt" --homedir="/"
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_write.txt
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 stat data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_stat.txt
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 fstat data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_fstat.txt
cd wasi-lmbench && $(INVOKE_WAVE) bin/wave/lat_syscall --args="lat_syscall -N 1000000 open data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_open.txt
lmbench_raw_syscalls: build_raw_syscalls_lmbench
mkdir -p $(RESULTS_BASE)/lmbench
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 null data/tmp.txt" --homedir="."
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_null.txt
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 read data/tmp.txt" --homedir="/"
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_read.txt
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 write data/tmp.txt" --homedir="/"
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_write.txt
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 stat data/tmp.txt" --homedir="."
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_stat.txt
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 fstat data/tmp.txt" --homedir="."
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_fstat.txt
cd wasi-lmbench && $(INVOKE_WAVE_RAW_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 open data/tmp.txt" --homedir="."
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_open.txt
lmbench_wasmtime: build_wasmtime_lmbench
mkdir -p $(RESULTS_BASE)/lmbench
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=. bin/wasmtime/lat_syscall -- -N 1000000 null data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_null.txt
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=/ bin/wasmtime/lat_syscall -- -N 1000000 read data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_read.txt
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=/ bin/wasmtime/lat_syscall -- -N 1000000 write data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_write.txt
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=. bin/wasmtime/lat_syscall -- -N 1000000 stat data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_stat.txt
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=. bin/wasmtime/lat_syscall -- -N 1000000 fstat data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_fstat.txt
cd wasi-lmbench && $(INVOKE_WASMTIME) --dir=. bin/wasmtime/lat_syscall -- -N 1000000 open data/tmp.txt
mv wasi-lmbench/wasmtime_results.txt $(RESULTS_BASE)/lmbench/wasmtime_open.txt
lmbench_wave_with_syscalls: build_wave_with_syscalls_lmbench
mkdir -p $(RESULTS_BASE)/lmbench
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 null data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_null.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_null.txt
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 read data/tmp.txt" --homedir="/"
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_read.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_read.txt
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 write data/tmp.txt" --homedir="/"
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_write.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_write.txt
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 stat data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_stat.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_stat.txt
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 fstat data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_fstat.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_fstat.txt
cd wasi-lmbench && $(INVOKE_WAVE_WITH_SYSCALLS) bin/wave/lat_syscall --args="lat_syscall -N 1000000 open data/tmp.txt" --homedir="."
mv wasi-lmbench/hostcall_results.txt $(RESULTS_BASE)/lmbench/hostcalls_open.txt
mv wasi-lmbench/syscall_results.txt $(RESULTS_BASE)/lmbench/syscalls_open.txt
build_wave_lmbench: build_wave
cd wasi-lmbench && RUNTIME=wave $(MAKE)
build_raw_syscalls_lmbench: build_raw_syscalls
cd wasi-lmbench && RUNTIME=raw_syscalls $(MAKE)
build_wasmtime_lmbench:
cd wasi-lmbench && RUNTIME=wasmtime $(MAKE)
build_wave_with_syscalls_lmbench: build_wave_with_syscalls
cd wasi-lmbench && RUNTIME=wave_with_syscalls $(MAKE)
build_lmbench: build_wave_lmbench build_raw_syscalls_lmbench build_wasmtime_lmbench
run_lmbench: lmbench_wasmtime lmbench_wave lmbench_raw_syscalls
# sqlite benchmarks
# ==============================================================================
# Remember: $< is first input, $@ is output
build_sqlite: $(SQLITE_BUILD)/speedtest1_wasmtime $(SQLITE_BUILD)/speedtest1_wasm2c $(SQLITE_BUILD)/speedtest1_raw_syscalls
run_sqlite: sqlite_run_wasmtime sqlite_run_wasm2c sqlite_run_raw_syscalls
$(SQLITE_BUILD)/speedtest1.wasm:
mkdir -p $(SQLITE_BUILD)
cd $(SQLITE_BUILD) && ../../sqlite/compile_speedtest1.sh ../../$(WASI_SDK_INSTALL) ../../$(SQLITE_ROOT) ../../$(SQLITE_ROOT)/../lib
cp $(SQLITE_BUILD)/speedtest1 $(SQLITE_BUILD)/speedtest1.wasm
$(SQLITE_BUILD)/speedtest1.wasm.c: $(SQLITE_BUILD)/speedtest1.wasm
$(WASM2C_BIN_ROOT)/wasm2c -o $@ $<
$(SQLITE_BUILD)/speedtest1_wasm2c: $(SQLITE_BUILD)/speedtest1.wasm.c
gcc -shared -fPIC -O3 -o $@ $< -I$(WASM2C_SRC_ROOT) $(WASM2C_SRC_ROOT)/wasm-rt-impl.c $(WASM2C_SRC_ROOT)/wasm-rt-os-unix.c $(WASM2C_SRC_ROOT)/wasm-rt-os-win.c $(WASM2C_SRC_ROOT)/wasm-rt-wasi.c build/wave/release/libwave.so -I../bindings
$(SQLITE_BUILD)/speedtest1_raw_syscalls: $(SQLITE_BUILD)/speedtest1.wasm.c
gcc -shared -fPIC -O3 -o $@ $< -I$(WASM2C_SRC_ROOT) $(WASM2C_SRC_ROOT)/wasm-rt-impl.c $(WASM2C_SRC_ROOT)/wasm-rt-os-unix.c $(WASM2C_SRC_ROOT)/wasm-rt-os-win.c $(WASM2C_SRC_ROOT)/wasm-rt-wasi.c build/raw_syscalls/release/libwave.so -I../bindings
$(SQLITE_BUILD)/speedtest1_wasmtime: $(SQLITE_BUILD)/speedtest1.wasm
$(WASMTIME_ROOT)/target/release/wasmtime compile $< -o $@
$(SQLITE_BUILD)/speedtest1_wasm2c_with_syscalls: $(SQLITE_BUILD)/speedtest1.wasm.c
gcc -shared -fPIC -O3 -o $@ $< -I$(WASM2C_SRC_ROOT) $(WASM2C_SRC_ROOT)/wasm-rt-impl.c $(WASM2C_SRC_ROOT)/wasm-rt-os-unix.c $(WASM2C_SRC_ROOT)/wasm-rt-os-win.c $(WASM2C_SRC_ROOT)/wasm-rt-wasi.c build/wave_with_syscalls/release/libwave.so -I../bindings
sqlite_run_wasmtime: $(SQLITE_BUILD)/speedtest1_wasmtime
mkdir -p $(RESULTS_BASE)/sqlite
$(WASMTIME_ROOT)/target/release/wasmtime --dir=. $< --allow-precompiled 2>/dev/null
mv wasmtime_results.txt $(RESULTS_BASE)/sqlite/wasmtime.txt
sqlite_run_wasm2c: $(SQLITE_BUILD)/speedtest1_wasm2c
mkdir -p $(RESULTS_BASE)/sqlite
$(WASM2C_BIN_ROOT)/wasm2c-runner $< --homedir=.
mv hostcall_results.txt $(RESULTS_BASE)/sqlite/hostcalls.txt
sqlite_run_raw_syscalls: $(SQLITE_BUILD)/speedtest1_raw_syscalls
mkdir -p $(RESULTS_BASE)/sqlite
$(WASM2C_BIN_ROOT)/wasm2c-runner $< --homedir=.
mv syscall_results.txt $(RESULTS_BASE)/sqlite/syscalls.txt
sqlite_run_wave_with_syscalls: $(SQLITE_BUILD)/speedtest1_wasm2c_with_syscalls
mkdir -p $(RESULTS_BASE)/sqlite
$(WASM2C_BIN_ROOT)/wasm2c-runner $< --homedir=.
mv hostcall_results.txt $(RESULTS_BASE)/sqlite/hostcalls.txt
mv syscall_results.txt $(RESULTS_BASE)/sqlite/syscalls.txt
run_all: run_sqlite run_lmbench