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 54

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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