source: doc/theses/colby_parsons_MMAth/benchmarks/actors/run @ b86d14c

ADTast-experimental
Last change on this file since b86d14c was 601bd9e, checked in by caparsons <caparson@…>, 15 months ago

added figures, code examples and more to thesis stuff. wrote many more pages on actors

  • Property mode set to 100644
File size: 7.4 KB
Line 
1#!/bin/bash -
2
3false=0; true=1
4
5# Usage: arch [ hostname ] returns hostname, cores, startcore
6#
7#   Define machine architecture based on starting socket, CPUs (cores) per socket, number of
8#   sockets, has hyperthreading.
9
10start=0
11
12arch() {
13        hostname=${1:-`hostname`}                       # return value
14        hashyper=${true}                                        # assume machine has hyperthreads
15        if [ "${hostname}" = "plg2" ] ; then
16                startsocket=${start}
17                cps=16                                                  # coresPerSocket
18                sockets=2
19                hashyper=${false}                               # has no hyperthreads
20        elif [ "${hostname}" = "nasus" ] ; then
21                startsocket=${start}
22                cps=64                                                  # coresPerSocket
23                sockets=2
24        elif [ "${hostname}" = "pyke" ] ; then
25                startsocket=${start}
26                cps=24                                                  # coresPerSocket
27                sockets=2
28        elif [ "${hostname}" = "jax" ] ; then
29                startsocket=${start}
30                cps=24                                                  # coresPerSocket
31                sockets=4
32        else
33                echo "unsupported host" ${hostname}
34                exit 1
35        fi
36        cores=$(( ${cps} * ${sockets} ))
37        startcore=$(( ${startsocket} * ${cps} ))
38}
39
40# Usage: affinity (global cps, sockets, startsocket, hashyper, cores, startcore, wrap)
41#   returns taskset argument
42#
43#   This routine assumes hyperthreading has only 2 hyperthreads per core.
44#
45#   If hyperthread scanning is used: processor units are assigned across the low-number hyperthreads
46#   of the socket's cores. When the low-number hyperthreads are filled, the high-number hyperhtreads
47#   are assigned across the socket's cores. Then the next socket is assigned.
48#
49#   If hyperthread wrapping is used: processor units are assigned in low/high-number pairs of
50#   hyperthreads across the socket's cores. Then the next socket is assigned.
51
52wrap=${false}                                                   # set to control hyperthread assignment across socket cores
53
54affinity() {
55        if [ ${wrap} -eq ${true} -a ${hashyper} -eq ${false} ] ; then
56                echo "architecture does not support hyperthreading for wrapping"
57                exit 1
58        fi
59        taskset=""                                                      # return value
60        set -- $(( ${1} - 1 ))                          # decrement $1
61        if [ ${1} -eq 0 ] ; then taskset="${startcore}-${startcore}"; return; fi
62        if [ ${1} -ge $(( ${cps} * ( ${sockets} - ${startsocket} ) * ( ${hashyper} + 1 ) )) ] ; then # error
63                echo "not enough cores $(( ${cores} * ${sockets} )) for $(( ${1} + 1 )) starting at ${startcore}"
64                exit 1
65        fi
66        if [ ${hashyper} -eq ${false} ] ; then taskset="${startcore}-$(( ${1} + ${startcore} ))"; return; fi # no hyperthreads
67        start2=$(( ${startcore} + ${cores} ))
68        if [ ${wrap} -eq ${true} ] ; then       # hyperthread wrapping
69                end1=$(( ${1} / 2 + ${startcore} ))
70                end2=$(( ${end1} + ${cores} ))
71                if [ $(( ${1} % 2 )) -eq 0 ] ; then
72                        end2=$(( ${end2} - 1 ))
73                fi
74                taskset="${startcore}-${end1},${start2}-${end2}"
75        else                                                            # hyperthread scanning
76                if [ ${1} -lt ${cps} ] ; then taskset="${startcore}-$(( ${1} + ${startcore} ))"; return; fi
77                filled=$(( ${1} / ( ${cps} * 2 ) * ${cps} ))
78                modulus=$(( ${1} % ( ${cps} * 2 ) ))    # leftover cores added to saturated sockets
79                if [ ${modulus} -gt ${cps} ] ; then
80                        taskset="${startcore}-$(( ${startcore} + ${filled} + ${cps} - 1 )),${start2}-$(( ${start2} + ${filled} + ${modulus} % ${cps} ))"
81                else
82                        taskset="${startcore}-$(( ${startcore} + ${filled} + ${modulus} )),${start2}-$(( ${start2} + ${filled} - 1 ))"
83                fi
84        fi
85}
86
87numtimes=5
88
89# bench_cores='1 2 4 8 16 24 32'
90bench_cores='8 16 24 32 48'
91# bench_cores='32'
92
93# toggle benchmarks
94executor=${true}
95matrix=${true}
96repeat=${true}
97balance=${true}
98static=${false}
99dynamic=${false}
100
101# executor config
102batch='1'
103nRounds='500'
104
105# matrix config
106size='3000'
107
108# repeat config
109messages='100000'
110n_repeats='100'
111
112# balance config
113nOneRounds='2000'
114nMultiRounds='800'
115
116# static config
117n_static_sends='10000000'
118
119# dynamic config
120n_dynamic_sends='10000000'
121
122# names=('NOSTEAL' 'CLOSE' 'SEARCH')
123# var_flags=('-D__STEAL=1 -DRAND=1' '-D__STEAL=1 -DCLOSE=1' '-D__STEAL=1 -DSEARCH=1')
124
125names=('SEARCH')
126var_flags=('-D__STEAL=1 -DSEARCH=1')
127
128
129# names=('NOSTEAL' 'SEARCH' 'RAND' 'SEARCHC' 'RANDC')
130# var_flags=('' '-D__STEAL=1 -DSEARCH=1' '-D__STEAL=1 -DRAND=1' '-D__STEAL=1 -DSEARCH=1 -DCYCLE' '-D__STEAL=1 -DRAND=1 -DCYCLE')
131
132# names=('NOSTEAL' 'RAND' 'CLOSE' 'SEARCH')
133# var_flags=('' '-D__STEAL=1 -DRAND=1' '-D__STEAL=1 -DCLOSE=1' '-D__STEAL=1 -DSEARCH=1')
134
135cfa_flags='-quiet -O3 -nodebug -DNDEBUG'
136
137cfa=~/cfa-cc/driver/cfa
138
139preprint=''
140repeat_command() {
141    t=1
142    while [ ${t} -le ${numtimes} ] ; do
143        echo -n -e ${preprint}
144        "${@}"
145        t=`expr ${t} + 1`
146    done
147}
148
149arch nasus
150
151echo $numtimes
152echo $bench_cores
153
154for i in ${!names[@]}; do
155        echo -n ${names[$i]}" "
156done
157echo ""
158
159# /usr/bin/time -f "%Uu %Ss %Er %Mkb"
160
161if [ ${executor} -eq ${true} ] ; then
162    echo "executor"
163    for i in ${!names[@]}; do
164        echo ${names[$i]}':'
165        echo -e "proc\ttime (s)"
166        ${cfa} ${cfa_flags} ${var_flags[$i]} executor.cfa > /dev/null 2>&1
167        for p in ${bench_cores} ; do
168            affinity ${p}
169            # echo "taskset -c ${startcore}-`expr ${startcore} + ${p} - 1` ./a.out 40000 100 ${nRounds} ${p} ${batch}"
170            preprint="${p}\t"
171            repeat_command taskset -c ${taskset} ./a.out 40000 100 ${nRounds} ${p} ${batch}
172        done
173        rm a.out
174    done
175    echo ""
176fi
177
178if [ ${matrix} -eq ${true} ] ; then
179    echo "matrix"
180    for i in ${!names[@]}; do
181        echo ${names[$i]}
182        echo -e "proc\ttime (s)"
183        ${cfa} ${cfa_flags} ${var_flags[$i]} matrix.cfa > /dev/null 2>&1
184        for p in ${bench_cores} ; do
185            affinity ${p}
186            preprint="${p}\t"
187            repeat_command taskset -c ${taskset} ./a.out ${size} ${size} ${size} ${p}
188        done
189        rm a.out
190    done
191    echo ""
192fi
193
194if [ ${repeat} -eq ${true} ] ; then
195    echo "repeat"
196    echo -e "proc\ttime (s)"
197    for i in ${!names[@]}; do
198        echo ${names[$i]}
199        ${cfa} ${cfa_flags} ${var_flags[$i]} repeat.cfa > /dev/null 2>&1
200        for p in ${bench_cores} ; do 
201            affinity ${p}
202            preprint="${p}\t"
203            repeat_command taskset -c ${taskset} ./a.out ${messages} ${p} 256 ${n_repeats}
204        done
205        rm a.out
206    done
207    echo ""
208fi
209
210
211if [ ${static} -eq ${true} ] ; then
212    echo "static"
213        for i in ${!names[@]}; do
214            echo ${names[$i]}
215            ${cfa} ${cfa_flags} ${var_flags[$i]} static.cfa > /dev/null 2>&1
216            repeat_command taskset -c ${startcore} ./a.out ${n_static_sends}
217            rm a.out
218        done
219    echo ""
220fi
221
222if [ ${dynamic} -eq ${true} ] ; then
223    echo "dynamic"
224        for i in ${!names[@]}; do
225            echo ${names[$i]}
226            ${cfa} ${cfa_flags} ${var_flags[$i]} dynamic.cfa > /dev/null 2>&1
227            repeat_command taskset -c ${startcore} ./a.out ${n_dynamic_sends}
228        done
229    echo ""
230fi
231
232
233if [ ${balance} -eq ${true} ] ; then
234    echo "balance_one"
235    for i in ${!names[@]}; do
236        echo ${names[$i]}':'
237        echo -e "proc\ttime (s)"
238        ${cfa} ${cfa_flags} ${var_flags[$i]} balance.cfa > /dev/null 2>&1
239        for p in ${bench_cores} ; do 
240            affinity ${p}
241            preprint="${p}\t"
242            repeat_command taskset -c ${taskset} ./a.out 32 32 ${nOneRounds} ${p}
243        done
244        rm a.out
245    done
246    echo ""
247    echo "balance_multi"
248    for i in ${!names[@]}; do
249        echo ${names[$i]}':'
250        echo -e "proc\ttime (s)"
251        ${cfa} ${cfa_flags} ${var_flags[$i]} -DMULTI balance.cfa > /dev/null 2>&1
252        for p in ${bench_cores} ; do 
253            affinity ${p}
254            preprint="${p}\t"
255            repeat_command taskset -c ${taskset} ./a.out 32 32 ${nMultiRounds} ${p}
256        done
257        rm a.out
258    done
259    echo ""
260fi
261
Note: See TracBrowser for help on using the repository browser.