online infer

This commit is contained in:
zhengyuanhua 2021-12-06 17:32:22 +08:00
parent ebae4ac5ec
commit 889a613327
22 changed files with 203 additions and 49 deletions

View File

@ -56,11 +56,11 @@ IF "%1%" == "lite" (
rd /s /q "%BASE_PATH%\output"
(git log -1 | findstr "^commit") > %BUILD_PATH%\.commit_id
IF defined VisualStudioVersion (
cmake -DBUILD_MINDDATA=off -DMSLITE_ENABLE_TRAIN=off ^
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off ^
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
-DCMAKE_BUILD_TYPE=Release -G "Ninja" "%BASE_PATH%/mindspore/lite"
) ELSE (
cmake -DBUILD_MINDDATA=off -DMSLITE_ENABLE_TRAIN=off ^
cmake -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off ^
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
-DCMAKE_BUILD_TYPE=Release -G "CodeBlocks - MinGW Makefiles" "%BASE_PATH%/mindspore/lite"
)

View File

@ -16,7 +16,7 @@ mindspore_add_pkg(c-ares
-DCARES_STATIC:BOOL=ON
-DCARES_STATIC_PIC:BOOL=ON
-DHAVE_LIBNSL:BOOL=OFF
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/c-ares/CVE-2021-3672.patch)
PATCHES ${TOP_DIR}/third_party/patch/c-ares/CVE-2021-3672.patch)
include_directories(${c-ares_INC})
add_library(mindspore::cares ALIAS c-ares::cares)

View File

@ -14,7 +14,7 @@ mindspore_add_pkg(cppjieba
HEAD_ONLY ./
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/cppjieba/cppjieba.patch001)
PATCHES ${TOP_DIR}/third_party/patch/cppjieba/cppjieba.patch001)
include_directories(${cppjieba_INC}include)
include_directories(${cppjieba_INC}deps)
add_library(mindspore::cppjieba ALIAS cppjieba)

View File

