ns3-dctcp.sh 2.68 KB
Newer Older
1
#!/bin/bash
Antoine Kaufmann's avatar
Antoine Kaufmann committed
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Copyright 2021 Max Planck Institute for Software Systems, and
# National University of Singapore
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

24

Hejing Li's avatar
Hejing Li committed
25
26
##### build dctcp-cwnd-devred.cc example in ns-3
##### cp cp examples/tcp/dctcp-cwnd-devred.cc scratch/
Hejing Li's avatar
Hejing Li committed
27
28
29
30
31
##### ./waf

##### ./ns3-dctcp.sh [num_core] 


32
EHSIM_BASE="$(readlink -f $(dirname ${BASH_SOURCE[0]})/../..)"
33
NS3_BASE="$EHSIM_BASE/sims/external/ns-3"
Hejing Li's avatar
Hejing Li committed
34
OUTDIR_BASE="$EHSIM_BASE/experiments/pyexps"
35
36
37

cd $NS3_BASE
k_start=0
38
k_end=199680
39
#k_step=2080
Hejing Li's avatar
Hejing Li committed
40
#k_end=199680
Hejing Li's avatar
Hejing Li committed
41
42
#k_step=8320
k_step=16640
Hejing Li's avatar
Hejing Li committed
43
#mtus="1500 4000 9000"
44
mtus="4000"
Hejing Li's avatar
Hejing Li committed
45
46
47
# link latency corresponds to RTT latency 1us 10us 100us 200us
#latencies="167ns 1670ns 16us 33us"
latencies="50us"
48
49
50
51
52
53
54
cores=$1

echo $cores

proc=0
pids=""

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cleanup() {
    echo Cleaning up
    for p in $pids ; do
        kill $p &>/dev/null
    done

    sleep 1
    for p in $pids ; do
        kill -KILL $p &>/dev/null
    done

}

sighandler() {
    echo "Caught Interrupt, aborting...."
    cleanup
    exit 1
}


75
trap "sighandler" SIGINT
76

Hejing Li's avatar
Hejing Li committed
77
#for k in $(seq $k_start $k_step $k_end)
78
for lat in $latencies
79
do
80
    for m in $mtus
81
    do
82
83
84
85
86
        #echo $k
        #for m in 1500 4000 9000 # MTU size
        for k in $(seq $k_start $k_step $k_end)
        do
            echo "latency: $lat MtU: $m  K: $k  "
Marvin Meiers's avatar
Marvin Meiers committed
87
            ./simbricks-run.sh dctcp-cwnd-devred --EcnTh=$k --mtu=$m --LinkLatency=$lat &
88
89
90
91
92
93
94
95
96
97
98
99
100
            pid=$!
            pids="$pids $pid"
            proc=$(($proc + 1))
            
            if [ $proc -eq $cores ]; then
                for p in $pids; do
                    wait $p
                done
                proc=0
                pids=""

            fi
        done
101
102
103
    done
done

104
105
106
107
for p in $pids; do
    wait $p
done