-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_dsa.sh
executable file
·163 lines (130 loc) · 2.74 KB
/
setup_dsa.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
#!/usr/bin/env bash
configure_shared_wq()
{
if [[ $# != 3 ]]; then
echo "Usage: ${FUNCNAME} dsa_id wq_id group_id"
exit
fi
local dsa_id=$1
local wq_id=$2
local group_id=$3
local wq_name="shared_queue${dsa_id}.${wq_id}"
local dsa="dsa${dsa_id}"
local wq="wq${dsa_id}.${wq_id}"
accel-config config-wq ${dsa}/${wq} --mode=shared --priority=10 --wq-size=16 --threshold=16 --block-on-fault=1 --type=user --name=${wq_name} --group-id=${group_id}
}
configure_engine()
{
if [[ $# != 3 ]]; then
echo "Usage: ${FUNCNAME} dsa_id engine_id group_id"
exit
fi
local dsa_id=$1
local engine_id=$2
local group_id=$3
local dsa="dsa${dsa_id}"
local engine="engine${dsa_id}.${engine_id}"
accel-config config-engine ${dsa}/${engine} --group-id=${group_id}
}
enable_device()
{
if [[ $# != 1 ]]; then
echo "Usage: ${FUNCNAME} dsa_id"
exit
fi
local dsa_id=$1
local dsa="dsa${dsa_id}"
accel-config enable-device ${dsa}
}
disable_device()
{
if [[ $# != 1 ]]; then
echo "Usage: ${FUNCNAME} dsa_id"
exit
fi
local dsa_id=$1
local dsa="dsa${dsa_id}"
accel-config disable-device ${dsa}
}
enable_wq()
{
if [[ $# != 2 ]]; then
echo "Usage: ${FUNCNAME} dsa_id wq_id"
exit
fi
local dsa_id=$1
local wq_id=$2
local dsa="dsa${dsa_id}"
local wq="wq${dsa_id}.${wq_id}"
accel-config enable-wq ${dsa}/${wq}
}
disable_wq()
{
if [[ $# != 2 ]]; then
echo "Usage: ${FUNCNAME} dsa_id wq_id"
exit
fi
local dsa_id=$1
local wq_id=$2
local dsa="dsa${dsa_id}"
local wq="wq${dsa_id}.${wq_id}"
accel-config disable-wq ${dsa}/${wq}
}
setup_dsa()
{
if [[ $# != 2 ]]; then
echo "Usage: ${FUNCNAME} from_dsa_id to_dsa_id"
exit
fi
local max_wq_id=7
local max_group_id=3
local max_engine_id=3
for dsa_id in $(seq $1 $2)
do
disable_device ${dsa_id}
for wq_id in $(seq 0 ${max_wq_id})
do
configure_shared_wq ${dsa_id} ${wq_id} $((${wq_id} % ${max_group_id}))
done
for engine_id in $(seq 0 ${max_engine_id})
do
configure_engine ${dsa_id} ${engine_id} $((${engine_id} % ${max_group_id}))
done
enable_device ${dsa_id}
for wq_id in $(seq 0 ${max_wq_id})
do
enable_wq ${dsa_id} ${wq_id}
done
done
}
# WQ 0
# disable_wq 0 1
# disable_wq 0 2
# disable_wq 0 3
# disable_wq 0 4
# disable_wq 0 5
# disable_wq 0 6
# disable_wq 0 7
# disable_device 0
# configure_shared_wq 0 0 0
# configure_shared_wq 0 1 1
# configure_shared_wq 0 2 2
# configure_shared_wq 0 3 3
# configure_shared_wq 0 4 0
# configure_shared_wq 0 5 1
# configure_shared_wq 0 6 2
# configure_shared_wq 0 7 3
# configure_engine 0 0 0
# configure_engine 0 1 1
# configure_engine 0 2 2
# configure_engine 0 3 3
# enable_device 0
# enable_wq 0 0
# enable_wq 0 1
# enable_wq 0 2
# enable_wq 0 3
# enable_wq 0 4
# enable_wq 0 5
# enable_wq 0 6
# enable_wq 0 7
setup_dsa 0 5