forked from mindspore-Ecosystem/mindspore
split benchmark and testcaset compile module for mslite
add protobuf cmake
This commit is contained in:
parent
77978d0921
commit
a0a9eeb189
|
@ -83,11 +83,10 @@ cd %BASEPATH%
|
|||
goto run_eof
|
||||
|
||||
:run_cmake
|
||||
cd %BASEPATH%
|
||||
for /F %%i in ('find "const int ms_version_major =" mindspore\lite\include\version.h ^| tr -dc "[0-9]"') do ( set VERSION_MAJOR=%%i)
|
||||
for /F %%i in ('find "const int ms_version_minor =" mindspore\lite\include\version.h ^| tr -dc "[0-9]"') do ( set VERSION_MINOR=%%i)
|
||||
for /F %%i in ('find "const int ms_version_revision =" mindspore\lite\include\version.h ^| tr -dc "[0-9]"') do ( set VERSION_REVISION=%%i)
|
||||
echo "======Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION%======"
|
||||
set VERSION_MAJOR=1
|
||||
set VERSION_MINOR=0
|
||||
set VERSION_REVISION=0
|
||||
echo "============ Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION% ============"
|
||||
cd %BUILD_PATH%/mindspore
|
||||
cmake -DBUILD_DEVICE=on -DBUILD_CONVERTER=on -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
|
||||
-DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^
|
||||
|
|
23
build.sh
23
build.sh
|
@ -258,8 +258,10 @@ checkopts()
|
|||
I)
|
||||
COMPILE_LITE="on"
|
||||
if [[ "$OPTARG" == "arm64" ]]; then
|
||||
ENABLE_CONVERTER="off"
|
||||
LITE_PLATFORM="arm64"
|
||||
elif [[ "$OPTARG" == "arm32" ]]; then
|
||||
ENABLE_CONVERTER="off"
|
||||
LITE_PLATFORM="arm32"
|
||||
elif [[ "$OPTARG" == "x86_64" ]]; then
|
||||
ENABLE_CONVERTER="on"
|
||||
|
@ -291,7 +293,7 @@ checkopts()
|
|||
ENABLE_IBVERBS="on"
|
||||
echo "enable IBVERBS for parameter server"
|
||||
;;
|
||||
T)
|
||||
T)
|
||||
check_on_off $OPTARG T
|
||||
SUPPORT_TRAIN=$OPTARG
|
||||
echo "support train on device "
|
||||
|
@ -566,7 +568,7 @@ build_opencv() {
|
|||
OPENCV_BIN="${BASEPATH}"/third_party/opencv/build/lib/armeabi-v7a/libopencv_core.so
|
||||
else
|
||||
OPENCV_BIN="${BASEPATH}"/third_party/opencv/build/lib/arm64-v8a/libopencv_core.so
|
||||
|
||||
|
||||
fi
|
||||
if [[ ! -f "${OPENCV_BIN}" ]]; then
|
||||
if [[ "${MSLIBS_SERVER}" ]]; then
|
||||
|
@ -665,7 +667,7 @@ build_lite()
|
|||
fi
|
||||
build_flatbuffer
|
||||
build_gtest
|
||||
|
||||
|
||||
if [ "${COMPILE_MINDDATA_LITE}" == "lite" ] || [ "${COMPILE_MINDDATA_LITE}" == "full" ]; then
|
||||
build_minddata_lite_deps
|
||||
fi
|
||||
|
@ -686,27 +688,30 @@ build_lite()
|
|||
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
|
||||
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="arm64-v8a" -DANDROID_TOOLCHAIN_NAME="aarch64-linux-android-clang" \
|
||||
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM64=on -DBUILD_CONVERTER=off -DENABLE_NEON=on -DENABLE_FP16="off" \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM64=on -DENABLE_NEON=on -DENABLE_FP16="off" \
|
||||
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \
|
||||
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${BASEPATH}/output/tmp -DMS_VERSION_MAJOR=${VERSION_MAJOR} \
|
||||
-DMS_VERSION_MINOR=${VERSION_MINOR} -DMS_VERSION_REVISION=${VERSION_REVISION} -DENABLE_VERBOSE=${ENABLE_VERBOSE} \
|
||||
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} "${BASEPATH}/mindspore/lite"
|
||||
"${BASEPATH}/mindspore/lite"
|
||||
elif [[ "${LITE_PLATFORM}" == "arm32" ]]; then
|
||||
checkndk
|
||||
cmake -DCMAKE_TOOLCHAIN_FILE="${ANDROID_NDK}/build/cmake/android.toolchain.cmake" -DANDROID_NATIVE_API_LEVEL="19" \
|
||||
-DANDROID_NDK="${ANDROID_NDK}" -DANDROID_ABI="armeabi-v7a" -DANDROID_TOOLCHAIN_NAME="clang" \
|
||||
-DANDROID_STL="c++_static" -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM32=on -DENABLE_NEON=on -DSUPPORT_TRAIN=${SUPPORT_TRAIN} -DBUILD_CONVERTER=off \
|
||||
-DBUILD_DEVICE=on -DPLATFORM_ARM32=on -DENABLE_NEON=on -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \
|
||||
-DSUPPORT_GPU=${ENABLE_GPU} -DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
|
||||
-DCMAKE_INSTALL_PREFIX=${BASEPATH}/output/tmp -DMS_VERSION_MAJOR=${VERSION_MAJOR} \
|
||||
-DMS_VERSION_MINOR=${VERSION_MINOR} -DMS_VERSION_REVISION=${VERSION_REVISION} -DENABLE_VERBOSE=${ENABLE_VERBOSE} \
|
||||
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} "${BASEPATH}/mindspore/lite"
|
||||
"${BASEPATH}/mindspore/lite"
|
||||
else
|
||||
cmake -DBUILD_DEVICE=on -DPLATFORM_ARM64=off -DBUILD_CONVERTER=${ENABLE_CONVERTER} -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
cmake -DBUILD_DEVICE=on -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=${SUPPORT_TRAIN} \
|
||||
-DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} -DBUILD_TESTCASES=${RUN_TESTCASES} \
|
||||
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DSUPPORT_GPU=${ENABLE_GPU} -DBUILD_MINDDATA=${COMPILE_MINDDATA_LITE} \
|
||||
-DOFFLINE_COMPILE=${OPENCL_OFFLINE_COMPILE} -DCMAKE_INSTALL_PREFIX=${BASEPATH}/output/tmp \
|
||||
-DMS_VERSION_MAJOR=${VERSION_MAJOR} -DMS_VERSION_MINOR=${VERSION_MINOR} -DMS_VERSION_REVISION=${VERSION_REVISION} \
|
||||
-DENABLE_VERBOSE=${ENABLE_VERBOSE} -DENABLE_TOOLS=${ENABLE_TOOLS} -DENABLE_CONVERTER=${ENABLE_CONVERTER} "${BASEPATH}/mindspore/lite"
|
||||
-DENABLE_VERBOSE=${ENABLE_VERBOSE} "${BASEPATH}/mindspore/lite"
|
||||
fi
|
||||
make -j$THREAD_NUM && make install && make package
|
||||
COMPILE_RET=$?
|
||||
|
|
|
@ -73,7 +73,9 @@ option(BUILD_DEVICE "if build device" on)
|
|||
option(SUPPORT_TRAIN "if build for on-device train" off)
|
||||
option(PLATFORM_ARM64 "if build device for arm64" off)
|
||||
option(PLATFORM_ARM32 "if build device for arm32" off)
|
||||
option(BUILD_CONVERTER "if build converter" on)
|
||||
option(ENABLE_CONVERTER "if build converter" on)
|
||||
option(ENABLE_TOOLS "if build tools" on)
|
||||
option(BUILD_TESTCASES "if build testcase" on)
|
||||
option(ENABLE_FP16 "if build fp16 ops" off)
|
||||
option(SUPPORT_GPU "if support gpu" off)
|
||||
option(OFFLINE_COMPILE "if offline compile OpenCL kernel" off)
|
||||
|
@ -130,7 +132,7 @@ if (WIN32)
|
|||
add_compile_definitions(BUILDING_DLL)
|
||||
endif ()
|
||||
|
||||
if (BUILD_CONVERTER)
|
||||
if (ENABLE_CONVERTER)
|
||||
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
|
||||
MESSAGE(FATAL_ERROR "Cannot build converter in arm platform")
|
||||
endif()
|
||||
|
@ -191,7 +193,7 @@ if (BUILD_MINDDATA STREQUAL "lite" OR BUILD_MINDDATA STREQUAL "full")
|
|||
find_package(OpenCV REQUIRED)
|
||||
include_directories(${OpenCV_INCLUDE_DIRS})
|
||||
# json
|
||||
if (NOT BUILD_CONVERTER)
|
||||
if (NOT ENABLE_CONVERTER)
|
||||
include(${TOP_DIR}/cmake/external_libs/json.cmake)
|
||||
endif ()
|
||||
# eigen
|
||||
|
@ -221,10 +223,15 @@ if (BUILD_DEVICE)
|
|||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/internal)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/nnacl)
|
||||
if (NOT WIN32)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/time_profiler)
|
||||
if (ENABLE_TOOLS)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/time_profiler)
|
||||
endif()
|
||||
if (BUILD_TESTCASES)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
|
||||
endif()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
endif()
|
||||
|
||||
include(${TOP_DIR}/cmake/package_lite.cmake)
|
||||
|
|
Loading…
Reference in New Issue