3 # the value of these can be set in the environment.
4 # This test assumes a typical pdsh naming scheme, where
5 # node names can be expressed as a string
6 # forllowed by a number
7 # cluster name (all node names are this followed by the node number)
9 if [ -z "$cluster" ];then echo "cluster not defined"; exit 1; fi
11 # client node numbers (individual numbers or inclusive ranges)
12 clients=${clients:-""}
13 if [ -z "$clients" ]; then echo "clients not defined"; exit 1; fi
15 # numbers of clients to survey
16 clients_lo=${clients_lo:-1}
17 clients_hi=${clients_hi:-3}
18 clients_iterator=${clients_iterator:-"+=1"}
20 # numbers of tasks per client to survey
21 tasks_per_client_lo=${task_per_client_lo:-1}
22 tasks_per_client_hi=${tasks_per_client_hi:-8}
23 tasks_per_client_iterator=${tasks_per_client_iterator:-"*=2"}
25 # record sizes to survey
26 rsize_lo=${rsize_lo:-1M}
27 rsize_hi=${rsize_hi:-1M}
28 rsize_iterator=${rsize_iterator:-"*=2"}
30 ## which tests to run (first must be write)
31 # clear_cache) not really a test; just uncache everything
34 tests=(write rewrite clear_cache read reread)
36 # total # bytes written/read by any client node
37 min_per_client_size=${min_per_client_size:-"1G"}
38 min_total_size=${min_total_size:-"2G"}
40 # should each task do I/O to its own file?
41 file_per_task=${file_per_task:-1}
44 IOR=${IOR:-"/usr/local/sbin/IOR"}
45 llmount=${llmount:-"llmount"}
46 # Select mpirun, yod, or pdsh
47 fanout_cmd=${fanout_cmd:-"pdsh"}
48 # mpirun still uses pdsh for cleanup
50 pdsh_args="-R ssh -S -b -w "
52 # the result file prefix (date/time + hostname makes unique)
53 rslt_loc=${rslt_loc:-"/tmp"}
54 rslt=${rslt:-"$rslt_loc/ior_survey_`date +%F@%R`_`uname -n`"}
56 # where lustre is mounted on the clients
57 lustre=${lustre:-"/mnt/lustre"}
59 # basename of the test file(s)
60 testfile=${testfile:-"${lustre}/ior/ior_survey_testfile"}
62 #don't spin for MPI completions
63 export LIBELAN_WAITTYPE=0
65 ################################################################################
66 # dont change stuff below here unless you know what you're doing...
68 # This is to allow use of yod, pdsh, etc.
70 local clients=$1; shift
71 local tmpfile=$1; shift
75 $fanout_cmd $pdsh_args "$clients" "$@" >> $tmpfile 2>&1
80 # horrible misuse of globals
81 $fanout_cmd -np $((ntask*nclnt)) "$@" >> $tmpfile 2>&1
87 $fanout_cmd -np $((ntask*nclnt)) "$@" >> $tmpfile 2>&1
100 # we are assuming mpi uses will also have pdsh
101 local clients=$1;shift
102 local tmpfile=$1;shift
103 clear_cache='for LRU in /proc/fs/lustre/ldlm/namespaces/*/lru_size;
104 do sudo /bin/bash -c "echo clear > $LRU"; done'
105 echo "=> $clear_cache" >> $tmpfile
106 $pdsh $pdsh_args "$test_clients" "$clear_cache" >> $tmpfile 2>&1
108 echo "Completion Status: $status" >> $tmpfile
117 echo $1 | awk '{ nvals=split($1, vals, "-");\
118 if (nvals == 1) print 1;\
119 else if (nvals == 2) printf "%d\n", vals[2] - vals[1] + 1;}'
123 echo $1 | awk '{ split($1, vals, "-"); print vals[1]; }'
129 local range=$1; shift
130 if [ -z "$range" ]; then
133 chunk=`count_range $range`
134 if ((chunk > $n)); then
135 base=`base_range $range`
148 local range=$1; shift
149 if [ -z "$range" ]; then
152 local base=`base_range $range`
153 local chunk=`count_range $range`
154 if ((chunk > $n)); then chunk=$n; fi
155 local nodes="${nodes}${sep}${base}"; sep=","
156 if ((chunk > 1)); then nodes="${nodes}-$((base+chunk-1))"; fi
165 while ((radix > 0)); do
166 local nodes=`n2noderange $((n+radix)) $@`
167 if [ -n "$nodes" ]; then
178 *G|*g) n=`echo $str | sed 's/[gG]//'`; echo $((n*1024*1024*1024));;
179 *M|*m) n=`echo $str | sed 's/[Mm]//'`; echo $((n*1024*1024));;
180 *K|*k) n=`echo $str | sed 's/[Kk]//'`; echo $((n*1024));;
187 local G=$((1024*1024*1024))
188 local M=$((1024*1024))
190 if ((n%G == 0 && n >= $G)); then
192 elif ((n%M == 0 && n >= $M)); then
194 elif ((n%K == 0 && n >= $K)); then
201 if [ ${#tests[@]} -eq 0 -o "${tests[0]}" != "write" ]; then
202 echo "First test must be 'write'" 1>&2
206 rsltf="${rslt}.summary"
207 workf="${rslt}.detail"
212 if [ "$1" = "-n" ]; then
217 echo $minusn "$*" >> $rsltf
222 local lustre=$1; shift
224 local clients=$1; shift
225 local tmpfile=${tmpb}_tmp
226 # check lustre is mounted everywhere it's needed
227 cmd="grep $lustre /proc/mounts"
228 $pdsh $pdsh_args "$clients" "$cmd" >> $tmpfile
231 print_summary "Lustre NOT mounted on $lustre somewhere"
236 # convert params to actual numbers
237 min_per_client_size=`parse_number $min_per_client_size`
238 min_total_size=`parse_number $min_total_size`
240 rsize_lo=`parse_number $rsize_lo`
241 rsize_hi=`parse_number $rsize_hi`
243 # check on actual numbers of client nodes
244 nclients=`countnodes ${clients[@]}`
245 if ((clients_hi > $nclients)); then clients_hi=$nclients; fi
249 script_name=`echo $0 | cut -d "/" -f2`
251 echo "$cur_date $script_name on $lustre from $machine" >> $workf
253 for ((rsize=$rsize_lo; rsize<=$rsize_hi; rsize$rsize_iterator)); do
254 pp_rsize=`pp_number $rsize`
256 for ((nclnt=$clients_lo; nclnt<=$clients_hi; nclnt$clients_iterator)); do
257 test_clients="${cluster}`n2noderange $nclnt ${clients[@]}`"
259 if [ "$fanout_cmd" = "pdsh" ] || [ "$fanout_cmd" = "mpirun" ];then
260 check_mount $lustre $workf $test_clients
262 per_client_size=$((min_total_size/nclnt))
263 if ((per_client_size < $min_per_client_size)); then
264 per_client_size=$min_per_client_size
267 for ((ntask=$tasks_per_client_lo; ntask <= $tasks_per_client_hi; \
268 ntask$tasks_per_client_iterator)); do
269 per_task_size=$((per_client_size/ntask))
270 if ((per_task_size%rsize != 0)); then
271 per_task_size=$(((per_task_size/rsize + 1)*rsize))
273 total_size=`pp_number $((per_task_size*nclnt*ntask))`
275 hdrstr=`printf "Total: %5sB rsize: %4sB clients: %4d tasks: %3d: " \
276 $total_size $pp_rsize $nclnt $ntask`
277 print_summary -n "$hdrstr"
279 for ((test_idx=0; test_idx < ${#tests[@]}; test_idx++)); do
280 test=${tests[$test_idx]}
282 print_summary -n "$test "
283 echo "===========> ${hdrstr} on $test_clients doing $test" >> $workf
287 if [ "$test" = "clear_cache" ]; then
288 if [ "$fanout_cmd" = "pdsh" ] || [ "$fanout_cmd" = "mpirun" ]; then
289 result=`dump_cache $test_clients $tmpf`
291 echo "Haven't figured out how to clear cache" >> $tmpf
298 -o${testfile} # test file prefix
299 -b${per_task_size} # bytes per task
300 -t${rsize} # record size
301 -e # fsync before close
307 # keep the test file(s) unless this is the last test
308 #((test_idx < ${#tests[@]}-1)) && cmdline[$((idx++))]="-k"
309 cmdline[$((idx++))]="-k"
311 # use the existing test file(s) unless this is the first test
312 ((test_idx > 0)) && cmdline[$((idx++))]="-E"
315 (($file_per_task)) && cmdline[$((idx++))]="-F"
318 *write*) cmdline[$((idx++))]="-w"
320 *) cmdline[$((idx++))]="-r"
324 echo "=> ${cmdline[@]}" >> $tmpf
326 status=`fanout $test_clients $tmpf ${cmdline[@]}`
328 echo "Completion Status: $status" >> $tmpf
333 # pdsh adds an extra field
334 if [ "$fanout_cmd" = "pdsh" ]; then
335 result=`awk < $tmpf "/$awkstr/ {print $ 4; found=1; exit}\
336 END {if (!found) print \"ERROR\"}"`
338 result=`awk < $tmpf "/$awkstr/ {print $ 3; found=1; exit}\
339 END {if (!found) print \"ERROR\"}"`
347 str=`printf "%8s" "$result"`
348 print_summary -n "$str "