OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [script/] [server/] [Integration_test/] [run.sh] - Blame information for rev 56

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
#!/bin/bash
2
 
3 56 alirezamon
servers=( 'mn3' 'mn2' 'mn1' )
4
#servers' shorthand name. They should be defined in ~/.ssh/config :
5
#
6
#       Host your_short_name
7
#               HostName server.on.the.web
8
#               User user_to_user
9
 
10
 
11
 
12
 
13
 
14 48 alirezamon
#the max server load that is permited for runing the parallel test
15 56 alirezamon
max_allowed_server_load=24
16 48 alirezamon
 
17 56 alirezamon
 
18 48 alirezamon
SCRPT_FULL_PATH=$(realpath ${BASH_SOURCE[0]})
19
SCRPT_DIR_PATH=$(dirname $SCRPT_FULL_PATH)
20
 
21
 
22
 
23
 
24
 
25
#servers=( $server1 $server2 $server3 ) # an array which define the list of servers
26
my_server="to be selected"
27
SERVER_ROOT_DIR="~/pronoc_verify"
28
 
29 54 alirezamon
ProNoC="$SCRPT_DIR_PATH/../../.."
30 48 alirezamon
 
31
my_srcs=( "rtl"
32
    "Integration_test"
33
        "src_verilator"
34
        "src_c/netrace-1.0"
35 54 alirezamon
        "src_c/synfull"
36 48 alirezamon
        "script"
37
        "/perl_gui/lib/perl" )
38
 
39
 
40
 
41 54 alirezamon
# A POSIX variable
42
OPTIND=1         # Reset in case getopts has been used previously in the shell.
43 48 alirezamon
 
44 54 alirezamon
# Initialize our own variables:
45
paralel_run=20
46
MIN=2
47
MAX=80
48
STEP=4
49
dir="models"
50 48 alirezamon
 
51
 
52 54 alirezamon
 
53
models_path=$(realpath $ProNoC/Integration_test/synthetic_sim)
54
 
55
 
56
 
57
 
58
while getopts "h?p:u:l:s:d:m:" opt; do
59
  case "$opt" in
60
    h|\?)
61
      echo "./run [options]
62
 
63
      [options]
64
      -h show this help
65
      -p <int number>  : Enter the number of parallel simulations or
66
                         compilations. The default value is 4.
67
      -u <int number>  : Enter the maximum injection ratio in %. Default is 80
68
      -l <int number>  : Enter the minimum injection ratio in %. Default is 5
69
      -s <int number>  : Enter the injection step increase ratio in %.
70
                         Default value is 25.
71
      -d <dir name>    : The dir name where the simulation models configuration
72
                         files are located in. The default dir is \"models\"
73
      -m <simulation model name1,simulation model name2,...> : Enter the
74
                         simulation model name in simulation dir. If the
75
                         simulation model name  is not provided, it runs the
76
                         simulation for all existing models in model dir.
77
      "
78
 
79
        declare -a dirs
80
                i=1
