mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-05 08:37:06 +08:00

* [backend] support bechmark mode for runtime and backend * [backend] support bechmark mode for runtime and backend * [pybind11] add benchmark methods pybind * [pybind11] add benchmark methods pybind * [Other] Update build scripts * [Other] Update cmake/summary.cmake * [Other] update build scripts * [Other] add ENABLE_BENCHMARK option -> setup.py * optimize backend time recording * optimize backend time recording * optimize trt backend time record * [backend] optimze backend_time recording for trt * [benchmark] remove redundant logs * fixed ov_backend confilct * [benchmark] fixed paddle_backend conflicts * [benchmark] fixed paddle_backend conflicts * [benchmark] fixed paddle_backend conflicts * [benchmark] remove use_gpu option from ort backend option * [benchmark] update benchmark_ppdet.py * [benchmark] update benchmark_ppcls.py * fixed lite backend conflicts * [Lite] fixed lite xpu * add benchmark macro * add RUNTIME_PROFILE_LOOP macros * add comments for RUNTIME_PROFILE macros * add comments for new apis * add comments for new apis * update benchmark_ppdet.py * afixed bugs * remove unused codes * optimize RUNTIME_PROFILE_LOOP macros * optimize RUNTIME_PROFILE_LOOP macros * add comments for benchmark option and result * add docs for benchmark namespace
103 lines
3.1 KiB
Bash
Executable File
103 lines
3.1 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
set +x
|
|
|
|
# -------------------------------------------------------------------------------
|
|
# readonly global variables
|
|
# -------------------------------------------------------------------------------
|
|
readonly ROOT_PATH=$(pwd)
|
|
readonly BUILD_ROOT=build/MacOSX
|
|
readonly OSX_ARCH=$1 # arm64, x86_64
|
|
readonly BUILD_DIR=${BUILD_ROOT}/${OSX_ARCH}
|
|
|
|
# -------------------------------------------------------------------------------
|
|
# tasks
|
|
# -------------------------------------------------------------------------------
|
|
__make_build_dir() {
|
|
if [ ! -d "${BUILD_DIR}" ]; then
|
|
echo "-- [INFO] BUILD_DIR: ${BUILD_DIR} not exists, setup manually ..."
|
|
if [ ! -d "${BUILD_ROOT}" ]; then
|
|
mkdir -p "${BUILD_ROOT}" && echo "-- [INFO] Created ${BUILD_ROOT} !"
|
|
fi
|
|
mkdir -p "${BUILD_DIR}" && echo "-- [INFO] Created ${BUILD_DIR} !"
|
|
else
|
|
echo "-- [INFO] Found BUILD_DIR: ${BUILD_DIR}"
|
|
fi
|
|
}
|
|
|
|
__check_cxx_envs() {
|
|
if [ $LDFLAGS ]; then
|
|
echo "-- [INFO] Found LDFLAGS: ${LDFLAGS}, \c"
|
|
echo "unset it before crossing compiling ${BUILD_DIR}"
|
|
unset LDFLAGS
|
|
fi
|
|
if [ $CPPFLAGS ]; then
|
|
echo "-- [INFO] Found CPPFLAGS: ${CPPFLAGS}, \c"
|
|
echo "unset it before crossing compiling ${BUILD_DIR}"
|
|
unset CPPFLAGS
|
|
fi
|
|
if [ $CPLUS_INCLUDE_PATH ]; then
|
|
echo "-- [INFO] Found CPLUS_INCLUDE_PATH: ${CPLUS_INCLUDE_PATH}, \c"
|
|
echo "unset it before crossing compiling ${BUILD_DIR}"
|
|
unset CPLUS_INCLUDE_PATH
|
|
fi
|
|
if [ $C_INCLUDE_PATH ]; then
|
|
echo "-- [INFO] Found C_INCLUDE_PATH: ${C_INCLUDE_PATH}, \c"
|
|
echo "unset it before crossing compiling ${BUILD_DIR}"
|
|
unset C_INCLUDE_PATH
|
|
fi
|
|
}
|
|
|
|
__build_fastdeploy_osx_arm64_shared() {
|
|
|
|
local FASDEPLOY_INSTALL_DIR="${ROOT_PATH}/${BUILD_DIR}/install"
|
|
cd "${BUILD_DIR}" && echo "-- [INFO] Working Dir: ${PWD}"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=MinSizeRel \
|
|
-DENABLE_ORT_BACKEND=ON \
|
|
-DENABLE_PADDLE2ONNX=ON \
|
|
-DENABLE_VISION=ON \
|
|
-DENABLE_BENCHMARK=ON \
|
|
-DBUILD_EXAMPLES=ON \
|
|
-DCMAKE_INSTALL_PREFIX=${FASDEPLOY_INSTALL_DIR} \
|
|
-Wno-dev ../../.. && make -j8 && make install
|
|
|
|
echo "-- [INFO][built][${OSX_ARCH}][${BUILD_DIR}/install]"
|
|
}
|
|
|
|
__build_fastdeploy_osx_x86_64_shared() {
|
|
|
|
local FASDEPLOY_INSTALL_DIR="${ROOT_PATH}/${BUILD_DIR}/install"
|
|
cd "${BUILD_DIR}" && echo "-- [INFO] Working Dir: ${PWD}"
|
|
|
|
cmake -DCMAKE_BUILD_TYPE=MinSizeRel \
|
|
-DENABLE_ORT_BACKEND=ON \
|
|
-DENABLE_PADDLE_BACKEND=ON \
|
|
-DENABLE_OPENVINO_BACKEND=ON \
|
|
-DENABLE_PADDLE2ONNX=ON \
|
|
-DENABLE_VISION=ON \
|
|
-DENABLE_BENCHMARK=ON \
|
|
-DBUILD_EXAMPLES=ON \
|
|
-DCMAKE_INSTALL_PREFIX=${FASDEPLOY_INSTALL_DIR} \
|
|
-Wno-dev ../../.. && make -j8 && make install
|
|
|
|
echo "-- [INFO][built][${OSX_ARCH}][${BUILD_DIR}/install]"
|
|
}
|
|
|
|
main() {
|
|
__make_build_dir
|
|
__check_cxx_envs
|
|
if [ "$OSX_ARCH" = "arm64" ]; then
|
|
__build_fastdeploy_osx_arm64_shared
|
|
else
|
|
__build_fastdeploy_osx_x86_64_shared
|
|
fi
|
|
exit 0
|
|
}
|
|
|
|
main
|
|
|
|
# Usage:
|
|
# ./scripts/macosx/build_macosx_cpp.sh arm64
|
|
# ./scripts/macosx/build_macosx_cpp.sh x86_64
|