onnxruntime/tools/ci_build/github/linux/run_build.sh
daquexian ec3c553501 NNAPI EP Update (#1483)
* Update DNNLibrary

* Allow fp16 by default

* Add nnapi build in ci

* Fix nnapi ep after #1268

* Remove unused variables

* Support nnapi in onnx_test_runner

* Update DNNLibrary to fix tests

* Update build.py for android build support, solve conflict of
tools/ci_build/build.py

* Support non-ARM Android build, solve conflict of tools/ci_build/build.py

* Enable android test by x86_64 android emulator

* Add dnnlibrary/NNAPI support in build.py

* suppress the verbose adb output

* Remove debug logs

* Install cmake by pip

* Fix undefined host_protoc_path

* cmake==3.13.2 in pypi is actually 3.12.2, so install 3.13.2.post1 instead

* Fix Android ARM64 build

* Use android ndk r20 instead of r19c, fix conflicts in install_deps_android.sh
2019-07-24 13:20:05 -07:00

63 lines
2.7 KiB
Bash
Executable file

#!/bin/bash
set -e -o -x
id
SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}" )"
while getopts d:x:o: parameter_Option
do case "${parameter_Option}"
in
d) BUILD_DEVICE=${OPTARG};;
x) BUILD_EXTR_PAR=${OPTARG};;
o) BUILD_OS=${OPTARG};;
esac
done
if [ $BUILD_OS = "android" ]; then
pushd /onnxruntime_src
mkdir build-android && cd build-android
if [ $BUILD_DEVICE = "nnapi" ]; then
cmake -DCMAKE_TOOLCHAIN_FILE=/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc -Donnxruntime_USE_NNAPI=ON ../cmake
else
cmake -DCMAKE_TOOLCHAIN_FILE=/android-ndk/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DONNX_CUSTOM_PROTOC_EXECUTABLE=/usr/bin/protoc ../cmake
fi
make -j$(nproc)
else
COMMON_BUILD_ARGS="--skip_submodule_sync --enable_onnx_tests --parallel --build_shared_lib --use_openmp --cmake_path /usr/bin/cmake --ctest_path /usr/bin/ctest"
if [ $BUILD_OS = "manylinux2010" ]; then
# FindPython3 does not work on manylinux2010 image, define things manually
# ask python where to find includes
COMMON_BUILD_ARGS="${COMMON_BUILD_ARGS} --cmake_extra_defines PYTHON_INCLUDE_DIR=$(python3 -c 'import distutils.sysconfig; print(distutils.sysconfig.get_python_inc())')"
# Python does not provide a shared library on manylinux, use another library
COMMON_BUILD_ARGS="${COMMON_BUILD_ARGS} PYTHON_LIBRARY=/usr/lib64/librt.so"
fi
if [ $BUILD_DEVICE = "gpu" ]; then
if [ $BUILD_OS = "manylinux2010" ]; then
python3 $SCRIPT_DIR/../../build.py --build_dir /build \
--config Debug Release $COMMON_BUILD_ARGS \
--use_cuda \
--cuda_home /usr/local/cuda \
--cudnn_home /usr/local/cuda $BUILD_EXTR_PAR
else
_CUDNN_VERSION=$(echo $CUDNN_VERSION | cut -d. -f1-2)
python3 $SCRIPT_DIR/../../build.py --build_dir /build \
--config Debug Release $COMMON_BUILD_ARGS \
--use_cuda \
--cuda_home /usr/local/cuda \
--cudnn_home /usr/local/cudnn-$_CUDNN_VERSION/cuda $BUILD_EXTR_PAR
fi
elif [ $BUILD_DEVICE = "tensorrt" ]; then
_CUDNN_VERSION=$(echo $CUDNN_VERSION | cut -d. -f1-2)
python3 $SCRIPT_DIR/../../build.py --build_dir /build \
--config Release $COMMON_BUILD_ARGS \
--use_tensorrt --tensorrt_home /workspace/tensorrt \
--cuda_home /usr/local/cuda \
--cudnn_home /usr/local/cuda $BUILD_EXTR_PAR
else #cpu, ngraph and openvino
python3 $SCRIPT_DIR/../../build.py --build_dir /build \
--config Debug Release $COMMON_BUILD_ARGS $BUILD_EXTR_PAR
fi
fi