Commit 3c4099b5 authored by Hejing Li's avatar Hejing Li
Browse files

common check point for replicated experiments

parent f2ea351c
...@@ -73,6 +73,16 @@ EXPERIMENTS := \ ...@@ -73,6 +73,16 @@ EXPERIMENTS := \
gem5-timing-corundum-verilator-pair-udp-100m \ gem5-timing-corundum-verilator-pair-udp-100m \
gem5-timing-corundum-verilator-pair-udp-150m \ gem5-timing-corundum-verilator-pair-udp-150m \
#experiments using check points
EXP_CP := \
gem5-timing-corundum-verilator-pair-cp \
#experiments not using check points
EXP_NCP := \
qemu-corundum-bm-pair \
qemu-corundum-bm-switched-1 \
# all experiments in repo # all experiments in repo
ALL_EXPERIMENTS := \ ALL_EXPERIMENTS := \
$(EXPERIMENTS) \ $(EXPERIMENTS) \
...@@ -96,6 +106,8 @@ OUTDIR := out ...@@ -96,6 +106,8 @@ OUTDIR := out
GUESTS_TARS := $(addprefix $(BUILDDIR)/,$(addsuffix .tar, $(GUESTS))) GUESTS_TARS := $(addprefix $(BUILDDIR)/,$(addsuffix .tar, $(GUESTS)))
EXPERIMENTS_READY := $(addprefix $(OUTDIR)/,$(addsuffix /ready,$(EXPERIMENTS))) EXPERIMENTS_READY := $(addprefix $(OUTDIR)/,$(addsuffix /ready,$(EXPERIMENTS)))
EXP_CP_READY := $(addprefix $(OUTDIR)/,$(addsuffix /ready,$(EXP_CP)))
EXP_NCP_READY := $(addprefix $(OUTDIR)/,$(addsuffix /ready,$(EXP_NCP)))
all: guest-tars experiments all: guest-tars experiments
...@@ -105,20 +117,43 @@ clean: ...@@ -105,20 +117,43 @@ clean:
####################################### #######################################
# Running experiments # Running experiments
REPLIDS := $(shell seq $(REPLICATION))
experiments-ncp: $(EXP_NCP_READY)
experiments-cp: $(EXP_CP_READY)
experiments: $(EXPERIMENTS_READY) experiments: $(EXPERIMENTS_READY)
define run_experiment_repl define run_ex_ncp_repl
$(OUTDIR)/%/$(1)/ready: experiments/%.sh $(GUESTS_TARS) $(OUTDIR)/$(1)/$(2)/ready: experiments/$(addsuffix .sh,$(1)) $(GUESTS_TARS)
bash $$< $(1) bash $$< $(2)
touch $$@ touch $$@
endef endef
REPLIDS := $(shell seq $(REPLICATION)) define run_ex_ncp
$(foreach i,$(REPLIDS),$(eval $(call run_ex_ncp_repl,$(1),$(i))))
$(OUTDIR)/$(1)/ready: experiments/$(addsuffix .sh,$(1)) $(addprefix $(OUTDIR)/$(1)/,$(addsuffix /ready,$(REPLIDS)))
touch $$@
endef
$(foreach i,$(REPLIDS), $(eval $(call run_experiment_repl,$(i)))) define run_ex_cp_repl
$(OUTDIR)/$(1)/$(2)/ready: experiments/$(addsuffix .sh,$(1)) $(OUTDIR)/$(1)/checkpoint/ready $(GUESTS_TARS)
bash $$< $(2)
touch $$@
endef
$(OUTDIR)/%/ready: experiments/%.sh $(addprefix $(OUTDIR)/%/,$(addsuffix /ready,$(REPLIDS))) define run_ex_cp
touch $@ $(foreach i,$(REPLIDS),$(eval $(call run_ex_cp_repl,$(1),$(i))))
$(OUTDIR)/$(1)/checkpoint/ready: experiments/$(addsuffix -mck.sh,$(1)) $(GUESTS_TARS)
bash $$<
touch $$@
$(OUTDIR)/$(1)/ready: experiments/$(addsuffix .sh,$(1)) $(addprefix $(OUTDIR)/$(1)/,$(addsuffix /ready,$(REPLIDS)))
touch $$@
endef
$(foreach sc, $(EXP_CP),$(eval $(call run_ex_cp,$(sc))))
$(foreach sc, $(EXP_NCP),$(eval $(call run_ex_ncp,$(sc))))
####################################### #######################################
# Guest Tars # Guest Tars
......
#!/bin/bash
source common-functions.sh
init_out gem5-timing-corundum-verilator-pair-cp checkpoint
# first run to checkpoint with fast CPU
run_corundum_verilator a
run_corundum_verilator b
sleep 2
run_wire ab a b
sleep 1
run_gem5 a a build/gem5-pair-server-cp.tar X86KvmCPU server
sleep 1
run_gem5 b b build/gem5-pair-client-cp.tar X86KvmCPU client
client_pid=$!
wait $client_pid
cleanup
echo "Took checkpoint successfully"
#!/bin/bash
source common-functions.sh
init_out gem5-timing-corundum-verilator-pair-cp $1
echo "Restoring from checkpoint"
# then run with timing CPU
run_corundum_verilator a_cp
run_corundum_verilator b_cp
sleep 2
run_wire ab_cp a_cp b_cp
sleep 1
run_gem5 a_cp a_cp build/gem5-pair-server-cp.tar TimingSimpleCPU server "-r 0 --cosim-sync"
sleep 1
run_gem5 b_cp b_cp build/gem5-pair-client-cp.tar TimingSimpleCPU client "-r 0 --cosim-sync"
client_pid=$!
wait $client_pid
cleanup
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment