This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
wasm-micro-runtime/tests/benchmarks/sightglass/build.sh
Wenyong Huang 4bc6074273
Add benchmarks (#979)
Add scripts to build and run benchmark of coremark, polybench,
sightglass and jetstream2. And add documents.
2022-01-25 10:52:48 +08:00

45 lines
1.3 KiB
Bash
Executable File

#!/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"