81
                for d in $models_path/*/
82
                do
83
                        m=$(basename "${d%/}")
84 56 alirezamon
                        if [ $m != "src" ] &&  [ $m != "perl_lib" ]; then
85 54 alirezamon
                                dirs[i++]="$m"
86
                        fi
87
                done
88
                echo "  For -d option, there are ${#dirs[@]} dir names available:"
89
                for((i=1;i<=${#dirs[@]};i++))
90
                do
91
                        echo "          $i ${dirs[i]}"
92
                done
93
 
94
 
95
 
96
      exit 0
97
      ;;
98
    p) paralel_run=$OPTARG
99
      ;;
100
    u) MAX=$OPTARG
101
      ;;
102
    l) MIN=$OPTARG
103
      ;;
104
    s) STEP=$OPTARG
105
      ;;
106
    d) dir=$OPTARG
107
      ;;
108
    m) model="-m $OPTARG"
109
      ;;
110
  esac
111
done
112
 
113
shift $((OPTIND-1))
114
 
115
[ "${1:-}" = "--" ] && shift
116
 
117
echo "paralel_run=$paralel_run, MAX=$MAX, MIN=$MIN, STEP=$STEP, dir=$dir models=$model Leftovers: $@"
118
 
119
 
120
 
121
args="-p $paralel_run -u $MAX -l $MIN -s $STEP -d $dir $model"
122
 
123
 
124
 
125
report="${SCRPT_DIR_PATH}/reports/${dir}_report"
126
 
127
 
128
rm $report
129
 
130
 
131
 
132
 
133 48 alirezamon
#copy_sources
134
#login_in_server
135
 
136
#step one login in tje server and read the load
137
function get_server_avg_load {
138 54 alirezamon
        out=$(ssh -t -o "StrictHostKeyChecking no" $1  "uptime")
139 48 alirezamon
        load_avg=$(grep -oP '(?<=load average: )[0-9]+' <<< $out)
140
}
141
 
142
 
143
function select_a_server {
144
        min_load="100"
145
 
146
        for i in "${servers[@]}"; do
147
                        echo "get load average on $i server"
148
                        get_server_avg_load $i
149
                        echo $load_avg
150
                        if [ $min_load  -gt $load_avg ]
151
                        then
152
                                min_load=$load_avg
153
                                my_server=$i
154
                        fi
155
        done
156
        if [ $min_load -gt $max_allowed_server_load ]
157
        then
158
                echo "All servers are busy. Cannot continue"
159
                exit
160
        fi
161
        echo "server $my_server is selected for running the test"
162
}
163
 
164
 
165
function copy_sources {
166 54 alirezamon
        ssh  -o "StrictHostKeyChecking no" $my_server  rm -rf  ${SERVER_ROOT_DIR}
167
        ssh  -o "StrictHostKeyChecking no" $my_server  mkdir -p "${SERVER_ROOT_DIR}/mpsoc/perl_gui/lib/"
168
    ssh  -o "StrictHostKeyChecking no" $my_server  mkdir -p "${SERVER_ROOT_DIR}/mpsoc/src_c/"
169
        ssh  -o "StrictHostKeyChecking no" $my_server  mkdir -p "${SERVER_ROOT_DIR}/mpsoc_work"
170 48 alirezamon
        for i in "${my_srcs[@]}"; do
171
                echo "Copy $i  on the server"
172 54 alirezamon
                scp  -o "StrictHostKeyChecking no" -r "$ProNoC/$i"  "$my_server:${SERVER_ROOT_DIR}/mpsoc/$i"
173 48 alirezamon
        done
174 54 alirezamon
        scp  -o "StrictHostKeyChecking no" -r "$SCRPT_DIR_PATH/server_run.sh"  "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim/server_run.sh"
175 48 alirezamon
}
176
 
177
 
178
function run_test {
179
        cmd="export PRONOC_WORK=${SERVER_ROOT_DIR}/mpsoc_work;"
180 54 alirezamon
        ssh -t -o "StrictHostKeyChecking no" $my_server $cmd
181 48 alirezamon
 
182
}
183
 
184
#setps to run the verrification
185
 
186
#1
187
select_a_server
188
#2
189
copy_sources
190
#3 run the test
191
 
192 54 alirezamon
ssh  -o "StrictHostKeyChecking no" $my_server  "cd ${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim;  source \"/etc/profile\";  bash   server_run.sh $args;"
193 48 alirezamon
 
194
#collect the report
195 54 alirezamon
rm "$report"
196
scp  -o "StrictHostKeyChecking no" -r   "$my_server:${SERVER_ROOT_DIR}/mpsoc/Integration_test/synthetic_sim/report"  "$report"
197 48 alirezamon
wait
198 54 alirezamon
meld "$report" "${report}_old" &
199 48 alirezamon
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.