@ -55,7 +55,7 @@ mindspore_add_pkg(grpc
EXE grpc_cpp_plugin
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/grpc/grpc.patch001
PATCHES ${TOP_DIR}/third_party/patch/grpc/grpc.patch001
CMAKE_OPTION -DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS=ON
-DgRPC_INSTALL:BOOL=ON

View File

@ -38,7 +38,7 @@ else()
LIBS ${LIB_ICU_COMMON} ${LIB_ICU_DATA} ${LIB_ICU_I18N}
URL ${REQ_URL}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/icu4c/icu4c.patch01
PATCHES ${TOP_DIR}/third_party/patch/icu4c/icu4c.patch01
CONFIGURE_COMMAND ./icu4c/source/runConfigureICU Linux --enable-rpath --disable-tests --disable-samples
--disable-icuio --disable-extras
ICU_DATA_FILTER_FILE=${CMAKE_BINARY_DIR}/icu4c_filter.json

View File

@ -39,7 +39,7 @@ else()
CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DSPM_USE_BUILTIN_PROTOBUF=OFF -DSPM_ENABLE_SHARED=OFF
-DPROTOBUF_INC=${protobuf_INC}
MD5 ${MD5}
PATCHES ${CMAKE_SOURCE_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001
PATCHES ${TOP_DIR}/third_party/patch/sentencepiece/sentencepiece.patch001
)
endif()
endif()

View File

@ -8,6 +8,7 @@ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
endif()
set(_ms_tmp_CMAKE_CXX_FLAGS_F ${CMAKE_CXX_FLAGS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
set(TOP_DIR ${CMAKE_SOURCE_DIR})
include(cmake/utils.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/external_libs/eigen.cmake)

View File

@ -31,7 +31,7 @@ set(BENCHMARK_TRAIN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
# full mode will also package the files of lite_cv mode.
if(BUILD_MINDDATA STREQUAL "full")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "full")
# full header files
install(FILES
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h
@ -78,7 +78,7 @@ if(BUILD_MINDDATA STREQUAL "full")
DESTINATION ${MIND_DATA_INC_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
endif()
if(BUILD_MINDDATA STREQUAL "wrapper")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper")
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/ DESTINATION ${MIND_DATA_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "vision.h" EXCLUDE)
if(PLATFORM_ARM64)
@ -99,7 +99,7 @@ if(BUILD_MINDDATA STREQUAL "wrapper")
endif()
endif()
if(BUILD_MINDDATA STREQUAL "lite")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite")
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/ DESTINATION ${MIND_DATA_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
if(PLATFORM_ARM64)
@ -126,7 +126,7 @@ if(BUILD_MINDDATA STREQUAL "lite")
endif()
endif()
if(BUILD_MINDDATA STREQUAL "lite_cv")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite_cv")
if(PLATFORM_ARM64)
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/kernels/image/lite_cv
DESTINATION ${MIND_DATA_INC_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
@ -549,6 +549,53 @@ else()
set(LITE_ACL_DIR ${TOP_DIR}/mindspore/lite/build/tools/converter/adapter/acl)
install(FILES ${LITE_ACL_DIR}/mindspore_shared_lib/libmindspore_shared_lib.so
DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
if(MSLITE_ENABLE_RUNTIME_CONVERT)
install(FILES ${LITE_ACL_DIR}/mindspore_shared_lib/libmindspore_shared_lib.so
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${RUNTIME_LIB_DIR} RENAME libglog.so.0
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "cloud" AND MSLITE_ENABLE_RUNTIME_CONVERT)
file(GLOB DATA_ENGINE_LIB_LIST ${LITE_ACL_DIR}/_c_dataengine/*.so)
file(GLOB DATA_RECORD_LIB_LIST ${LITE_ACL_DIR}/_c_mindrecord/*.so)
install(FILES ${DATA_ENGINE_LIB_LIST}
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${DATA_RECORD_LIB_LIST}
DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${jpeg_turbo_LIBPATH}/libjpeg.so.62.3.0
DESTINATION ${RUNTIME_LIB_DIR} RENAME libjpeg.so.62 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${jpeg_turbo_LIBPATH}/libturbojpeg.so.0.2.0
DESTINATION ${RUNTIME_LIB_DIR} RENAME libturbojpeg.so.0 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${tinyxml2_LIBPATH}/libtinyxml2.so.8.0.0
DESTINATION ${RUNTIME_LIB_DIR} RENAME libtinyxml2.so.8 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicuuc.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicuuc.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicudata.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicudata.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${icu4c_LIBPATH}/libicui18n.so.67.1
DESTINATION ${RUNTIME_LIB_DIR} RENAME libicui18n.so.67 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc++.so.1.36.1 DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_grpc++.so.1 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_grpc.so.15.0.0 DESTINATION
${RUNTIME_LIB_DIR} RENAME libmindspore_grpc.so.15 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_gpr.so.15.0.0 DESTINATION
${RUNTIME_LIB_DIR} RENAME libmindspore_gpr.so.15 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_upb.so.15.0.0 DESTINATION
${RUNTIME_LIB_DIR} RENAME libmindspore_upb.so.15 COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${grpc_LIBPATH}/libmindspore_address_sorting.so.15.0.0 DESTINATION ${RUNTIME_LIB_DIR}
RENAME libmindspore_address_sorting.so.15 COMPONENT ${RUNTIME_COMPONENT_NAME})
## Public header files for minddata
install(
FILES ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/config.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/constants.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/execute.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/text.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/transforms.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_lite.h
${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/dataset/vision_ascend.h
DESTINATION ${RUNTIME_INC_DIR}/dataset COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
endif()
if(MSLITE_ENABLE_DPICO_ATC_ADAPTER)

View File

@ -210,7 +210,11 @@ endif()
######################################################################
################# Link with external libraries ########################
target_link_libraries(_c_dataengine PRIVATE mindspore mindspore_gvar)
if(MSLITE_ENABLE_CLOUD_MIND_DATA)
target_link_libraries(_c_dataengine PRIVATE mindspore_gvar)
else()
target_link_libraries(_c_dataengine PRIVATE mindspore mindspore_gvar)
endif()
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if(ENABLE_PYTHON)
@ -258,7 +262,12 @@ else()
endif()
endif()
target_link_libraries(_c_dataengine PRIVATE mindspore_core mindspore_shared_lib)
if(MSLITE_ENABLE_CLOUD_MIND_DATA)
target_link_libraries(_c_dataengine PRIVATE mindspore_shared_lib mindspore::grpc++)
target_link_libraries(_c_dataengine PUBLIC mindspore::protobuf)
else()
target_link_libraries(_c_dataengine PRIVATE mindspore_core mindspore_shared_lib)
endif()
if(USE_GLOG)
target_link_libraries(_c_dataengine PRIVATE mindspore::glog)
@ -278,7 +287,7 @@ if(MS_BUILD_GRPC)
endif()
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT MSLITE_ENABLE_CLOUD_MIND_DATA)
set_target_properties(_c_dataengine PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
endif()

View File

@ -29,3 +29,7 @@ add_dependencies(core mindspore::protobuf)
if(ENABLE_PYTHON)
target_include_directories(core PRIVATE ${pybind11_INCLUDE_DIRS})
endif()
if(MSLITE_ENABLE_CLOUD_MIND_DATA)
add_dependencies(core fbs_src)
endif()

View File

@ -21,7 +21,7 @@
#include <memory>
#include "include/api/status.h"
#include "include/api/types.h"
#ifdef ENABLE_ANDROID
#if defined(ENABLE_ANDROID) || defined(ENABLE_LITE_TENSOR)
#include "mindspore/lite/src/cxx_api/tensor/tensor_impl.h"
#else
#include "mindspore/core/ir/api_tensor_impl.h"

View File

@ -143,3 +143,6 @@ else()
endif()
add_dependencies(engine-cache-client generated_engine_files)
if(MSLITE_ENABLE_CLOUD_MIND_DATA)
add_dependencies(engine-cache-client fbs_src)
endif()

View File

@ -9,3 +9,6 @@ add_library(dvpp-utils OBJECT
ErrorCode.cpp
ResourceManager.cc
)
if(MSLITE_ENABLE_CLOUD_MIND_DATA)
add_dependencies(dvpp-utils fbs_src)
endif()

View File

@ -34,8 +34,11 @@ set_target_properties(_c_mindrecord PROPERTIES
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(_c_mindrecord PRIVATE mindspore::sqlite mindspore mindspore_gvar mindspore::protobuf)
else()
target_link_libraries(_c_mindrecord PRIVATE mindspore::sqlite ${PYTHON_LIB} ${SECUREC_LIBRARY} mindspore
target_link_libraries(_c_mindrecord PRIVATE mindspore::sqlite ${PYTHON_LIB} ${SECUREC_LIBRARY}
mindspore_gvar mindspore::protobuf)
if(NOT MSLITE_ENABLE_CLOUD_MIND_DATA)
target_link_libraries(_c_mindrecord PRIVATE mindspore)
endif()
endif()
if(USE_GLOG)
@ -48,6 +51,6 @@ else()
endif()
endif()
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
if(NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" AND NOT MSLITE_ENABLE_CLOUD_MIND_DATA)
set_target_properties(_c_mindrecord PROPERTIES INSTALL_RPATH ${MINDSPORE_RPATH})
endif()

View File

@ -11,6 +11,7 @@ set(MSLITE_GPU_BACKEND "" CACHE STRING "enable gpu backend, \
opencl only support arm64 and x86_64 , tensorrt only support x86_64, opencl/cuda/tensorrt/off")
set(MSLITE_REGISTRY_DEVICE "off" CACHE STRING "Compile Mindspore Lite that supports specific devices, \
currently supported devices: Hi3516D/Hi3519A/Hi3559A/SD3403")
set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full")
option(MSLITE_ENABLE_NPU "enable npu, only arm64 or arm32 support" off)
option(MSLITE_ENABLE_TRAIN "enable train" on)
option(MSLITE_ENABLE_SSE "enable SSE instruction set, only x86_64 support" off)
@ -32,6 +33,7 @@ option(MSLITE_ENABLE_V0 "support v0 schema" on)
option(MSLITE_ENABLE_FP16 "Whether to compile Fp16 operator" off)
option(MSLITE_ENABLE_INT8 "Whether to compile Int8 operator" on)
option(MSLITE_ENABLE_ACL "enable ACL" off)
option(MSLITE_MINDDATA_IMPLEMENT "enable mind data impl" lite_cv)
option(MSLITE_ENABLE_MODEL_ENCRYPTION "enable model encryption, only converter support" on)
option(MSLITE_ENABLE_SPARSE_COMPUTE "enable sparse kernel" off)
option(MSLITE_ENABLE_RUNTIME_CONVERT "enable runtime convert" off)
@ -42,7 +44,6 @@ option(MSLITE_ENABLE_SHARING_MEM_WITH_OPENGL "enable sharing memory with OpenGL"
#Option that can be configured through manually
option(ENABLE_VERBOSE "" off)
option(ENABLE_MODEL_OBF "if support model obfuscation" off)
set(BUILD_MINDDATA "lite_cv" CACHE STRING "off, lite, lite_cv, wrapper or full")
if(MACHINE_LINUX_ARM64)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8.2-a+fp16")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8.2-a+fp16")
@ -120,6 +121,9 @@ endif()
if(DEFINED ENV{MSLITE_ENABLE_ACL})
set(MSLITE_ENABLE_ACL $ENV{MSLITE_ENABLE_ACL})
endif()
if(DEFINED ENV{MSLITE_MINDDATA_IMPLEMENT})
set(MSLITE_MINDDATA_IMPLEMENT $ENV{MSLITE_MINDDATA_IMPLEMENT})
endif()
if(DEFINED ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
set(MSLITE_ENABLE_MODEL_ENCRYPTION $ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
endif()
@ -164,6 +168,8 @@ endif()
if(NOT MSLITE_ENABLE_ACL)
set(ENABLE_GLIBCXX ON)
else()
set(MSLITE_ENABLE_TRAIN off)
endif()
if(PLATFORM_ARM64)
@ -212,7 +218,7 @@ else()
set(MSLITE_ENABLE_NPU off)
endif()
if(MSLITE_ENABLE_SSE OR MSLITE_ENABLE_AVX OR MSLITE_ENABLE_AVX512 OR WIN32 OR MSLITE_ENABLE_ACL)
if(MSLITE_ENABLE_SSE OR MSLITE_ENABLE_AVX OR MSLITE_ENABLE_AVX512 OR WIN32)
set(MSLITE_ENABLE_RUNTIME_CONVERT off)
endif()
@ -233,7 +239,7 @@ endif()
if(MSLITE_ENABLE_TRAIN)
set(SUPPORT_TRAIN on)
set(BUILD_MINDDATA full)
set(MSLITE_MINDDATA_IMPLEMENT full)
endif()
if(MSLITE_ENABLE_NPU)
@ -276,7 +282,7 @@ message(STATUS "\tMSLITE_ENABLE_WEIGHT_DECODE = \t${MSLITE_ENABLE_WEIGHT_D
message(STATUS "\tMSLITE_ENABLE_CUSTOM_KERNEL = \t${MSLITE_ENABLE_CUSTOM_KERNEL}")
message(STATUS "\tMSLITE_ENABLE_MINDRT = \t${MSLITE_ENABLE_MINDRT}")
message(STATUS "\tMSLITE_ENABLE_V0 = \t${MSLITE_ENABLE_V0}")
message(STATUS "\tBUILD_MINDDATA = \t${BUILD_MINDDATA}")
message(STATUS "\tMSLITE_MINDDATA_IMPLEMENT = \t${MSLITE_MINDDATA_IMPLEMENT}")
message(STATUS "\tMSLITE_ENABLE_DELEGATE = \t${MSLITE_ENABLE_DELEGATE}")
message(STATUS "\tMSLITE_ENABLE_ACL = \t${MSLITE_ENABLE_ACL}")
message(STATUS "\tMSLITE_ENABLE_FP16 = \t${MSLITE_ENABLE_FP16}")
@ -409,8 +415,8 @@ if(MSLITE_GPU_BACKEND STREQUAL opencl)
include(${TOP_DIR}/cmake/external_libs/opencl.cmake)
endif()
if(MSLITE_ENABLE_CONVERTER OR BUILD_MINDDATA STREQUAL "full" OR BUILD_MINDDATA STREQUAL "wrapper" OR
MSLITE_ENABLE_TOOLS)
if(MSLITE_ENABLE_CONVERTER OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "full" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper"
OR MSLITE_ENABLE_TOOLS)
include(${TOP_DIR}/cmake/external_libs/json.cmake)
endif()
@ -556,7 +562,8 @@ if(NOT PLATFORM_ARM)
endif()
endif()
if(BUILD_MINDDATA STREQUAL "lite" OR BUILD_MINDDATA STREQUAL "full" OR BUILD_MINDDATA STREQUAL "wrapper")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "full"
OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper")
add_compile_definitions(ENABLE_ANDROID)
if(NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
add_compile_definitions(ENABLE_MD_LITE_X86_64)
@ -564,7 +571,7 @@ if(BUILD_MINDDATA STREQUAL "lite" OR BUILD_MINDDATA STREQUAL "full" OR BUILD_MIN
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minddata)
endif()
if(BUILD_MINDDATA STREQUAL "lite_cv")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite_cv")
add_compile_definitions(ENABLE_ANDROID)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minddata)
endif()

View File

@ -146,7 +146,7 @@ build_lite() {
if [[ "$(uname)" == "Darwin" && "${local_lite_platform}" != "x86_64" ]]; then
LITE_CMAKE_ARGS=`echo $LITE_CMAKE_ARGS | sed 's/-DCMAKE_BUILD_TYPE=Debug/-DCMAKE_BUILD_TYPE=Release/g'`
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off -DMSLITE_ENABLE_NPU=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DENABLE_BITCODE=0 -G Xcode"
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/cmake/lite_ios.cmake
fi
@ -177,17 +177,17 @@ build_lite() {
elif [[ "${TOOLCHAIN_NAME}" == "ohos-lite" ]]; then
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/mindspore/lite/cmake/ohos-lite.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DTOOLCHAIN_NAME=ohos-lite"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=off"
elif [[ "${TOOLCHAIN_NAME}" == "himix200" ]]; then
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/mindspore/lite/cmake/himix200.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DTOOLCHAIN_NAME=himix200"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off"
else
checkndk
CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=lite_cv"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=on"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DANDROID_NATIVE_API_LEVEL=19 -DANDROID_NDK=${ANDROID_NDK} -DANDROID_ABI=armeabi-v7a -DANDROID_TOOLCHAIN_NAME=clang -DANDROID_STL=${MSLITE_ANDROID_STL}"
fi
@ -200,24 +200,24 @@ build_lite() {
elif [[ "${TOOLCHAIN_NAME}" == "himix100" ]]; then
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/mindspore/lite/cmake/himix100.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DTOOLCHAIN_NAME=himix100"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off"
elif [[ "${TOOLCHAIN_NAME}" == "mix210" ]]; then
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/mindspore/lite/cmake/mix210.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DTOOLCHAIN_NAME=mix210"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=on -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off"
else
if [[ "${machine}" == "aarch64" ]]; then
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMACHINE_LINUX_ARM64=on"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_TRAIN=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_GPU_BACKEND=off"
else
checkndk
CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DANDROID_NATIVE_API_LEVEL=19 -DANDROID_NDK=${ANDROID_NDK} -DANDROID_ABI=arm64-v8a -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang -DANDROID_STL=${MSLITE_ANDROID_STL}"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=lite_cv"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
fi
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=on"
fi
@ -226,11 +226,11 @@ build_lite() {
pkg_name=mindspore-lite-${VERSION_STR}-ios-simulator
CMAKE_TOOLCHAIN_FILE=${BASEPATH}/cmake/lite_ios.cmake
LITE_CMAKE_ARGS=`echo $LITE_CMAKE_ARGS | sed 's/-DCMAKE_BUILD_TYPE=Debug/-DCMAKE_BUILD_TYPE=Release/g'`
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DPLATFORM=SIMULATOR64 -DPLATFORM_ARM64=off -DENABLE_NEON=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off -DMSLITE_ENABLE_NPU=off -DBUILD_MINDDATA=off -DMSLITE_ENABLE_V0=on"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DPLATFORM=SIMULATOR64 -DPLATFORM_ARM64=off -DENABLE_NEON=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off -DMSLITE_ENABLE_NPU=off -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_V0=on"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_TOOLS=off -DMSLITE_ENABLE_CONVERTER=off"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -G Xcode .."
else
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DBUILD_MINDDATA=lite_cv"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DPLATFORM_X86_64=on"
fi
fi

View File

@ -0,0 +1,21 @@
## find python, quit if the found python is static
if(CMAKE_SYSTEM_NAME MATCHES "Windows")
set(Python3_FIND_REGISTRY LAST)
set(Python3_FIND_STRATEGY LOCATION)
endif()
set(Python3_USE_STATIC_LIBS FALSE)
set(Python3_FIND_VIRTUALENV ONLY)
find_package(Python3 COMPONENTS Interpreter Development)
if(Python3_FOUND)
message("Python3 found, version: ${Python3_VERSION}")
message("Python3 library path: ${Python3_LIBRARY}")
message("Python3 interpreter: ${Python3_EXECUTABLE}")
elseif(Python3_LIBRARY AND Python3_EXECUTABLE AND
${Python3_VERSION} VERSION_GREATER_EQUAL "3.7.0" AND ${Python3_VERSION} VERSION_LESS "3.9.9")
message(WARNING "Maybe python3 environment is broken.")
message("Python3 library path: ${Python3_LIBRARY}")
message("Python3 interpreter: ${Python3_EXECUTABLE}")
else()
message(FATAL_ERROR "Python3 not found, please install Python>=3.7.5, and set --enable-shared "
"if you are building Python locally")
endif()

View File

@ -101,7 +101,7 @@ AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/image/lite_cv MINDDATA_KERNELS_IMA
AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/ir MINDDATA_KERNELS_IR_SRC_FILES)
if(BUILD_MINDDATA STREQUAL "full")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "full")
include_directories("${MINDDATA_DIR}")
include_directories("${MINDDATA_DIR}/kernels/image")
include_directories("${MINDDATA_DIR}/liteapi")
@ -332,7 +332,7 @@ if(BUILD_MINDDATA STREQUAL "full")
target_link_libraries(minddata-lite_static log)
elseif()
endif()
elseif(BUILD_MINDDATA STREQUAL "wrapper")
elseif(MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper")
include_directories("${MINDDATA_DIR}/kernels/image")
include_directories("${MINDDATA_DIR}/util")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/wrapper)
@ -461,7 +461,7 @@ elseif(BUILD_MINDDATA STREQUAL "wrapper")
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(minddata-lite log)
endif()
elseif(BUILD_MINDDATA STREQUAL "lite")
elseif(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite")
list(REMOVE_ITEM MINDDATA_CORE_SRC_FILES "${MINDDATA_DIR}/core/client.cc")
list(REMOVE_ITEM MINDDATA_KERNELS_SRC_FILES "${MINDDATA_DIR}/kernels/py_func_op.cc")
add_library(minddata_eager_mid OBJECT
@ -597,7 +597,7 @@ elseif(BUILD_MINDDATA STREQUAL "lite")
endif()
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
endif()
elseif(BUILD_MINDDATA STREQUAL "lite_cv")
elseif(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite_cv")
include_directories(${MINDDATA_DIR}/kernels/image)
message(STATUS ${MINDDATA_DIR}/kernels/image)
add_library(minddata-lite SHARED

View File

@ -69,12 +69,10 @@ file(GLOB CXX_API_SRCS
file(GLOB C_API_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/c_api/*.cc
)
set(API_SRC
${CORE_DIR}/utils/status.cc
${CXX_API_SRCS}
${C_API_SRCS}
)
set(API_SRC ${CXX_API_SRCS} ${C_API_SRCS})
if(NOT MSLITE_ENABLE_RUNTIME_CONVERT)
set(API_SRC ${API_SRC} ${CORE_DIR}/utils/status.cc)
endif()
file(GLOB CXX_API_TRAIN_SRCS
${CMAKE_CURRENT_SOURCE_DIR}/cxx_api/train/*.cc
@ -388,7 +386,7 @@ if(PLATFORM_ARM32 OR PLATFORM_ARM64 AND NOT TARGET_HIMIX
target_link_libraries(mindspore-lite log)
target_link_libraries(mindspore-lite_static log)
endif()
if(BUILD_MINDDATA STREQUAL "lite")
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite")
target_link_libraries(mindspore-lite minddata_eager_mid minddata-lite)
target_link_libraries(mindspore-lite_static minddata_eager_mid)
endif()
@ -424,13 +422,21 @@ if(MSLITE_ENABLE_RUNTIME_CONVERT)
target_link_libraries(mindspore-lite
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core
config_parser_mid mslite_converter_plugin
-Wl,--whole-archive mindspore_core -Wl,--no-whole-archive
mindspore::protobuf ${SECUREC_LIBRARY})
target_link_libraries(mindspore-lite_static
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core
config_parser_mid mslite_converter_plugin
-Wl,--whole-archive mindspore_core -Wl,--no-whole-archive
mindspore::protobuf ${SECUREC_LIBRARY})
if(MSLITE_ENABLE_ACL)
target_link_libraries(mindspore-lite lite_acl_mid
mindspore_shared_lib)
target_link_libraries(mindspore-lite_static lite_acl_mid
mindspore_shared_lib)
endif()
endif()
if(MSLITE_ENABLE_RUNTIME_GLOG)

View File

@ -33,6 +33,9 @@ char *RuntimeConvert(const char *model_buf, const size_t &buf_size, size_t *size
flag->outputDataType = kTypeUnknown;
flag->saveFP16 = false;
flag->trainModel = false;
#ifdef ENABLE_LITE_ACL
flag->device = "Ascend310";
#endif
Converter cvt;
auto meta_graph = cvt.Convert(flag, model_buf, buf_size);

View File

@ -8,6 +8,10 @@ include_directories(${TOP_DIR}/graphengine/third_party/fwkacllib/inc)
include_directories(${TOP_DIR}/graphengine/third_party/fwkacllib/inc/toolchain)
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
if(MSLITE_ENABLE_RUNTIME_CONVERT)
add_compile_definitions(ENABLE_ONLINE_MODEL_INFER)
endif()
file(GLOB ACL_SRC
${CMAKE_CURRENT_SOURCE_DIR}/*.cc
${CMAKE_CURRENT_SOURCE_DIR}/common/*.cc
@ -23,5 +27,44 @@ add_subdirectory(${TOP_DIR}/mindspore/ccsrc/cxx_api mindspore_shared_lib)
set_property(SOURCE ${ACL_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
add_library(lite_acl_mid OBJECT ${ACL_SRC})
add_dependencies(lite_acl_mid fbs_inner_src)
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "cloud")
set(MSLITE_ENABLE_CLOUD_MIND_DATA ON)
# find python
include(${TOP_DIR}/mindspore/lite/cmake/python.cmake)
if(Python3_FOUND)
set(PYTHON_INCLUDE_DIRS "${Python3_INCLUDE_DIRS}")
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
else()
find_python_package(py_inc py_lib)
set(PYTHON_INCLUDE_DIRS "${py_inc}")
set(PYTHON_LIBRARIES "${py_lib}")
endif()
message("Python version: ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")
include_directories(${PYTHON_INCLUDE_DIRS})
# MindData
add_compile_definitions(ENABLE_LITE_TENSOR)
add_compile_definitions(ENABLE_PYTHON)
set(ENABLE_PYTHON ON)
include(${TOP_DIR}/cmake/external_libs/sentencepiece.cmake)
include(${TOP_DIR}/cmake/external_libs/jpeg_turbo.cmake)
include(${TOP_DIR}/cmake/external_libs/tinyxml2.cmake)
include(${TOP_DIR}/cmake/external_libs/icu4c.cmake)
include(${TOP_DIR}/cmake/external_libs/sqlite.cmake)
include(${TOP_DIR}/cmake/external_libs/pybind11.cmake)
include(${TOP_DIR}/cmake/external_libs/cppjieba.cmake)
include(${TOP_DIR}/cmake/external_libs/re2.cmake)
include(${TOP_DIR}/cmake/external_libs/c-ares.cmake)
include(${TOP_DIR}/cmake/external_libs/absl.cmake)
include(${TOP_DIR}/cmake/external_libs/grpc.cmake)
set(MINDDATA_DIR ${CCSRC_DIR}/minddata/dataset)
include_directories("${MINDDATA_DIR}/kernels/image")
add_subdirectory(${CCSRC_DIR}/minddata/mindrecord _c_mindrecord)
add_subdirectory(${CCSRC_DIR}/minddata/dataset _c_dataengine)
endif()

View File

@ -257,6 +257,10 @@ STATUS AclPassImpl::PreProcGraph(const FuncGraphPtr &func_graph) {
}
STATUS AclPassImpl::PostProcGraph(const FuncGraphPtr &func_graph) {
#ifdef ENABLE_ONLINE_MODEL_INFER
MS_LOG(DEBUG) << "Online model infer no need to change to nhwc format.";
return lite::RET_OK;
#endif
if (fmk_type_ == converter::kFmkTypeTf) {
MS_LOG(DEBUG) << "Tf no need to change to nhwc format.";
return lite::RET_OK;