This commit makes the toolchain easier to use in two folds: 1. When compiling C/C++ source files, no need to add "-fPIC -pie" flags manually; 2. When running executables generated by the Occlum toolchain on Linux, no need to set the `LD_LIBRARY_PATH` manually.
41 lines
735 B
Bash
Executable File
41 lines
735 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
show_usage() {
|
|
echo
|
|
echo "Usage: $0 demo/benchmark"
|
|
echo
|
|
}
|
|
|
|
copy_files() {
|
|
cp -f tensorflow_src/tensorflow/lite/tools/make/gen/linux_x86_64/bin/* .
|
|
cp -rf tensorflow_src/tensorflow/lite/examples/label_image/testdata .
|
|
}
|
|
|
|
run_demo() {
|
|
copy_files
|
|
./label_image \
|
|
--tflite_model ./models/mobilenet_v1_1.0_224.tflite \
|
|
--labels ./models/labels.txt \
|
|
--image ./testdata/grace_hopper.bmp
|
|
}
|
|
|
|
run_benchmark() {
|
|
copy_files
|
|
./benchmark_model \
|
|
--graph=./models/mobilenet_v1_1.0_224.tflite \
|
|
--warmup_runs=5
|
|
}
|
|
|
|
bin=$1
|
|
case "$bin" in
|
|
demo)
|
|
run_demo
|
|
;;
|
|
benchmark)
|
|
run_benchmark
|
|
;;
|
|
*)
|
|
show_usage
|
|
esac
|