"vscode:/vscode.git/clone" did not exist on "79aa3fb1793c265c59d392e916baa851a55521c8"
Commit 4b9e4e14 authored by Antoine Kaufmann's avatar Antoine Kaufmann
Browse files

experiments: support for separate work and output directory

The work directory contains the unix sockets and shared memory regions,
while the output directory remains and contains just the logs. Need this
in our cluster where the output directory is on NFS.
parent 2beb20f1
......@@ -5,6 +5,8 @@ QEMU_CMD="$EHSIM_BASE/qemu/x86_64-softmmu/qemu-system-x86_64"
QEMU_IMG="$EHSIM_BASE/qemu/qemu-img"
GEM5_BASE="$EHSIM_BASE/gem5"
NS3_BASE="$EHSIM_BASE/ns-3"
OUTDIR_BASE="$EHSIM_BASE/experiments/out"
WORKDIR_BASE="$OUTDIR_BASE"
if [ -f local-config.sh ] ; then
source local-config.sh
......@@ -40,9 +42,10 @@ GEM5_KERNEL=$EHSIM_BASE/images/vmlinux
# Args:
# - experiment name
init_out() {
export OUTDIR=./out/$1/$2
rm -rf $OUTDIR
mkdir -p $OUTDIR
export OUTDIR=$OUTDIR_BASE/$1/$2
export WORKDIR=$WORKDIR_BASE/$1/$2
rm -rf $OUTDIR $WORKDIR
mkdir -p $OUTDIR $WORKDIR
date > $OUTDIR/starttime
}
......@@ -53,9 +56,9 @@ init_out() {
# - [optional primary image name: default ubuntu1804-base]
# - [optional: additinoal qemu arguments]
run_qemu() {
img_a="$OUTDIR/qemu.hd.a.$1"
img_b="$OUTDIR/qemu.hd.b.$1"
pcisock="$OUTDIR/pci.$2"
img_a="$WORKDIR/qemu.hd.a.$1"
img_b="$WORKDIR/qemu.hd.b.$1"
pcisock="$WORKDIR/pci.$2"
rm -f $img_a $img_b
echo Creating disk for qemu $1
if [ -z "$4" ]; then
......@@ -92,9 +95,9 @@ run_qemu() {
# - [optional primary image name: default ubuntu1804-base]
run_gem5() {
echo Starting gem5 $1
pcisock="$OUTDIR/pci.$2"
shm="$OUTDIR/shm.$2"
cpdir="$OUTDIR/../checkpoint/checkpoints.$5"
pcisock="$WORKDIR/pci.$2"
shm="$WORKDIR/shm.$2"
cpdir="$WORKDIR/../checkpoint/checkpoints.$5"
mkdir -p $cpdir
if [ -z "$7" ]; then
......@@ -128,7 +131,7 @@ run_gem5() {
run_corundum_verilator() {
echo Starting corundum_verilator $1
$EHSIM_BASE/corundum/corundum_verilator \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \
$WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/corundum_verilator.$1.log &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
......@@ -140,7 +143,7 @@ run_corundum_verilator() {
run_corundum_bm() {
echo Starting corundum_bm $1
$EHSIM_BASE/corundum_bm/corundum_bm \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \
$WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/corundum_bm.$1.log &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
......@@ -152,7 +155,7 @@ run_corundum_bm() {
run_i40e_bm() {
echo Starting i40e $1
$EHSIM_BASE/i40e_bm/i40e_bm \
$OUTDIR/pci.$1 $OUTDIR/eth.$1 $OUTDIR/shm.$1 \
$WORKDIR/pci.$1 $WORKDIR/eth.$1 $WORKDIR/shm.$1 \
&>$OUTDIR/i40e_bm.$1.log &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
......@@ -173,7 +176,7 @@ run_wire() {
fi
$EHSIM_BASE/net_wire/net_wire \
$OUTDIR/eth.$2 $OUTDIR/eth.$3 $pcap &>$OUTDIR/wire.$1.log &
$WORKDIR/eth.$2 $WORKDIR/eth.$3 $pcap &>$OUTDIR/wire.$1.log &
pid=$!
ALL_PIDS="$ALL_PIDS $pid"
return $pid
......@@ -185,7 +188,7 @@ run_wire() {
run_ns3_bridge() {
ports=""
for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`"
epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPort=$epath"
done
$NS3_BASE/cosim-run.sh cosim cosim-bridge-example \
......@@ -203,11 +206,11 @@ run_ns3_bridge() {
run_ns3_dumbbell() {
ports=""
for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`"
epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPortLeft=$epath"
done
for p in $3; do
epath="`readlink -f $OUTDIR/eth.$p`"
epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --CosimPortRight=$epath"
done
......@@ -226,11 +229,11 @@ run_ns3_dumbbell() {
run_ns3_sequencer() {
ports=""
for p in $2; do
epath="`readlink -f $OUTDIR/eth.$p`"
epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --ClientPort=$epath"
done
for p in $3; do
epath="`readlink -f $OUTDIR/eth.$p`"
epath="`readlink -f $WORKDIR/eth.$p`"
ports="$ports --ServerPort=$epath"
done
......@@ -251,7 +254,11 @@ cleanup() {
kill -KILL $p &>/dev/null
done
rm -f $OUTDIR/{qemu.hd.*,shm.*,pci.*,eth.*}
if [ "$OUTDIR" != "$WORKDIR" ]; then
rm -rf $WORKDIR
else
rm -f $WORKDIR/{qemu.hd.*,shm.*,pci.*,eth.*}
fi
date >>$OUTDIR/endtime
}
......
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