Enable multi-thread for tensorflow sample, update wasm-c-api document (#651)
This commit is contained in:
@ -17,7 +17,9 @@ Then run
|
||||
./build.sh
|
||||
# for linux platform, or
|
||||
./build.sh --sgx
|
||||
# for linux-sgx platform
|
||||
# for linux-sgx platform or
|
||||
./build.sh --threads
|
||||
# for multi-thread execution (on linux platform)
|
||||
```
|
||||
to build tensorflow and run it with iwasm, which basically contains the following steps:
|
||||
- hack emcc to delete some objects in libc.a
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
#
|
||||
# Copyright (C) 2019 Intel Corporation. All rights reserved.
|
||||
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
#
|
||||
|
||||
#!/bin/bash
|
||||
|
||||
####################################
|
||||
# build tensorflow-lite sample #
|
||||
####################################
|
||||
@ -99,6 +99,8 @@ WAMRC_CMD="$(pwd)/wamrc"
|
||||
cd ${OUT_DIR}
|
||||
if [[ $1 == '--sgx' ]]; then
|
||||
${WAMRC_CMD} --enable-simd -sgx -o benchmark_model.aot benchmark_model.wasm
|
||||
elif [[ $1 == '--threads' ]]; then
|
||||
${WAMRC_CMD} --enable-simd --enable-multi-thread -o benchmark_model.aot benchmark_model.wasm
|
||||
else
|
||||
${WAMRC_CMD} --enable-simd -o benchmark_model.aot benchmark_model.wasm
|
||||
fi
|
||||
@ -137,7 +139,13 @@ else
|
||||
IWASM_CMD="${WAMR_PLATFORM_DIR}/linux/build/iwasm"
|
||||
fi
|
||||
|
||||
${IWASM_CMD} --heap-size=10475860 \
|
||||
if [[ $1 == '--threads' ]]; then
|
||||
${IWASM_CMD} --heap-size=10475860 \
|
||||
${OUT_DIR}/benchmark_model.aot --num_threads=4 \
|
||||
--graph=mobilenet_quant_v1_224.tflite --max_secs=300
|
||||
else
|
||||
${IWASM_CMD} --heap-size=10475860 \
|
||||
${OUT_DIR}/benchmark_model.aot \
|
||||
--graph=mobilenet_quant_v1_224.tflite --max_secs=300
|
||||
fi
|
||||
|
||||
|
||||
@ -19,14 +19,14 @@ index c7ddff58440..ebfebaead35 100644
|
||||
endif # ifeq ($(HOST_OS),$(TARGET))
|
||||
endif
|
||||
|
||||
+CFLAGS+=-msimd128
|
||||
+CXXFLAGS+=-msimd128
|
||||
+CFLAGS+=-msimd128 -mbulk-memory -matomics
|
||||
+CXXFLAGS+=-msimd128 -mbulk-memory -matomics
|
||||
+
|
||||
+LIBFLAGS += -s TOTAL_STACK=1048576 \
|
||||
+LIBFLAGS += -s TOTAL_STACK=1048576 -s MALLOC="none" \
|
||||
+ -s INITIAL_MEMORY=16777216 \
|
||||
+ -s MAXIMUM_MEMORY=167772160 \
|
||||
+ -s ALLOW_MEMORY_GROWTH=1 \
|
||||
+ -Wl,--export=__data_end -Wl,--export=__heap_base \
|
||||
+ -Wl,--export=__data_end -Wl,--export=__heap_base,--shared-memory,--no-check-features \
|
||||
+ -s ERROR_ON_UNDEFINED_SYMBOLS=0
|
||||
+
|
||||
# This library is the main target for this makefile. It will contain a minimal
|
||||
|
||||
Reference in New Issue
Block a user