diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 02:57:58 +0000 |
commit | be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97 (patch) | |
tree | 9754ff1ca740f6346cf8483ec915d4054bc5da2d /fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks | |
parent | Initial commit. (diff) | |
download | netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.tar.xz netdata-be1c7e50e1e8809ea56f2c9d472eccd8ffd73a97.zip |
Adding upstream version 1.44.3.upstream/1.44.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks')
18 files changed, 721 insertions, 0 deletions
diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/README.md new file mode 100644 index 00000000..1631cc5c --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/README.md @@ -0,0 +1,19 @@ +# Introduction + +[CoreMark's](https://www.eembc.org/coremark) primary goals are simplicity and providing a method for testing only a processor's core features. + +**Source**: https://github.com/eembc/coremark + +# Building + +Please build iwasm and wamrc, refer to: +- [Build iwasm on Linux](../../../doc/build_wamr.md#linux), or [Build iwasm on MacOS](../../../doc/build_wamr.md#macos) +- [Build wamrc AOT compiler](../../../README.md#build-wamrc-aot-compiler) + +And install WASI SDK, please download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`. + +And then run `./build.sh` to build the source code, file `coremark.exe`, `coremark.wasm` and `coremark.aot` will be generated. + +# Running + +Run `./run.sh` to test the benchmark, the native mode, iwasm aot mode and iwasm interpreter mode will be tested respectively. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/build.sh new file mode 100755 index 00000000..14c179ce --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +WAMRC="../../../wamr-compiler/build/wamrc" + +if [ ! -d coremark ]; then + git clone https://github.com/eembc/coremark.git +fi + +cd coremark + +echo "Build coremark with gcc .." +gcc -O3 -Iposix -I. -DFLAGS_STR=\""-O3 -DPERFORMANCE_RUN=1 -lrt"\" \ + -DITERATIONS=400000 -DSEED_METHOD=SEED_VOLATILE -DPERFORMANCE_RUN=1 \ + core_list_join.c core_main.c core_matrix.c core_state.c \ + core_util.c posix/core_portme.c \ + -o ../coremark.exe -lrt + +echo "Build coremark with wasi-sdk .." +/opt/wasi-sdk/bin/clang -O3 -Iposix -I. -DFLAGS_STR=\""-O3 -DPERFORMANCE_RUN=1"\" \ + -Wl,--export=main \ + -DITERATIONS=400000 -DSEED_METHOD=SEED_VOLATILE -DPERFORMANCE_RUN=1 \ + -Wl,--allow-undefined \ + core_list_join.c core_main.c core_matrix.c core_state.c \ + core_util.c posix/core_portme.c \ + -o ../coremark.wasm + +cd .. + +echo "Compile coremark.wasm to coremark.aot .." +${WAMRC} -o coremark.aot coremark.wasm + +echo "Done" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/run.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/run.sh new file mode 100755 index 00000000..a1ea7f6b --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/coremark/run.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +IWASM="../../../product-mini/platforms/linux/build/iwasm" +WAMRC="../../../wamr-compiler/build/wamrc" + +echo "Run coremark with native .." +./coremark.exe + +echo "Run coremark with iwasm mode .." +${IWASM} coremark.aot + +echo "Run coremakr with iwasm interpreter .." +${IWASM} coremark.wasm diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/README.md new file mode 100644 index 00000000..f6c593d1 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/README.md @@ -0,0 +1,29 @@ +# Introduction + +[JetStream 2](https://browserbench.org/JetStream) is a JavaScript and WebAssembly benchmark suite focused on the most advanced web applications. It rewards browsers that start up quickly, execute code quickly, and run smoothly. + +**Source**: https://browserbench.org/JetStream/in-depth.html + +# Building + +Please build iwasm and wamrc, refer to: +- [Build iwasm on Linux](../../../doc/build_wamr.md#linux), or [Build iwasm on MacOS](../../../doc/build_wamr.md#macos) +- [Build wamrc AOT compiler](../../../README.md#build-wamrc-aot-compiler) + +And install emsdk, refer to [the guide](https://emscripten.org/docs/getting_started/downloads.html). Don't forget to activate + emsdk and set up environment variables. For example, use instructions below to install it under /opt and activate it: +``` bash +$ cd /opt +$ git clone https://github.com/emscripten-core/emsdk.git +$ cd emsdk +$ git pull +$ ./emsdk install latest +$ ./emsdk activate latest +$ echo "source /opt/emsdk/emsdk_env.sh" >> "${HOME}"/.bashrc +``` + +And then run `./build.sh` to build the source code, the folder `out` will be created and files will be generated under it. + +# Running + +Run `./run_aot.sh` to test the benchmark, the native mode and iwasm aot mode will be tested for each workload, and the file `report.txt` will be generated. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/build.sh new file mode 100755 index 00000000..030b8d3a --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/build.sh @@ -0,0 +1,74 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +OUT_DIR=$PWD/out +WAMRC_CMD=$PWD/../../../wamr-compiler/build/wamrc + +mkdir -p jetstream +mkdir -p ${OUT_DIR} + +cd jetstream + +echo "Download source files .." +wget https://browserbench.org/JetStream/wasm/gcc-loops.cpp +wget https://browserbench.org/JetStream/wasm/quicksort.c +wget https://browserbench.org/JetStream/wasm/HashSet.cpp +wget https://browserbench.org/JetStream/simple/float-mm.c + +patch -p1 < ../jetstream.patch + +echo "Build gcc-loops with g++ .." +g++ -O3 -msse2 -msse3 -msse4 -o ${OUT_DIR}/gcc-loops_native gcc-loops.cpp + +echo "Build gcc-loops with em++ .." +em++ -O3 -s STANDALONE_WASM=1 -msimd128 \ + -s INITIAL_MEMORY=1048576 \ + -s TOTAL_STACK=32768 \ + -s "EXPORTED_FUNCTIONS=['_main']" \ + -s ERROR_ON_UNDEFINED_SYMBOLS=0 \ + -o ${OUT_DIR}/gcc-loops.wasm gcc-loops.cpp + +echo "Compile gcc-loops.wasm to gcc-loops.aot" +${WAMRC_CMD} -o ${OUT_DIR}/gcc-loops.aot ${OUT_DIR}/gcc-loops.wasm + +echo "Build quicksort with gcc .." +gcc -O3 -msse2 -msse3 -msse4 -o ${OUT_DIR}/quicksort_native quicksort.c + +echo "Build quicksort with emcc .." +emcc -O3 -s STANDALONE_WASM=1 -msimd128 \ + -s INITIAL_MEMORY=1048576 \ + -s TOTAL_STACK=32768 \ + -s "EXPORTED_FUNCTIONS=['_main']" \ + -o ${OUT_DIR}/quicksort.wasm quicksort.c + +echo "Compile quicksort.wasm to quicksort.aot" +${WAMRC_CMD} -o ${OUT_DIR}/quicksort.aot ${OUT_DIR}/quicksort.wasm + +echo "Build HashSet with g++ .." +g++ -O3 -msse2 -msse3 -msse4 -o ${OUT_DIR}/HashSet_native HashSet.cpp \ + -lstdc++ + +echo "Build HashSet with em++ .." +em++ -O3 -s STANDALONE_WASM=1 -msimd128 \ + -s INITIAL_MEMORY=1048576 \ + -s TOTAL_STACK=32768 \ + -s "EXPORTED_FUNCTIONS=['_main']" \ + -o ${OUT_DIR}/HashSet.wasm HashSet.cpp + +echo "Compile HashSet.wasm to HashSet.aot" +${WAMRC_CMD} -o ${OUT_DIR}/HashSet.aot ${OUT_DIR}/HashSet.wasm + +echo "Build float-mm with gcc .." +gcc -O3 -msse2 -msse3 -msse4 -o ${OUT_DIR}/float-mm_native float-mm.c + +echo "Build float-mm with emcc .." +emcc -O3 -s STANDALONE_WASM=1 -msimd128 \ + -s INITIAL_MEMORY=1048576 \ + -s TOTAL_STACK=32768 \ + -s "EXPORTED_FUNCTIONS=['_main']" \ + -o ${OUT_DIR}/float-mm.wasm float-mm.c + +echo "Compile float-mm.wasm to float-mm.aot" +${WAMRC_CMD} -o ${OUT_DIR}/float-mm.aot ${OUT_DIR}/float-mm.wasm diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/jetstream.patch b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/jetstream.patch new file mode 100644 index 00000000..34431de0 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/jetstream.patch @@ -0,0 +1,20 @@ +diff -urN jetstream-org/HashSet.cpp jetstream/HashSet.cpp +--- jetstream-org/HashSet.cpp 2020-10-30 04:12:42.000000000 +0800 ++++ jetstream/HashSet.cpp 2022-01-24 17:11:08.619831711 +0800 +@@ -24,6 +24,7 @@ + #include <memory> + #include <stdio.h> + #include <stdlib.h> ++#include <string.h> + #include <sys/time.h> + + // Compile with: xcrun clang++ -o HashSet HashSet.cpp -O2 -W -framework Foundation -licucore -std=c++11 -fvisibility=hidden -DNDEBUG=1 +@@ -76,7 +77,7 @@ + inline ToType bitwise_cast(FromType from) + { + typename std::remove_const<ToType>::type to { }; +- std::memcpy(&to, &from, sizeof(to)); ++ memcpy(&to, &from, sizeof(to)); + return to; + } + diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/run_aot.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/run_aot.sh new file mode 100755 index 00000000..d62a5da9 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/jetstream/run_aot.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +CUR_DIR=$PWD +OUT_DIR=$CUR_DIR/out +REPORT=$CUR_DIR/report.txt +TIME=/usr/bin/time + +PLATFORM=$(uname -s | tr A-Z a-z) +IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +JETSTREAM_CASES="gcc-loops quicksort HashSet float-mm" + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +echo "Start to run cases, the result is written to report.txt" + +#run benchmarks +cd $OUT_DIR +echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT + +for t in $JETSTREAM_CASES +do + print_bench_name $t + + echo "run $t with native .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo "run $t with iwasm aot .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo -en "\n" >> $REPORT +done diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/README.md new file mode 100644 index 00000000..19500afe --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/README.md @@ -0,0 +1,23 @@ +# Introduction + +[libsodium](https://github.com/jedisct1/libsodium) is a new, easy-to-use software library for encryption, decryption, signatures, password hashing and more. + +**Source**: https://github.com/jedisct1/libsodium + +# Building + +Please build iwasm and wamrc, refer to: +- [Build iwasm on Linux](../../../doc/build_wamr.md#linux), or [Build iwasm on MacOS](../../../doc/build_wamr.md#macos) +- [Build wamrc AOT compiler](../../../README.md#build-wamrc-aot-compiler) + +And install [zig toolchain](https://ziglang.org/learn/getting-started), refer to [Install Zig from a Package Manager](https://github.com/ziglang/zig/wiki/Install-Zig-from-a-Package-Manager) for how to install it. + +And then run `./build.sh` to build the source code, the libsodium source code will be cloned, and test benchmarks of native version, wasm files and AOT files will be generated under `libsodium/zig-out/bin`. + +# Running + +Run `./run_aot.sh` to test the benchmark, the native mode and iwasm aot mode will be tested respectively. + +# Others + +Refer to [Performance of WebAssembly runtimes in 2023](https://00f.net/2023/01/04/webassembly-benchmark-2023) for more about the performance comparison of wasm runtimes on running the libsodium benchmarks. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/build.sh new file mode 100755 index 00000000..1e9cc21a --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/build.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +libsodium_CASES="aead_aes256gcm2 aead_aes256gcm aead_chacha20poly13052 aead_chacha20poly1305 \ + aead_xchacha20poly1305 auth2 auth3 auth5 auth6 auth7 auth box2 box7 box8 \ + box_easy2 box_easy box_seal box_seed box chacha20 codecs core1 core2 core3 \ + core4 core5 core6 core_ed25519 core_ristretto255 ed25519_convert generichash2 \ + generichash3 generichash hash3 hash kdf keygen kx metamorphic misuse \ + onetimeauth2 onetimeauth7 onetimeauth pwhash_argon2id pwhash_argon2i \ + pwhash_scrypt_ll pwhash_scrypt randombytes scalarmult2 scalarmult5 \ + scalarmult6 scalarmult7 scalarmult8 scalarmult_ed25519 scalarmult_ristretto255 \ + scalarmult secretbox2 secretbox7 secretbox8 secretbox_easy2 secretbox_easy \ + secretbox secretstream shorthash sign siphashx24 sodium_core sodium_utils2 \ + sodium_utils3 sodium_utils sodium_version stream2 stream3 stream4 stream verify1 \ + xchacha20" + +readonly WAMRC_CMD=$PWD/../../../wamr-compiler/build/wamrc +readonly OUT_DIR=$PWD/libsodium/zig-out/bin + +if [ ! -d libsodium ]; then + git clone -b stable https://github.com/jedisct1/libsodium.git +fi + +cd libsodium + +echo "Build libsodium native" +zig build -Drelease-fast -Denable_benchmarks=true + +echo "Build libsodium wasm32-wasi" +zig build -Drelease-fast -Denable_benchmarks=true -Dtarget=wasm32-wasi + +for case in ${libsodium_CASES} +do + ${WAMRC_CMD} -o ${OUT_DIR}/${case}.aot ${OUT_DIR}/${case}.wasm + + if [ "$?" != 0 ]; then + echo -e "Error while compiling ${case}.wasm to ${case}.aot" + exit + fi +done diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/test_aot.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/test_aot.sh new file mode 100755 index 00000000..2e4e3e35 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/libsodium/test_aot.sh @@ -0,0 +1,59 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +libsodium_CASES="aead_aes256gcm2 aead_aes256gcm aead_chacha20poly13052 aead_chacha20poly1305 \ + aead_xchacha20poly1305 auth2 auth3 auth5 auth6 auth7 auth box2 box7 box8 \ + box_easy2 box_easy box_seal box_seed box chacha20 codecs core1 core2 core3 \ + core4 core5 core6 core_ed25519 core_ristretto255 ed25519_convert generichash2 \ + generichash3 generichash hash3 hash kdf keygen kx metamorphic misuse \ + onetimeauth2 onetimeauth7 onetimeauth pwhash_argon2id pwhash_argon2i \ + pwhash_scrypt_ll pwhash_scrypt randombytes scalarmult2 scalarmult5 \ + scalarmult6 scalarmult7 scalarmult8 scalarmult_ed25519 scalarmult_ristretto255 \ + scalarmult secretbox2 secretbox7 secretbox8 secretbox_easy2 secretbox_easy \ + secretbox secretstream shorthash sign siphashx24 sodium_core sodium_utils2 \ + sodium_utils3 sodium_utils sodium_version stream2 stream3 stream4 stream verify1 \ + xchacha20" + +readonly OUT_DIR=$PWD/libsodium/zig-out/bin +readonly REPORT=$PWD/report.txt +readonly IWASM_CMD=$PWD/../../../product-mini/platforms/linux/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +# run benchmarks +cd $OUT_DIR + +echo -en "\t\t\t\t\t\tnative\tiwasm-aot\n" >> $REPORT + +for t in $libsodium_CASES +do + print_bench_name $t + + echo "run $t with native..." + echo -en "\t" >> $REPORT + ./${t} | awk -F '-' 'BEGIN{FIELDWIDTHS="10"}{ORS=""; print $1 / 1000000.0}' >> $REPORT + + echo "run $t with iwasm aot..." + echo -en "\t \t" >> $REPORT + $IWASM_CMD ${t}.aot | awk -F '-' 'BEGIN{FIELDWIDTHS="10"}{ORS=""; print $1 / 1000000.0}' >> $REPORT + + echo -en "\n" >> $REPORT +done + diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/README.md new file mode 100644 index 00000000..7808e17d --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/README.md @@ -0,0 +1,21 @@ +# Introduction + +[PolyBench](https://github.com/MatthiasJReisinger/PolyBenchC-4.2.1) is a benchmark suite of 30 numerical computations with static control flow, extracted from operations in various application domains (linear algebra computations, image processing, physics simulation, dynamic programming, statistics, etc.). + +**Source**: https://github.com/MatthiasJReisinger/PolyBenchC-4.2.1 + +# Building + +Please build iwasm and wamrc, refer to: +- [Build iwasm on Linux](../../../doc/build_wamr.md#linux), or [Build iwasm on MacOS](../../../doc/build_wamr.md#macos) +- [Build wamrc AOT compiler](../../../README.md#build-wamrc-aot-compiler) + +And install WASI SDK, please download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`. + +And then run `./build.sh` to build the source code, the folder `out` will be created and files will be generated under it. + +# Running + +Run `./run_aot.sh` to test the benchmark, the native mode and iwasm aot mode will be tested for each workload, and the file `report.txt` will be generated. + +Run `./run_interp.sh` to test the benchmark, the native mode and iwasm interpreter mode will be tested for each workload, and the file `report.txt` will be generated. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/build.sh new file mode 100755 index 00000000..bc7bf4c1 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/build.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +OUT_DIR=$PWD/out +WAMRC_CMD=$PWD/../../../wamr-compiler/build/wamrc +POLYBENCH_CASES="datamining linear-algebra medley stencils" + +if [ ! -d PolyBenchC-4.2.1 ]; then + git clone https://github.com/MatthiasJReisinger/PolyBenchC-4.2.1.git +fi + +mkdir -p ${OUT_DIR} + +cd PolyBenchC-4.2.1 + +for case in $POLYBENCH_CASES +do + files=`find ${case} -name "*.c"` + for file in ${files} + do + file_name=${file##*/} + if [[ ${file_name} == "Nussinov.orig.c" ]]; then + continue + fi + + echo "Build ${file_name%.*}_native" + gcc -O3 -I utilities -I ${file%/*} utilities/polybench.c ${file} \ + -DPOLYBENCH_TIME -lm -o ${OUT_DIR}/${file_name%.*}_native + + echo "Build ${file_name%.*}.wasm" + /opt/wasi-sdk/bin/clang -O3 -I utilities -I ${file%/*} \ + utilities/polybench.c ${file} \ + -Wl,--export=__heap_base -Wl,--export=__data_end \ + -Wl,--export=malloc -Wl,--export=free \ + -DPOLYBENCH_TIME -o ${OUT_DIR}/${file_name%.*}.wasm \ + -D_WASI_EMULATED_PROCESS_CLOCKS + + echo "Compile ${file_name%.*}.wasm into ${file_name%.*}.aot" + ${WAMRC_CMD} -o ${OUT_DIR}/${file_name%.*}.aot \ + ${OUT_DIR}/${file_name%.*}.wasm + done +done + +cd .. + +echo "Done" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_aot.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_aot.sh new file mode 100755 index 00000000..17cc098a --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_aot.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +CUR_DIR=$PWD +OUT_DIR=$CUR_DIR/out +REPORT=$CUR_DIR/report.txt +TIME=/usr/bin/time + +PLATFORM=$(uname -s | tr A-Z a-z) +IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +POLYBENCH_CASES="2mm 3mm adi atax bicg cholesky correlation covariance \ + deriche doitgen durbin fdtd-2d floyd-warshall gemm gemver \ + gesummv gramschmidt heat-3d jacobi-1d jacobi-2d ludcmp lu \ + mvt nussinov seidel-2d symm syr2k syrk trisolv trmm" + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +echo "Start to run cases, the result is written to report.txt" + +#run benchmarks +cd $OUT_DIR +echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT + +for t in $POLYBENCH_CASES +do + print_bench_name $t + + echo "run $t with native .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo "run $t with iwasm aot .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo -en "\n" >> $REPORT +done diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_interp.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_interp.sh new file mode 100755 index 00000000..f6d5c254 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/polybench/run_interp.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +CUR_DIR=$PWD +OUT_DIR=$CUR_DIR/out +REPORT=$CUR_DIR/report.txt +TIME=/usr/bin/time + +PLATFORM=$(uname -s | tr A-Z a-z) +IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +POLYBENCH_CASES="2mm 3mm adi atax bicg cholesky correlation covariance \ + deriche doitgen durbin fdtd-2d floyd-warshall gemm gemver \ + gesummv gramschmidt heat-3d jacobi-1d jacobi-2d ludcmp lu \ + mvt nussinov seidel-2d symm syr2k syrk trisolv trmm" + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +echo "Start to run cases, the result is written to report.txt" + +#run benchmarks +cd $OUT_DIR +echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT + +for t in $POLYBENCH_CASES +do + print_bench_name $t + + echo "run $t with native .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo "run $t with iwasm interp .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" $IWASM_CMD ${t}.wasm 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo -en "\n" >> $REPORT +done diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/README.md b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/README.md new file mode 100644 index 00000000..a446d80e --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/README.md @@ -0,0 +1,21 @@ +# Introduction + +[Sightglass](https://github.com/bytecodealliance/sightglass) is a benchmarking suite and tooling to test WebAssembly applications. + +**Source**: https://github.com/bytecodealliance/sightglass + +# Building + +Please build iwasm and wamrc, refer to: +- [Build iwasm on Linux](../../../doc/build_wamr.md#linux), or [Build iwasm on MacOS](../../../doc/build_wamr.md#macos) +- [Build wamrc AOT compiler](../../../README.md#build-wamrc-aot-compiler) + +And install WASI SDK, please download the [wasi-sdk release](https://github.com/CraneStation/wasi-sdk/releases) and extract the archive to default path `/opt/wasi-sdk`. + +And then run `./build.sh` to build the source code, the folder `out` will be created and files will be generated under it. + +# Running + +Run `./run_aot.sh` to test the benchmark, the native mode and iwasm aot mode will be tested for each workload, and the file `report.txt` will be generated. + +Run `./run_interp.sh` to test the benchmark, the native mode and iwasm interpreter mode will be tested for each workload, and the file `report.txt` will be generated. diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/build.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/build.sh new file mode 100755 index 00000000..c7192c16 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/build.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +OUT_DIR=$PWD/out +WAMRC_CMD=$PWD/../../../wamr-compiler/build/wamrc +SHOOTOUT_CASES="base64 fib2 gimli heapsort matrix memmove nestedloop \ + nestedloop2 nestedloop3 random seqhash sieve strchr \ + switch2" + +if [ ! -d sightglass ]; then + git clone https://github.com/wasm-micro-runtime/sightglass.git +fi + +mkdir -p ${OUT_DIR} + +cd sightglass/benchmarks/shootout + +for bench in $SHOOTOUT_CASES +do + echo "Build ${bench}_native" + gcc -O3 -o ${OUT_DIR}/${bench}_native -Dblack_box=set_res -Dbench=${bench} \ + -I../../include ${bench}.c main/main_${bench}.c main/my_libc.c + + echo "Build ${bench}.wasm" + /opt/wasi-sdk/bin/clang -O3 -nostdlib \ + -Wno-unknown-attributes \ + -Dblack_box=set_res \ + -I../../include -DNOSTDLIB_MODE \ + -Wl,--initial-memory=1310720,--allow-undefined \ + -Wl,--strip-all,--no-entry \ + -o ${OUT_DIR}/${bench}.wasm \ + -Wl,--export=app_main -Wl,--export=_start \ + ${bench}.c main/main_${bench}.c main/my_libc.c + + + echo "Compile ${bench}.wasm into ${bench}.aot" + ${WAMRC_CMD} -o ${OUT_DIR}/${bench}.aot ${OUT_DIR}/${bench}.wasm +done + +cd .. + +echo "Done" diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_aot.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_aot.sh new file mode 100755 index 00000000..7a74a791 --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_aot.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +CUR_DIR=$PWD +OUT_DIR=$CUR_DIR/out +REPORT=$CUR_DIR/report.txt +TIME=/usr/bin/time + +PLATFORM=$(uname -s | tr A-Z a-z) +IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +SHOOTOUT_CASES="base64 fib2 gimli heapsort matrix memmove nestedloop \ + nestedloop2 nestedloop3 random seqhash sieve strchr \ + switch2" + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +echo "Start to run cases, the result is written to report.txt" + +#run benchmarks +cd $OUT_DIR +echo -en "\t\t\t\t\t native\tiwasm-aot\n" >> $REPORT + +for t in $SHOOTOUT_CASES +do + print_bench_name $t + + echo "run $t with native .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo "run $t with iwasm aot .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo -en "\n" >> $REPORT +done diff --git a/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_interp.sh b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_interp.sh new file mode 100755 index 00000000..50e94a5d --- /dev/null +++ b/fluent-bit/lib/wasm-micro-runtime-WAMR-1.2.2/tests/benchmarks/sightglass/run_interp.sh @@ -0,0 +1,54 @@ +#!/bin/bash + +# Copyright (C) 2019 Intel Corporation. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + +CUR_DIR=$PWD +OUT_DIR=$CUR_DIR/out +REPORT=$CUR_DIR/report.txt +TIME=/usr/bin/time + +PLATFORM=$(uname -s | tr A-Z a-z) +IWASM_CMD=$CUR_DIR/../../../product-mini/platforms/${PLATFORM}/build/iwasm + +BENCH_NAME_MAX_LEN=20 + +SHOOTOUT_CASES="base64 fib2 gimli heapsort matrix memmove nestedloop \ + nestedloop2 nestedloop3 random seqhash sieve strchr \ + switch2" + +rm -f $REPORT +touch $REPORT + +function print_bench_name() +{ + name=$1 + echo -en "$name" >> $REPORT + name_len=${#name} + if [ $name_len -lt $BENCH_NAME_MAX_LEN ] + then + spaces=$(( $BENCH_NAME_MAX_LEN - $name_len )) + for i in $(eval echo "{1..$spaces}"); do echo -n " " >> $REPORT; done + fi +} + +echo "Start to run cases, the result is written to report.txt" + +#run benchmarks +cd $OUT_DIR +echo -en "\t\t\t\t\t native\tiwasm-interp\n" >> $REPORT + +for t in $SHOOTOUT_CASES +do + print_bench_name $t + + echo "run $t with native .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" ./${t}_native 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo "run $t with iwasm aot .." + echo -en "\t" >> $REPORT + $TIME -f "real-%e-time" $IWASM_CMD ${t}.aot 2>&1 | grep "real-.*-time" | awk -F '-' '{ORS=""; print $2}' >> $REPORT + + echo -en "\n" >> $REPORT +done |