#!/bin/bash ##################################################################### # # # Bench several versions of a Faust DSP program # # using different compilation options # # (c) Grame, 2020-2026 # # # ##################################################################### . faustpath FILES="" IOS="0" DOUBLE="0" OPTIONS="" LIBS="" TESTS="all" RUN=1 BUFFER_SIZE=512 CONTROL=false OPT=-1 NOTRACE=false GENERIC=false SOURCE=false US="0" DS="0" FILTER="0" CLANG="0" # Set default value for CXX if [ "$CXX" = "" ]; then CXX=g++ fi if [ "$FAUST" = "" ]; then FAUST=faust fi while [ $1 ] do p=$1 if [ $p = "-help" ] || [ $p = "-h" ]; then echo "faustbench [-notrace] [-control] [-generic] [-ios] [-single] [-fast] [-run ] [-bs ] [-source] [-double] [-opt ] [-us ] [-ds ] [-filter ] [additional Faust options (-vec -vs 8...)] foo.dsp" echo "Use '-notrace' to only generate the best compilation parameters" echo "Use '-control' to update all controllers with random values at each cycle" echo "Use '-generic' to compile for a generic processor, otherwise -march=native will be used" echo "Use '-ios' to generate an iOS project" echo "Use '-single' to only execute the one test (scalar by default)" echo "Use '-fast' to only execute some tests" echo "Use '-run ' to execute each test times" echo "Use '-bs ' to set the buffer-size in frames" echo "Use '-source' to keep the intermediate source folder and exit" echo "Use '-double' to compile DSP in double and set FAUSTFLOAT to double" echo "Use '-opt ' to pass an optimisation level to C++ (-1 means 'maximal level =-Ofast for now' but may change in the future)" echo "Use '-us ' to upsample the DSP by a factor" echo "Use '-ds ' to downsample the DSP by a factor" echo "Use '-filter ' for upsampling or downsampling [0..4]" echo "" echo "Use 'export CXX=/path/to/compiler' before running faustbench to change the C++ compiler" echo "Use 'export CXXFLAGS=options' before running faustbench to change the C++ compiler options" echo "Use 'export FAUST=/path/to/compiler' before running faustbench to change the faust compiler" exit fi if [ "$p" = "-ios" ]; then IOS="1" elif [ "$p" = "-notrace" ]; then NOTRACE=true elif [ "$p" = "-control" ]; then CONTROL=true elif [ "$p" = "-generic" ]; then GENERIC=true elif [ "$p" = "-fast" ]; then TESTS="fast" elif [ "$p" = "-single" ]; then TESTS="single" elif [ "$p" = "-run" ]; then shift RUN=$1 elif [ "$p" = "-bs" ]; then shift BUFFER_SIZE=$1 elif [ "$p" = "-source" ]; then SOURCE=true elif [ "$p" = "-opt" ]; then shift OPT=$1 elif [ $p = "-us" ]; then shift US=$1 elif [ $p = "-ds" ]; then shift DS=$1 elif [ $p = "-filter" ]; then shift FILTER=$1 elif [ "$p" = "-double" ]; then DOUBLE="1" OPTIONS="$OPTIONS $p" elif [[ -f "$p" ]]; then FILES="$FILES $p" elif [ ${p:0:1} = "-" ]; then OPTIONS="$OPTIONS $p" else OPTIONS="$OPTIONS $p" fi shift done # Set default value for CXXFLAGS if [ "$CXXFLAGS" = "" ]; then if $GENERIC; then if [ $OPT = -1 ]; then CXXFLAGS="-Ofast" else CXXFLAGS="-O$OPT" fi else if [ $OPT = -1 ]; then # -march=native does not work yet on M1 if [ $(uname) == Darwin ] && [ $(uname -p) == arm ]; then CXXFLAGS="-Ofast" else CXXFLAGS="-Ofast -march=native" fi else # -march=native does not work yet on M1 if [ $(uname) == Darwin ] && [ $(uname -p) == arm ]; then CXXFLAGS="-O$OPT" else CXXFLAGS="-O$OPT -march=native" fi fi fi fi if [[ $(uname) == Darwin ]]; then LIBS=-lc++ CXXFLAGS+=" -fbracket-depth=512" fi if ! $NOTRACE ; then echo "Selected compiler is $CXX with CXXFLAGS = $CXXFLAGS" fi for p in $FILES; do CUR=$(pwd) f=$(basename "$p") SRCDIR=$(dirname "$p") dspName="${f%.dsp}" # creates a temporary dir TDR=$(mktemp -d faust.XXX) TMP="$TDR/${f%.dsp}" mkdir "$TMP" # creates and compile multiple DSP bench tool if [ "$OPTIONS" != "" ]; then if ! $NOTRACE ; then echo "Compiled with additional options :$OPTIONS" fi fi if [ $TESTS == "all" ]; then $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" $FAUST -cn dsp_scal_exp10 $OPTIONS -exp10 "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10.h" $FAUST -cn dsp_scal_mcd0 $OPTIONS -mcd 0 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0.h" $FAUST -cn dsp_scal_mcd2 $OPTIONS -mcd 2 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd2.h" $FAUST -cn dsp_scal_mcd8 $OPTIONS -mcd 8 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8.h" $FAUST -cn dsp_scal_mcd16 $OPTIONS -mcd 16 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd16.h" $FAUST -cn dsp_scal_mcd32 $OPTIONS -mcd 32 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32.h" $FAUST -cn dsp_scal_mcd64 $OPTIONS -mcd 64 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd64.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" $FAUST -cn dsp_scal_exp10_clang $OPTIONS -exp10 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10_clang.h" $FAUST -cn dsp_scal_mcd0_clang $OPTIONS -mcd 0 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0_clang.h" $FAUST -cn dsp_scal_mcd2_clang $OPTIONS -mcd 2 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd2_clang.h" $FAUST -cn dsp_scal_mcd8_clang $OPTIONS -mcd 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8_clang.h" $FAUST -cn dsp_scal_mcd16_clang $OPTIONS -mcd 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd16_clang.h" $FAUST -cn dsp_scal_mcd32_clang $OPTIONS -mcd 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32_clang.h" $FAUST -cn dsp_scal_mcd64_clang $OPTIONS -mcd 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd64_clang.h" fi $FAUST -cn dsp_vec0_4 $OPTIONS -vec -lv 0 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec0_4.h" $FAUST -cn dsp_vec0_8 $OPTIONS -vec -lv 0 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec0_8.h" $FAUST -cn dsp_vec0_16 $OPTIONS -vec -lv 0 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec0_16.h" $FAUST -cn dsp_vec0_32 $OPTIONS -vec -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_32.h" $FAUST -cn dsp_vec0_64 $OPTIONS -vec -lv 0 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec0_64.h" $FAUST -cn dsp_vec0_128 $OPTIONS -vec -lv 0 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec0_128.h" $FAUST -cn dsp_vec0_256 $OPTIONS -vec -lv 0 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec0_256.h" $FAUST -cn dsp_vec0_512 $OPTIONS -vec -lv 0 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec0_512.h" $FAUST -cn dsp_vec0_fun_4 $OPTIONS -vec -fun -lv 0 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_4.h" $FAUST -cn dsp_vec0_fun_8 $OPTIONS -vec -fun -lv 0 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_8.h" $FAUST -cn dsp_vec0_fun_16 $OPTIONS -vec -fun -lv 0 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_16.h" $FAUST -cn dsp_vec0_fun_32 $OPTIONS -vec -fun -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_32.h" $FAUST -cn dsp_vec0_fun_64 $OPTIONS -vec -fun -lv 0 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_64.h" $FAUST -cn dsp_vec0_fun_128 $OPTIONS -vec -fun -lv 0 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_128.h" $FAUST -cn dsp_vec0_fun_256 $OPTIONS -vec -fun -lv 0 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_256.h" $FAUST -cn dsp_vec0_fun_512 $OPTIONS -vec -fun -lv 0 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec0_fun_512.h" $FAUST -cn dsp_vec0g_4 $OPTIONS -vec -lv 0 -vs 4 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_4.h" $FAUST -cn dsp_vec0g_8 $OPTIONS -vec -lv 0 -vs 8 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_8.h" $FAUST -cn dsp_vec0g_16 $OPTIONS -vec -lv 0 -vs 16 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_16.h" $FAUST -cn dsp_vec0g_32 $OPTIONS -vec -lv 0 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32.h" $FAUST -cn dsp_vec0g_64 $OPTIONS -vec -lv 0 -vs 64 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_64.h" $FAUST -cn dsp_vec0g_128 $OPTIONS -vec -lv 0 -vs 128 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_128.h" $FAUST -cn dsp_vec0g_256 $OPTIONS -vec -lv 0 -vs 256 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_256.h" $FAUST -cn dsp_vec0g_512 $OPTIONS -vec -lv 0 -vs 512 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_512.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_vec0_4_clang $OPTIONS -vec -lv 0 -vs 4 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_4_clang.h" $FAUST -cn dsp_vec0_8_clang $OPTIONS -vec -lv 0 -vs 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_8_clang.h" $FAUST -cn dsp_vec0_16_clang $OPTIONS -vec -lv 0 -vs 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_16_clang.h" $FAUST -cn dsp_vec0_32_clang $OPTIONS -vec -lv 0 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_32_clang.h" $FAUST -cn dsp_vec0_64_clang $OPTIONS -vec -lv 0 -vs 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_64_clang.h" $FAUST -cn dsp_vec0_128_clang $OPTIONS -vec -lv 0 -vs 128 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_128_clang.h" $FAUST -cn dsp_vec0_256_clang $OPTIONS -vec -lv 0 -vs 256 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_256_clang.h" $FAUST -cn dsp_vec0_512_clang $OPTIONS -vec -lv 0 -vs 512 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_512_clang.h" $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" $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" $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" $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" $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" $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" $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" $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" $FAUST -cn dsp_vec0g_4_clang $OPTIONS -vec -lv 0 -vs 4 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_4_clang.h" $FAUST -cn dsp_vec0g_8_clang $OPTIONS -vec -lv 0 -vs 8 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_8_clang.h" $FAUST -cn dsp_vec0g_16_clang $OPTIONS -vec -lv 0 -vs 16 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_16_clang.h" $FAUST -cn dsp_vec0g_32_clang $OPTIONS -vec -lv 0 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32_clang.h" $FAUST -cn dsp_vec0g_64_clang $OPTIONS -vec -lv 0 -vs 64 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_64_clang.h" $FAUST -cn dsp_vec0g_128_clang $OPTIONS -vec -lv 0 -vs 128 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_128_clang.h" $FAUST -cn dsp_vec0g_256_clang $OPTIONS -vec -lv 0 -vs 256 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_256_clang.h" $FAUST -cn dsp_vec0g_512_clang $OPTIONS -vec -lv 0 -vs 512 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_512_clang.h" fi $FAUST -cn dsp_vec1_4 $OPTIONS -vec -lv 1 -vs 4 "$SRCDIR/$f" -o "$TMP/dsp_vec1_4.h" $FAUST -cn dsp_vec1_8 $OPTIONS -vec -lv 1 -vs 8 "$SRCDIR/$f" -o "$TMP/dsp_vec1_8.h" $FAUST -cn dsp_vec1_16 $OPTIONS -vec -lv 1 -vs 16 "$SRCDIR/$f" -o "$TMP/dsp_vec1_16.h" $FAUST -cn dsp_vec1_32 $OPTIONS -vec -lv 1 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec1_32.h" $FAUST -cn dsp_vec1_64 $OPTIONS -vec -lv 1 -vs 64 "$SRCDIR/$f" -o "$TMP/dsp_vec1_64.h" $FAUST -cn dsp_vec1_128 $OPTIONS -vec -lv 1 -vs 128 "$SRCDIR/$f" -o "$TMP/dsp_vec1_128.h" $FAUST -cn dsp_vec1_256 $OPTIONS -vec -lv 1 -vs 256 "$SRCDIR/$f" -o "$TMP/dsp_vec1_256.h" $FAUST -cn dsp_vec1_512 $OPTIONS -vec -lv 1 -vs 512 "$SRCDIR/$f" -o "$TMP/dsp_vec1_512.h" $FAUST -cn dsp_vec1g_4 $OPTIONS -vec -lv 1 -vs 4 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_4.h" $FAUST -cn dsp_vec1g_8 $OPTIONS -vec -lv 1 -vs 8 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_8.h" $FAUST -cn dsp_vec1g_16 $OPTIONS -vec -lv 1 -vs 16 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_16.h" $FAUST -cn dsp_vec1g_32 $OPTIONS -vec -lv 1 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32.h" $FAUST -cn dsp_vec1g_64 $OPTIONS -vec -lv 1 -vs 64 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_64.h" $FAUST -cn dsp_vec1g_128 $OPTIONS -vec -lv 1 -vs 128 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_128.h" $FAUST -cn dsp_vec1g_256 $OPTIONS -vec -lv 1 -vs 256 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_256.h" $FAUST -cn dsp_vec1g_512 $OPTIONS -vec -lv 1 -vs 512 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_512.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_vec1_4_clang $OPTIONS -vec -lv 1 -vs 4 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_4_clang.h" $FAUST -cn dsp_vec1_8_clang $OPTIONS -vec -lv 1 -vs 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_8_clang.h" $FAUST -cn dsp_vec1_16_clang $OPTIONS -vec -lv 1 -vs 16 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_16_clang.h" $FAUST -cn dsp_vec1_32_clang $OPTIONS -vec -lv 1 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_32_clang.h" $FAUST -cn dsp_vec1_64_clang $OPTIONS -vec -lv 1 -vs 64 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_64_clang.h" $FAUST -cn dsp_vec1_128_clang $OPTIONS -vec -lv 1 -vs 128 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_128_clang.h" $FAUST -cn dsp_vec1_256_clang $OPTIONS -vec -lv 1 -vs 256 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_256_clang.h" $FAUST -cn dsp_vec1_512_clang $OPTIONS -vec -lv 1 -vs 512 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_512_clang.h" $FAUST -cn dsp_vec1g_4_clang $OPTIONS -vec -lv 1 -vs 4 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_4_clang.h" $FAUST -cn dsp_vec1g_8_clang $OPTIONS -vec -lv 1 -vs 8 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_8_clang.h" $FAUST -cn dsp_vec1g_16_clang $OPTIONS -vec -lv 1 -vs 16 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_16_clang.h" $FAUST -cn dsp_vec1g_32_clang $OPTIONS -vec -lv 1 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32_clang.h" $FAUST -cn dsp_vec1g_64_clang $OPTIONS -vec -lv 1 -vs 64 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_64_clang.h" $FAUST -cn dsp_vec1g_128_clang $OPTIONS -vec -lv 1 -vs 128 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_128_clang.h" $FAUST -cn dsp_vec1g_256_clang $OPTIONS -vec -lv 1 -vs 256 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_256_clang.h" $FAUST -cn dsp_vec1g_512_clang $OPTIONS -vec -lv 1 -vs 512 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_512_clang.h" fi elif [ $TESTS == "fast" ]; then $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" $FAUST -cn dsp_scal_exp10 $OPTIONS -exp10 "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10.h" $FAUST -cn dsp_scal_mcd0 $OPTIONS -mcd 0 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0.h" $FAUST -cn dsp_scal_mcd8 $OPTIONS -mcd 8 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8.h" $FAUST -cn dsp_scal_mcd32 $OPTIONS -mcd 32 "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" $FAUST -cn dsp_scal_exp10_clang $OPTIONS -exp10 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_exp10_clang.h" $FAUST -cn dsp_scal_mcd0_clang $OPTIONS -mcd 0 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd0_clang.h" $FAUST -cn dsp_scal_mcd8_clang $OPTIONS -mcd 8 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd8_clang.h" $FAUST -cn dsp_scal_mcd32_clang $OPTIONS -mcd 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_mcd32_clang.h" fi $FAUST -cn dsp_vec0_32 $OPTIONS -vec -lv 0 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec0_32.h" $FAUST -cn dsp_vec0g_32 $OPTIONS -vec -lv 0 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32.h" $FAUST -cn dsp_vec1_32 $OPTIONS -vec -lv 1 -vs 32 "$SRCDIR/$f" -o "$TMP/dsp_vec1_32.h" $FAUST -cn dsp_vec1g_32 $OPTIONS -vec -lv 1 -vs 32 -g "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_vec0_32_clang $OPTIONS -vec -lv 0 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0_32_clang.h" $FAUST -cn dsp_vec0g_32_clang $OPTIONS -vec -lv 0 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec0g_32_clang.h" $FAUST -cn dsp_vec1_32_clang $OPTIONS -vec -lv 1 -vs 32 -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1_32_clang.h" $FAUST -cn dsp_vec1g_32_clang $OPTIONS -vec -lv 1 -vs 32 -g -clang "$SRCDIR/$f" -o "$TMP/dsp_vec1g_32_clang.h" fi elif [ $TESTS == "single" ]; then $FAUST -cn dsp_scal $OPTIONS "$SRCDIR/$f" -o "$TMP/dsp_scal.h" if [[ $(uname) == Darwin && $FAUST == "faust" ]]; then CLANG="1" $FAUST -cn dsp_scal_clang $OPTIONS -clang "$SRCDIR/$f" -o "$TMP/dsp_scal_clang.h" fi fi if [ $IOS == "1" ]; then echo "Files generated for iOS project in $TMP" # Create config file echo -n >> "$TMP/Config.h" # float of double mode if [ $DOUBLE == "1" ]; then echo "#define FAUSTFLOAT double" >> "$TMP/Config.h" else echo "#define FAUSTFLOAT float" >> "$TMP/Config.h" fi # which tests to compile if [ $TESTS == "all" ]; then echo "#define ALL_TESTS" >> "$TMP/Config.h" elif [ $TESTS == "fast" ]; then echo "#define FAST_TESTS" >> "$TMP/Config.h" elif [ $TESTS == "single" ]; then echo "#define SINGLE_TESTS" >> "$TMP/Config.h" fi if [ $CLANG == "1" ]; then echo "#define CLANG" >> "$TMP/Config.h" fi # additional options echo "#define OPTIONS string(\"$OPTIONS\")" >> "$TMP/Config.h" # add info for UP/DS + filter adapter echo "#define DOWN_SAMPLING $DS" >> "$TMP/Config.h" echo "#define UP_SAMPLING $US" >> "$TMP/Config.h" echo "#define FILTER_TYPE $FILTER" >> "$TMP/Config.h" cat "$TMP/Config.h" "$FAUSTLIB/faustbench.cpp" > "$TMP/faustbench.cpp" cp -r $FAUSTLIB/iOS-bench/* $TMP exit fi cd "$TMP" # Create config file echo -n >> Config if [ $DOUBLE == "1" ]; then echo "#define FAUSTFLOAT double" >> Config else echo "#define FAUSTFLOAT float" >> Config fi # additional options if [ $CLANG == "1" ]; then echo "#define CLANG" >> Config fi echo "#define OPTIONS string(\"$OPTIONS\")" >> Config # activate Config cat Config "$FAUSTLIB/faustbench.cpp" > "faustbench.cpp" # keep sources if $SOURCE ; then # create Makefile echo "$dspName:" > Makefile echo -n -e '\t' >> Makefile if [ $TESTS == "all" ]; then echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DALL_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile elif [ $TESTS == "fast" ]; then echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DFAST_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile elif [ $TESTS == "single" ]; then echo "$CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DSINGLE_TESTS faustbench.cpp $LIBS -o $dspName" >> Makefile fi echo -e '\n' >> Makefile echo "clean:" >> Makefile echo -n -e '\t' >> Makefile echo "rm $dspName" >> Makefile # copy and rename final folder cd ../ cp -R $dspName ../ cd ../ # cleanup rm -rf $TDR exit else # compile if [ $TESTS == "all" ]; then $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DALL_TESTS faustbench.cpp $LIBS -o $dspName elif [ $TESTS == "fast" ]; then $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DFAST_TESTS faustbench.cpp $LIBS -o $dspName elif [ $TESTS == "single" ]; then $CXX $CXXFLAGS -std=c++11 -I `faust -includedir` -DSINGLE_TESTS faustbench.cpp $LIBS -o $dspName fi # run bench cd ../../ if $NOTRACE; then if $CONTROL; then ./$TDR/$dspName/$dspName -notrace -control -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER else ./$TDR/$dspName/$dspName -notrace -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER fi else if $CONTROL; then ./$TDR/$dspName/$dspName -control -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER else ./$TDR/$dspName/$dspName -run $RUN -bs $BUFFER_SIZE -ds $DS -us $US -filter $FILTER fi fi # cleanup rm -rf $TDR fi done