| 1 | #!/bin/bash |
| 2 | |
| 3 | ##################################################################### |
| 4 | # # |
| 5 | # Bench several versions of a Faust DSP program # |
| 6 | # using different compilation options # |
| 7 | # (c) Grame, 2020-2026 # |
| 8 | # # |
| 9 | ##################################################################### |
| 10 | |
| 11 | . faustpath |
| 12 | |
| 13 | FILES="" |
| 14 | IOS="0" |
| 15 | DOUBLE="0" |
| 16 | OPTIONS="" |
| 17 | LIBS="" |
| 18 | TESTS="all" |
| 19 | RUN=1 |
| 20 | BUFFER_SIZE=512 |
| 21 | CONTROL=false |
| 22 | OPT=-1 |
| 23 | NOTRACE=false |
| 24 | GENERIC=false |
| 25 | SOURCE=false |
| 26 | US="0" |
| 27 | DS="0" |
| 28 | FILTER="0" |
| 29 | CLANG="0" |
| 30 | |
| 31 | # Set default value for CXX |
| 32 | if [ "$CXX" = "" ]; then |
| 33 | CXX=g++ |
| 34 | fi |
| 35 | |
| 36 | if [ "$FAUST" = "" ]; then |
| 37 | FAUST=faust |
| 38 | fi |
| 39 | |
| 40 | while [ $1 ] |
| 41 | do |
| 42 | p=$1 |
| 43 | |
| 44 | if [ $p = "-help" ] || [ $p = "-h" ]; then |
| 45 | echo "faustbench [-notrace] [-control] [-generic] [-ios] [-single] [-fast] [-run <num>] [-bs <frames>] [-source] [-double] [-opt <level(0..3|-1)>] [-us <factor>] [-ds <factor>] [-filter <filter(0..4)>] [additional Faust options (-vec -vs 8...)] foo.dsp" |
| 46 | echo "Use '-notrace' to only generate the best compilation parameters" |
| 47 | echo "Use '-control' to update all controllers with random values at each cycle" |
| 48 | echo "Use '-generic' to compile for a generic processor, otherwise -march=native will be used" |
| 49 | echo "Use '-ios' to generate an iOS project" |
| 50 | echo "Use '-single' to only execute the one test (scalar by default)" |
| 51 | echo "Use '-fast' to only execute some tests" |
| 52 | echo "Use '-run <num>' to execute each test <num> times" |
| 53 | echo "Use '-bs <frames>' to set the buffer-size in frames" |
| 54 | echo "Use '-source' to keep the intermediate source folder and exit" |
| 55 | echo "Use '-double' to compile DSP in double and set FAUSTFLOAT to double" |
| 56 | echo "Use '-opt <level (0..3|-1)>' to pass an optimisation level to C++ (-1 means 'maximal level =-Ofast for now' but may change in the future)" |
| 57 | echo "Use '-us <factor>' to upsample the DSP by a factor" |
| 58 | echo "Use '-ds <factor>' to downsample the DSP by a factor" |
| 59 | echo "Use '-filter <filter>' for upsampling or downsampling [0..4]" |
| 60 | echo "" |
| 61 | echo "Use 'export CXX=/path/to/compiler' before running faustbench to change the C++ compiler" |
| 62 | echo "Use 'export CXXFLAGS=options' before running faustbench to change the C++ compiler options" |
| 63 | echo "Use 'export FAUST=/path/to/compiler' before running faustbench to change the faust compiler" |
| 64 | exit |
| 65 | fi |
| 66 | |
| 67 | if [ "$p" = "-ios" ]; then |
| 68 | IOS="1" |
| 69 | elif [ "$p" = "-notrace" ]; then |
| 70 | NOTRACE=true |
| 71 | elif [ "$p" = "-control" ]; then |
| 72 | CONTROL=true |
| 73 | elif [ "$p" = "-generic" ]; then |
| 74 | GENERIC=true |
| 75 | elif [ "$p" = "-fast" ]; then |
| 76 | TESTS="fast" |
| 77 | elif [ "$p" = "-single" ]; then |
| 78 | TESTS="single" |
| 79 | elif [ "$p" = "-run" ]; then |
| 80 | shift |
| 81 | RUN=$1 |
| 82 | elif [ "$p" = "-bs" ]; then |
| 83 | shift |
| 84 | BUFFER_SIZE=$1 |
| 85 | elif [ "$p" = "-source" ]; then |
| 86 | SOURCE=true |
| 87 | elif [ "$p" = "-opt" ]; then |
| 88 | shift |
| 89 | OPT=$1 |
| 90 | elif [ $p = "-us" ]; then |
| 91 | shift |
| 92 | US=$1 |
| 93 | elif [ $p = "-ds" ]; then |
| 94 | shift |
| 95 | DS=$1 |
| 96 | elif [ $p = "-filter" ]; then |
| 97 | shift |
| 98 | FILTER=$1 |
| 99 | elif [ "$p" = "-double" ]; then |
| 100 | DOUBLE="1" |
| 101 | OPTIONS="$OPTIONS $p" |
| 102 | elif [[ -f "$p" ]]; then |
| 103 | FILES="$FILES $p" |
| 104 | elif [ ${p:0:1} = "-" ]; then |
| 105 | OPTIONS="$OPTIONS $p" |
| 106 | else |
| 107 | OPTIONS="$OPTIONS $p" |
| 108 | fi |
| 109 | |
| 110 | shift |
| 111 | |
| 112 | done |
| 113 | |
| 114 | # Set default value for CXXFLAGS |
| 115 | if [ "$CXXFLAGS" = "" ]; then |
| 116 | if $GENERIC; then |
| 117 | if [ $OPT = -1 ]; then |
| 118 | CXXFLAGS="-Ofast" |
| 119 | else |
| 120 | CXXFLAGS="-O$OPT" |
| 121 | fi |
| 122 | else |
| 123 | if [ $OPT = -1 ]; then |
| 124 | # -march=native does not work yet on M1 |
| 125 | if [ $(uname) == Darwin ] && [ $(uname -p) == arm ]; then |
| 126 | CXXFLAGS="-Ofast" |
| 127 | else |
| 128 | CXXFLAGS="-Ofast -march=native" |
| 129 | fi |
| 130 | else |
| 131 | # -march=native does not work yet on M1 |
| 132 | if [ $(uname) == Darwin ] && [ $(uname -p) == arm ]; then |
| 133 | CXXFLAGS="-O$OPT" |
| 134 | else |
| 135 | CXXFLAGS="-O$OPT -march=native" |
| 136 | fi |
| 137 | fi |
| 138 | fi |
| 139 | fi |
| 140 | |
| 141 | if [[ $(uname) == Darwin ]]; then |
| 142 | LIBS=-lc++ |
| 143 | CXXFLAGS+=" -fbracket-depth=512" |
| 144 | fi |
| 145 | |
| 146 | if ! $NOTRACE ; then |
| 147 | echo "Selected compiler is $CXX with CXXFLAGS = $CXXFLAGS" |
| 148 | fi |
| 149 | |
| 150 | for p in $FILES; do |
| 151 | |
| 152 | CUR=$(pwd) |
| 153 | f=$(basename "$p") |
| 154 | SRCDIR=$(dirname "$p") |
| 155 | dspName="${f%.dsp}" |
| 156 | |
| 157 | # creates a temporary dir |
| 158 | TDR=$(mktemp -d faust.XXX) |
| 159 | TMP="$TDR/${f%.dsp}" |
| 160 | mkdir "$TMP" |
| 161 | |
| 162 | # creates and compile multiple DSP bench tool |
| 163 | if [ "$OPTIONS" != "" ]; then |
| 164 | if ! $NOTRACE ; then |
| 165 | echo "Compiled with additional options :$OPTIONS" |
| 166 | fi |
| 167 | fi |
| 168 | |
| 169 | if [ $TESTS == "all" ]; then |
| 170 | |
| 171 | $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" |
| 172 | $FAUST -cn dsp_scal_exp10 $OPTIONS -exp10 "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10.h" |
| 173 | $FAUST -cn dsp_scal_mcd0 $OPTIONS -mcd 0 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0.h" |
| 174 | $FAUST -cn dsp_scal_mcd2 $OPTIONS -mcd 2 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd2.h" |
| 175 | $FAUST -cn dsp_scal_mcd8 $OPTIONS -mcd 8 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8.h" |
| 176 | $FAUST -cn dsp_scal_mcd16 $OPTIONS -mcd 16 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd16.h" |
| 177 | $FAUST -cn dsp_scal_mcd32 $OPTIONS -mcd 32 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32.h" |
| 178 | $FAUST -cn dsp_scal_mcd64 $OPTIONS -mcd 64 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd64.h" |
| 179 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 180 | CLANG="1" |
| 181 | $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" |
| 182 | $FAUST -cn dsp_scal_exp10_clang $OPTIONS -exp10 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10_clang.h" |
| 183 | $FAUST -cn dsp_scal_mcd0_clang $OPTIONS -mcd 0 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0_clang.h" |
| 184 | $FAUST -cn dsp_scal_mcd2_clang $OPTIONS -mcd 2 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd2_clang.h" |
| 185 | $FAUST -cn dsp_scal_mcd8_clang $OPTIONS -mcd 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8_clang.h" |
| 186 | $FAUST -cn dsp_scal_mcd16_clang $OPTIONS -mcd 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd16_clang.h" |
| 187 | $FAUST -cn dsp_scal_mcd32_clang $OPTIONS -mcd 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32_clang.h" |
| 188 | $FAUST -cn dsp_scal_mcd64_clang $OPTIONS -mcd 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd64_clang.h" |
| 189 | fi |
| 190 | |
| 191 | $FAUST -cn dsp_vec0_4 $OPTIONS -vec -lv 0 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec0_4.h" |
| 192 | $FAUST -cn dsp_vec0_8 $OPTIONS -vec -lv 0 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec0_8.h" |
| 193 | $FAUST -cn dsp_vec0_16 $OPTIONS -vec -lv 0 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec0_16.h" |
| 194 | $FAUST -cn dsp_vec0_32 $OPTIONS -vec -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_32.h" |
| 195 | $FAUST -cn dsp_vec0_64 $OPTIONS -vec -lv 0 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec0_64.h" |
| 196 | $FAUST -cn dsp_vec0_128 $OPTIONS -vec -lv 0 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec0_128.h" |
| 197 | $FAUST -cn dsp_vec0_256 $OPTIONS -vec -lv 0 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec0_256.h" |
| 198 | $FAUST -cn dsp_vec0_512 $OPTIONS -vec -lv 0 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec0_512.h" |
| 199 | |
| 200 | $FAUST -cn dsp_vec0_fun_4 $OPTIONS -vec -fun -lv 0 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_4.h" |
| 201 | $FAUST -cn dsp_vec0_fun_8 $OPTIONS -vec -fun -lv 0 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_8.h" |
| 202 | $FAUST -cn dsp_vec0_fun_16 $OPTIONS -vec -fun -lv 0 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_16.h" |
| 203 | $FAUST -cn dsp_vec0_fun_32 $OPTIONS -vec -fun -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_32.h" |
| 204 | $FAUST -cn dsp_vec0_fun_64 $OPTIONS -vec -fun -lv 0 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_64.h" |
| 205 | $FAUST -cn dsp_vec0_fun_128 $OPTIONS -vec -fun -lv 0 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_128.h" |
| 206 | $FAUST -cn dsp_vec0_fun_256 $OPTIONS -vec -fun -lv 0 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_256.h" |
| 207 | $FAUST -cn dsp_vec0_fun_512 $OPTIONS -vec -fun -lv 0 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_512.h" |
| 208 | |
| 209 | $FAUST -cn dsp_vec0g_4 $OPTIONS -vec -lv 0 -vs 4 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_4.h" |
| 210 | $FAUST -cn dsp_vec0g_8 $OPTIONS -vec -lv 0 -vs 8 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_8.h" |
| 211 | $FAUST -cn dsp_vec0g_16 $OPTIONS -vec -lv 0 -vs 16 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_16.h" |
| 212 | $FAUST -cn dsp_vec0g_32 $OPTIONS -vec -lv 0 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32.h" |
| 213 | $FAUST -cn dsp_vec0g_64 $OPTIONS -vec -lv 0 -vs 64 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_64.h" |
| 214 | $FAUST -cn dsp_vec0g_128 $OPTIONS -vec -lv 0 -vs 128 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_128.h" |
| 215 | $FAUST -cn dsp_vec0g_256 $OPTIONS -vec -lv 0 -vs 256 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_256.h" |
| 216 | $FAUST -cn dsp_vec0g_512 $OPTIONS -vec -lv 0 -vs 512 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_512.h" |
| 217 | |
| 218 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 219 | CLANG="1" |
| 220 | $FAUST -cn dsp_vec0_4_clang $OPTIONS -vec -lv 0 -vs 4 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_4_clang.h" |
| 221 | $FAUST -cn dsp_vec0_8_clang $OPTIONS -vec -lv 0 -vs 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_8_clang.h" |
| 222 | $FAUST -cn dsp_vec0_16_clang $OPTIONS -vec -lv 0 -vs 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_16_clang.h" |
| 223 | $FAUST -cn dsp_vec0_32_clang $OPTIONS -vec -lv 0 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_32_clang.h" |
| 224 | $FAUST -cn dsp_vec0_64_clang $OPTIONS -vec -lv 0 -vs 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_64_clang.h" |
| 225 | $FAUST -cn dsp_vec0_128_clang $OPTIONS -vec -lv 0 -vs 128 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_128_clang.h" |
| 226 | $FAUST -cn dsp_vec0_256_clang $OPTIONS -vec -lv 0 -vs 256 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_256_clang.h" |
| 227 | $FAUST -cn dsp_vec0_512_clang $OPTIONS -vec -lv 0 -vs 512 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_512_clang.h" |
| 228 | |
| 229 | $FAUST -cn dsp_vec0_fun_4_clang $OPTIONS -vec -fun -lv 0 -vs 4 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_4_clang.h" |
| 230 | $FAUST -cn dsp_vec0_fun_8_clang $OPTIONS -vec -fun -lv 0 -vs 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_8_clang.h" |
| 231 | $FAUST -cn dsp_vec0_fun_16_clang $OPTIONS -vec -fun -lv 0 -vs 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_16_clang.h" |
| 232 | $FAUST -cn dsp_vec0_fun_32_clang $OPTIONS -vec -fun -lv 0 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_32_clang.h" |
| 233 | $FAUST -cn dsp_vec0_fun_64_clang $OPTIONS -vec -fun -lv 0 -vs 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_64_clang.h" |
| 234 | $FAUST -cn dsp_vec0_fun_128_clang $OPTIONS -vec -fun -lv 0 -vs 128 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_128_clang.h" |
| 235 | $FAUST -cn dsp_vec0_fun_256_clang $OPTIONS -vec -fun -lv 0 -vs 256 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_256_clang.h" |
| 236 | $FAUST -cn dsp_vec0_fun_512_clang $OPTIONS -vec -fun -lv 0 -vs 512 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_512_clang.h" |
| 237 | |
| 238 | $FAUST -cn dsp_vec0g_4_clang $OPTIONS -vec -lv 0 -vs 4 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_4_clang.h" |
| 239 | $FAUST -cn dsp_vec0g_8_clang $OPTIONS -vec -lv 0 -vs 8 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_8_clang.h" |
| 240 | $FAUST -cn dsp_vec0g_16_clang $OPTIONS -vec -lv 0 -vs 16 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_16_clang.h" |
| 241 | $FAUST -cn dsp_vec0g_32_clang $OPTIONS -vec -lv 0 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32_clang.h" |
| 242 | $FAUST -cn dsp_vec0g_64_clang $OPTIONS -vec -lv 0 -vs 64 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_64_clang.h" |
| 243 | $FAUST -cn dsp_vec0g_128_clang $OPTIONS -vec -lv 0 -vs 128 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_128_clang.h" |
| 244 | $FAUST -cn dsp_vec0g_256_clang $OPTIONS -vec -lv 0 -vs 256 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_256_clang.h" |
| 245 | $FAUST -cn dsp_vec0g_512_clang $OPTIONS -vec -lv 0 -vs 512 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_512_clang.h" |
| 246 | fi |
| 247 | |
| 248 | $FAUST -cn dsp_vec1_4 $OPTIONS -vec -lv 1 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec1_4.h" |
| 249 | $FAUST -cn dsp_vec1_8 $OPTIONS -vec -lv 1 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec1_8.h" |
| 250 | $FAUST -cn dsp_vec1_16 $OPTIONS -vec -lv 1 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec1_16.h" |
| 251 | $FAUST -cn dsp_vec1_32 $OPTIONS -vec -lv 1 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec1_32.h" |
| 252 | $FAUST -cn dsp_vec1_64 $OPTIONS -vec -lv 1 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec1_64.h" |
| 253 | $FAUST -cn dsp_vec1_128 $OPTIONS -vec -lv 1 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec1_128.h" |
| 254 | $FAUST -cn dsp_vec1_256 $OPTIONS -vec -lv 1 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec1_256.h" |
| 255 | $FAUST -cn dsp_vec1_512 $OPTIONS -vec -lv 1 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec1_512.h" |
| 256 | |
| 257 | $FAUST -cn dsp_vec1g_4 $OPTIONS -vec -lv 1 -vs 4 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_4.h" |
| 258 | $FAUST -cn dsp_vec1g_8 $OPTIONS -vec -lv 1 -vs 8 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_8.h" |
| 259 | $FAUST -cn dsp_vec1g_16 $OPTIONS -vec -lv 1 -vs 16 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_16.h" |
| 260 | $FAUST -cn dsp_vec1g_32 $OPTIONS -vec -lv 1 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32.h" |
| 261 | $FAUST -cn dsp_vec1g_64 $OPTIONS -vec -lv 1 -vs 64 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_64.h" |
| 262 | $FAUST -cn dsp_vec1g_128 $OPTIONS -vec -lv 1 -vs 128 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_128.h" |
| 263 | $FAUST -cn dsp_vec1g_256 $OPTIONS -vec -lv 1 -vs 256 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_256.h" |
| 264 | $FAUST -cn dsp_vec1g_512 $OPTIONS -vec -lv 1 -vs 512 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_512.h" |
| 265 | |
| 266 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 267 | CLANG="1" |
| 268 | $FAUST -cn dsp_vec1_4_clang $OPTIONS -vec -lv 1 -vs 4 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_4_clang.h" |
| 269 | $FAUST -cn dsp_vec1_8_clang $OPTIONS -vec -lv 1 -vs 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_8_clang.h" |
| 270 | $FAUST -cn dsp_vec1_16_clang $OPTIONS -vec -lv 1 -vs 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_16_clang.h" |
| 271 | $FAUST -cn dsp_vec1_32_clang $OPTIONS -vec -lv 1 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_32_clang.h" |
| 272 | $FAUST -cn dsp_vec1_64_clang $OPTIONS -vec -lv 1 -vs 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_64_clang.h" |
| 273 | $FAUST -cn dsp_vec1_128_clang $OPTIONS -vec -lv 1 -vs 128 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_128_clang.h" |
| 274 | $FAUST -cn dsp_vec1_256_clang $OPTIONS -vec -lv 1 -vs 256 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_256_clang.h" |
| 275 | $FAUST -cn dsp_vec1_512_clang $OPTIONS -vec -lv 1 -vs 512 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_512_clang.h" |
| 276 | |
| 277 | $FAUST -cn dsp_vec1g_4_clang $OPTIONS -vec -lv 1 -vs 4 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_4_clang.h" |
| 278 | $FAUST -cn dsp_vec1g_8_clang $OPTIONS -vec -lv 1 -vs 8 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_8_clang.h" |
| 279 | $FAUST -cn dsp_vec1g_16_clang $OPTIONS -vec -lv 1 -vs 16 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_16_clang.h" |
| 280 | $FAUST -cn dsp_vec1g_32_clang $OPTIONS -vec -lv 1 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32_clang.h" |
| 281 | $FAUST -cn dsp_vec1g_64_clang $OPTIONS -vec -lv 1 -vs 64 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_64_clang.h" |
| 282 | $FAUST -cn dsp_vec1g_128_clang $OPTIONS -vec -lv 1 -vs 128 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_128_clang.h" |
| 283 | $FAUST -cn dsp_vec1g_256_clang $OPTIONS -vec -lv 1 -vs 256 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_256_clang.h" |
| 284 | $FAUST -cn dsp_vec1g_512_clang $OPTIONS -vec -lv 1 -vs 512 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_512_clang.h" |
| 285 | fi |
| 286 | |
| 287 | elif [ $TESTS == "fast" ]; then |
| 288 | |
| 289 | $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" |
| 290 | $FAUST -cn dsp_scal_exp10 $OPTIONS -exp10 "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10.h" |
| 291 | $FAUST -cn dsp_scal_mcd0 $OPTIONS -mcd 0 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0.h" |
| 292 | $FAUST -cn dsp_scal_mcd8 $OPTIONS -mcd 8 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8.h" |
| 293 | $FAUST -cn dsp_scal_mcd32 $OPTIONS -mcd 32 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32.h" |
| 294 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 295 | CLANG="1" |
| 296 | $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" |
| 297 | $FAUST -cn dsp_scal_exp10_clang $OPTIONS -exp10 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10_clang.h" |
| 298 | $FAUST -cn dsp_scal_mcd0_clang $OPTIONS -mcd 0 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0_clang.h" |
| 299 | $FAUST -cn dsp_scal_mcd8_clang $OPTIONS -mcd 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8_clang.h" |
| 300 | $FAUST -cn dsp_scal_mcd32_clang $OPTIONS -mcd 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32_clang.h" |
| 301 | fi |
| 302 | $FAUST -cn dsp_vec0_32 $OPTIONS -vec -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_32.h" |
| 303 | $FAUST -cn dsp_vec0g_32 $OPTIONS -vec -lv 0 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32.h" |
| 304 | $FAUST -cn dsp_vec1_32 $OPTIONS -vec -lv 1 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec1_32.h" |
| 305 | $FAUST -cn dsp_vec1g_32 $OPTIONS -vec -lv 1 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32.h" |
| 306 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 307 | CLANG="1" |
| 308 | $FAUST -cn dsp_vec0_32_clang $OPTIONS -vec -lv 0 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_32_clang.h" |
| 309 | $FAUST -cn dsp_vec0g_32_clang $OPTIONS -vec -lv 0 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32_clang.h" |
| 310 | $FAUST -cn dsp_vec1_32_clang $OPTIONS -vec -lv 1 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_32_clang.h" |
| 311 | $FAUST -cn dsp_vec1g_32_clang $OPTIONS -vec -lv 1 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32_clang.h" |
| 312 | fi |
| 313 | |
| 314 | elif [ $TESTS == "single" ]; then |
| 315 | $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" |
| 316 | if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then |
| 317 | CLANG="1" |
| 318 | $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" |
| 319 | fi |
| 320 | fi |
| 321 | |
| 322 | if [ $IOS == "1" ]; then |
| 323 | echo "Files generated for iOS project in $TMP" |
| 324 | |
| 325 | # Create config file |
| 326 | echo -n >> "$TMP/Config.h" |
| 327 | |
| 328 | # float of double mode |
| 329 | if [ $DOUBLE == "1" ]; then |
| 330 | echo "#define FAUSTFLOAT double" >> "$TMP/Config.h" |
| 331 | else |
| 332 | echo "#define FAUSTFLOAT float" >> "$TMP/Config.h" |
| 333 | fi |
| 334 | # which tests to compile |
| 335 | if [ $TESTS == "all" ]; then |
| 336 | echo "#define ALL_TESTS" >> "$TMP/Config.h" |
| 337 | elif [ $TESTS == "fast" ]; then |
| 338 | echo "#define FAST_TESTS" >> "$TMP/Config.h" |
| 339 | elif [ $TESTS == "single" ]; then |
| 340 | echo "#define SINGLE_TESTS" >> "$TMP/Config.h" |
| 341 | fi |
| 342 | if [ $CLANG == "1" ]; then |
| 343 | echo "#define CLANG" >> "$TMP/Config.h" |
| 344 | fi |
| 345 | |
| 346 | # additional options |
| 347 | echo "#define OPTIONS string(\"$OPTIONS\")" >> "$TMP/Config.h" |
| 348 | # add info for UP/DS + filter adapter |
| 349 | echo "#define DOWN_SAMPLING $DS" >> "$TMP/Config.h" |
| 350 | echo "#define UP_SAMPLING $US" >> "$TMP/Config.h" |
| 351 | echo "#define FILTER_TYPE $FILTER" >> "$TMP/Config.h" |
| 352 | |
| 353 | cat "$TMP/Config.h" "$FAUSTLIB/faustbench.cpp" > "$TMP/faustbench.cpp" |
| 354 | cp -r $FAUSTLIB/iOS-bench/* $TMP |
| 355 | exit |
| 356 | fi |
| 357 | |
| 358 | cd "$TMP" |
| 359 | |
| 360 | # Create config file |
| 361 | echo -n >> Config |
| 362 | if [ $DOUBLE == "1" ]; then |
| 363 | echo "#define FAUSTFLOAT double" >> Config |
| 364 | else |
| 365 | echo "#define FAUSTFLOAT float" >> Config |
| 366 | fi |
| 367 | # additional options |
| 368 | if [ $CLANG == "1" ]; then |
| 369 | echo "#define CLANG" >> Config |
| 370 | fi |
| 371 | echo "#define OPTIONS string(\"$OPTIONS\")" >> Config |
| 372 | |
| 373 | # activate Config |
| 374 | cat Config "$FAUSTLIB/faustbench.cpp" > "faustbench.cpp" |
| 375 | |
| 376 | # keep sources |
| 377 | if $SOURCE ; then |
| 378 | # create Makefile |
| 379 | echo "$dspName:" > Makefile |
| 380 | echo -n -e '\t' >> Makefile |
| 381 | if [ $TESTS == "all" ]; then |
| 382 | echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DALL_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile |
| 383 | elif [ $TESTS == "fast" ]; then |
| 384 | echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DFAST_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile |
| 385 | elif [ $TESTS == "single" ]; then |
| 386 | echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DSINGLE_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile |
| 387 | fi |
| 388 | echo -e '\n' >> Makefile |
| 389 | echo "clean:" >> Makefile |
| 390 | echo -n -e '\t' >> Makefile |
| 391 | echo "rm $dspName" >> Makefile |
| 392 | |
| 393 | # copy and rename final folder |
| 394 | cd ../ |
| 395 | cp -R $dspName ../ |
| 396 | cd ../ |
| 397 | # cleanup |
| 398 | rm -rf $TDR |
| 399 | exit |
| 400 | else |
| 401 | # compile |
| 402 | if [ $TESTS == "all" ]; then |
| 403 | $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DALL_TESTS faustbench.cpp $LIBS -o $dspName |
| 404 | elif [ $TESTS == "fast" ]; then |
| 405 | $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DFAST_TESTS faustbench.cpp $LIBS -o $dspName |
| 406 | elif [ $TESTS == "single" ]; then |
| 407 | $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DSINGLE_TESTS faustbench.cpp $LIBS -o $dspName |
| 408 | fi |
| 409 | |
| 410 | # run bench |
| 411 | cd ../../ |
| 412 | if $NOTRACE; then |
| 413 | if $CONTROL; then |
| 414 | ./$TDR/$dspName/$dspName -notrace -control -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER |
| 415 | else |
| 416 | ./$TDR/$dspName/$dspName -notrace -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER |
| 417 | fi |
| 418 | else |
| 419 | if $CONTROL; then |
| 420 | ./$TDR/$dspName/$dspName -control -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER |
| 421 | else |
| 422 | ./$TDR/$dspName/$dspName -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER |
| 423 | fi |
| 424 | fi |
| 425 | |
| 426 | # cleanup |
| 427 | rm -rf $TDR |
| 428 | fi |
| 429 | |
| 430 | done |