pull/13242/head
sunsuodong 4 years ago
parent 4e43fb939a
commit 6fea49b2db

@ -670,9 +670,14 @@ build_lite_java_arm64() {
tar -zxvf ${JTARBALL}.tar.gz
[ -n "${JAVA_PATH}" ] && rm -rf ${JAVA_PATH}/java/app/libs/arm64-v8a/
mkdir -p ${JAVA_PATH}/java/app/libs/arm64-v8a/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/arm64-v8a/
mkdir -p ${JAVA_PATH}/native/libs/arm64-v8a/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/arm64-v8a/
if [[ "X$SUPPORT_TRAIN" = "Xon" ]]; then
cp ${BASEPATH}/output/${JTARBALL}/train/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/arm64-v8a/
cp ${BASEPATH}/output/${JTARBALL}/train/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/arm64-v8a/
else
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/arm64-v8a/
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/arm64-v8a/
fi
[ -n "${VERSION_STR}" ] && rm -rf ${JTARBALL}
}
@ -691,9 +696,14 @@ build_lite_java_arm32() {
tar -zxvf ${JTARBALL}.tar.gz
[ -n "${JAVA_PATH}" ] && rm -rf ${JAVA_PATH}/java/app/libs/armeabi-v7a/
mkdir -p ${JAVA_PATH}/java/app/libs/armeabi-v7a/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/armeabi-v7a/
mkdir -p ${JAVA_PATH}/native/libs/armeabi-v7a/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/armeabi-v7a/
if [[ "X$SUPPORT_TRAIN" = "Xon" ]]; then
cp ${BASEPATH}/output/${JTARBALL}/train/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/armeabi-v7a/
cp ${BASEPATH}/output/${JTARBALL}/train/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/armeabi-v7a/
else
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/java/app/libs/armeabi-v7a/
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/armeabi-v7a/
fi
[ -n "${VERSION_STR}" ] && rm -rf ${JTARBALL}
}
@ -709,9 +719,9 @@ build_lite_java_x86() {
tar -zxvf ${JTARBALL}.tar.gz
[ -n "${JAVA_PATH}" ] && rm -rf ${JAVA_PATH}/java/linux_x86/libs/
mkdir -p ${JAVA_PATH}/java/linux_x86/libs/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/java/linux_x86/libs/
mkdir -p ${JAVA_PATH}/native/libs/linux_x86/
cp ${BASEPATH}/output/${JTARBALL}/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/linux_x86/
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/java/linux_x86/libs/
cp ${BASEPATH}/output/${JTARBALL}/inference/lib/libmindspore-lite.so ${JAVA_PATH}/native/libs/linux_x86/
}
build_jni_arm64() {

@ -1,21 +1,28 @@
include(CMakePackageConfigHelpers)
set(RUNTIME_PKG_NAME ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME})
set(CONVERTER_PKG_NAME ${MAIN_DIR}-${CONVERTER_COMPONENT_NAME})
set(CODEGEN_PKG_NAME ${MAIN_DIR}-${CODEGEN_COMPONENT_NAME})
set(RUNTIME_ROOT_DIR ${RUNTIME_PKG_NAME}/)
set(CONVERTER_ROOT_DIR ${CONVERTER_PKG_NAME}/)
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/lib)
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/include)
set(CONVERTER_LIB_DIR ${CONVERTER_PKG_NAME}/lib)
set(CODEGEN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/codegen)
set(CONVERTER_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/converter)
set(BENCHMARK_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark)
set(BENCHMARK_TRAIN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
set(CROPPER_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/cropper)
set(TURBO_DIR ${RUNTIME_PKG_NAME}/minddata/third_party/libjpeg-turbo)
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/minddata/include)
set(MIND_DATA_LIB_DIR ${RUNTIME_PKG_NAME}/minddata/lib)
set(LIB_DIR_RUN_X86 ${RUNTIME_PKG_NAME}/lib)
if(SUPPORT_TRAIN)
set(RUNTIME_DIR ${RUNTIME_PKG_NAME}/train)
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/train/include)
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/train/lib)
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/train/minddata/include)
set(MIND_DATA_LIB_DIR ${RUNTIME_PKG_NAME}/train/minddata/lib)
set(TURBO_DIR ${RUNTIME_PKG_NAME}/train/minddata/third_party/libjpeg-turbo)
else()
set(RUNTIME_DIR ${RUNTIME_PKG_NAME}/inference)
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/inference/include)
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/inference/lib)
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/inference/minddata/include)
set(MIND_DATA_LIB_DIR ${RUNTIME_PKG_NAME}/inference/minddata/lib)
set(TURBO_DIR ${RUNTIME_PKG_NAME}/inference/minddata/third_party/libjpeg-turbo)
endif()
if(BUILD_MINDDATA STREQUAL "full")
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/liteapi/include/ DESTINATION
@ -110,15 +117,21 @@ if(BUILD_MINDDATA STREQUAL "lite_cv")
endif()
endif()
if(PLATFORM_ARM64)
if(WIN32)
install(FILES ${TOP_DIR}/build/.commit_id DESTINATION ${RUNTIME_PKG_NAME}
COMPONENT ${RUNTIME_COMPONENT_NAME})
else()
install(FILES ${TOP_DIR}/mindspore/lite/build/.commit_id DESTINATION ${RUNTIME_PKG_NAME}
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(PLATFORM_ARM64)
if(SUPPORT_NPU)
install(FILES ${DDK_LIB_PATH}/libhiai.so DESTINATION ${RUNTIME_PKG_NAME}/third_party/hiai_ddk/lib
install(FILES ${DDK_LIB_PATH}/libhiai.so DESTINATION ${RUNTIME_DIR}/third_party/hiai_ddk/lib
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${DDK_LIB_PATH}/libhiai_ir.so DESTINATION ${RUNTIME_PKG_NAME}/third_party/hiai_ddk/lib
install(FILES ${DDK_LIB_PATH}/libhiai_ir.so DESTINATION ${RUNTIME_DIR}/third_party/hiai_ddk/lib
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${DDK_LIB_PATH}/libhiai_ir_build.so DESTINATION ${RUNTIME_PKG_NAME}/third_party/hiai_ddk/lib
install(FILES ${DDK_LIB_PATH}/libhiai_ir_build.so DESTINATION ${RUNTIME_DIR}/third_party/hiai_ddk/lib
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(SUPPORT_TRAIN)
@ -136,14 +149,16 @@ if(PLATFORM_ARM64)
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ascend* ops*" EXCLUDE)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_PKG_NAME}
COMPONENT ${CODEGEN_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(ENABLE_TOOLS)
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS benchmark RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(TARGETS benchmark_train RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
endif()
elseif(PLATFORM_ARM32)
install(FILES ${TOP_DIR}/mindspore/lite/build/.commit_id DESTINATION ${RUNTIME_PKG_NAME}
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
@ -159,57 +174,53 @@ elseif(PLATFORM_ARM32)
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ascend*" EXCLUDE)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_PKG_NAME}
COMPONENT ${CODEGEN_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(ENABLE_TOOLS)
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS benchmark RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(TARGETS benchmark_train RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
endif()
elseif(WIN32)
install(FILES ${TOP_DIR}/build/.commit_id DESTINATION ${RUNTIME_PKG_NAME}
COMPONENT ${RUNTIME_COMPONENT_NAME})
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
file(GLOB LIB_LIST ${CXX_DIR}/libstdc++-6.dll ${CXX_DIR}/libwinpthread-1.dll
${CXX_DIR}/libssp-0.dll ${CXX_DIR}/libgcc_s_seh-1.dll)
if(ENABLE_CONVERTER)
install(FILES ${TOP_DIR}/build/.commit_id DESTINATION ${CONVERTER_PKG_NAME}
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_PKG_NAME}/converter
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(FILES ${LIB_LIST} DESTINATION ${CONVERTER_PKG_NAME}/converter COMPONENT ${CONVERTER_COMPONENT_NAME})
install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_ROOT_DIR}/converter
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${LIB_LIST} DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/mindspore_core/gvar/libmindspore_gvar.dll
DESTINATION ${CONVERTER_PKG_NAME}/converter COMPONENT ${CONVERTER_COMPONENT_NAME})
install(FILES ${glog_LIBPATH}/../bin/libglog.dll DESTINATION ${CONVERTER_PKG_NAME}/converter
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_PKG_NAME}/
COMPONENT ${CODEGEN_COMPONENT_NAME})
DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${glog_LIBPATH}/../bin/libglog.dll DESTINATION ${CONVERTER_ROOT_DIR}/lib
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(ENABLE_TOOLS)
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${flatbuffers_INC} DESTINATION ${RUNTIME_PKG_NAME}/third_party/flatbuffers
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
else()
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE)
endif()
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${RUNTIME_INC_DIR}/ir/dtype
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ascend*" EXCLUDE)
set(WIN_LIB_DIR_RUN_X86 ${RUNTIME_PKG_NAME}/benchmark)
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.a DESTINATION ${WIN_LIB_DIR_RUN_X86}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll.a DESTINATION ${WIN_LIB_DIR_RUN_X86}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll DESTINATION ${WIN_LIB_DIR_RUN_X86}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS benchmark RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
else()
install(FILES ${TOP_DIR}/mindspore/lite/build/.commit_id DESTINATION ${RUNTIME_PKG_NAME}
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${flatbuffers_INC} DESTINATION ${RUNTIME_INC_DIR}/third_party/
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
else()
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE)
endif()
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${RUNTIME_INC_DIR}/ir/dtype
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ascend*" EXCLUDE)
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.a DESTINATION ${RUNTIME_LIB_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll.a DESTINATION ${RUNTIME_LIB_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll DESTINATION ${RUNTIME_LIB_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
else()
if(SUPPORT_TRAIN)
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
@ -226,25 +237,26 @@ else()
install(FILES ${TOP_DIR}/mindspore/lite/build/src/libmindspore-lite.a DESTINATION ${RUNTIME_LIB_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(ENABLE_CONVERTER)
install(FILES ${TOP_DIR}/mindspore/lite/build/.commit_id DESTINATION ${CONVERTER_PKG_NAME}
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_PKG_NAME}/converter
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(TARGETS converter_lite RUNTIME DESTINATION ${CONVERTER_ROOT_DIR}/converter
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/tools/converter/mindspore_core/gvar/libmindspore_gvar.so
DESTINATION ${CONVERTER_PKG_NAME}/lib COMPONENT ${CONVERTER_COMPONENT_NAME})
DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0
DESTINATION ${CONVERTER_PKG_NAME}/third_party/glog/lib RENAME libglog.so.0
COMPONENT ${CONVERTER_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_PKG_NAME}
COMPONENT ${CODEGEN_COMPONENT_NAME})
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_PKG_NAME}/
COMPONENT ${CODEGEN_COMPONENT_NAME})
DESTINATION ${CONVERTER_ROOT_DIR}/third_party/glog/lib RENAME libglog.so.0
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/build/operator_library DESTINATION ${CODEGEN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS codegen RUNTIME DESTINATION ${CODEGEN_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(ENABLE_TOOLS)
install(TARGETS benchmark RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/benchmark COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS cropper RUNTIME DESTINATION ${RUNTIME_PKG_NAME}/cropper COMPONENT ${RUNTIME_COMPONENT_NAME})
install(TARGETS benchmark RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
if(SUPPORT_TRAIN)
install(TARGETS benchmark_train RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR}
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
install(TARGETS cropper RUNTIME DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/build/tools/cropper/cropper_mapping_cpu.cfg
DESTINATION ${RUNTIME_PKG_NAME}/cropper COMPONENT ${RUNTIME_COMPONENT_NAME})
DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
endif()
@ -253,13 +265,11 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
else()
set(CPACK_GENERATOR TGZ)
endif()
set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
if(PLATFORM_ARM64 OR PLATFORM_ARM32)
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME} ${CODEGEN_COMPONENT_NAME})
else()
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME} ${CONVERTER_COMPONENT_NAME} ${CODEGEN_COMPONENT_NAME})
endif()
set(CPACK_COMPONENTS_ALL ${RUNTIME_COMPONENT_NAME})
set(CPACK_PACKAGE_FILE_NAME ${MAIN_DIR})
if(WIN32)
set(CPACK_PACKAGE_DIRECTORY ${TOP_DIR}/output)
else()

@ -79,36 +79,26 @@ if(SUPPORT_TRAIN)
set(RUNTIME_COMPONENT_NAME train-android-aarch32)
elseif(WIN32)
set(RUNTIME_COMPONENT_NAME train-win-x64)
set(CONVERTER_COMPONENT_NAME converter-win-x64)
set(CODEGEN_NAME train-codegen-win-x64)
else()
set(RUNTIME_COMPONENT_NAME train-linux-x64)
set(CONVERTER_COMPONENT_NAME converter-linux-x64)
set(CODEGEN_NAME train-codegen-linux-x64)
endif()
else()
if(PLATFORM_ARM64)
set(RUNTIME_COMPONENT_NAME inference-android-aarch64)
set(CODEGEN_COMPONENT_NAME codegen-android-aarch64)
elseif(PLATFORM_ARM32)
set(RUNTIME_COMPONENT_NAME inference-android-aarch32)
set(CODEGEN_COMPONENT_NAME codegen-android-aarch32)
elseif(WIN32)
if("${X86_64_SIMD}" STREQUAL "off")
set(RUNTIME_COMPONENT_NAME inference-win-x64)
else()
set(RUNTIME_COMPONENT_NAME inference-win-x64-${X86_64_SIMD})
endif()
set(CONVERTER_COMPONENT_NAME converter-win-x64)
set(CODEGEN_COMPONENT_NAME codegen-win-x64)
else()
if("${X86_64_SIMD}" STREQUAL "off")
set(RUNTIME_COMPONENT_NAME inference-linux-x64)
else()
set(RUNTIME_COMPONENT_NAME inference-linux-x64-${X86_64_SIMD})
endif()
set(CONVERTER_COMPONENT_NAME converter-linux-x64)
set(CODEGEN_COMPONENT_NAME codegen-linux-x64)
endif()
endif()

File diff suppressed because one or more lines are too long

@ -7,7 +7,7 @@ function Run_Export(){
if [[ -z "${CLOUD_MODEL_ZOO}" ]]; then
echo "CLOUD_MODEL_ZOO is not defined - exiting export models"
exit 1
fi
fi
# Export mindspore train models:
while read line; do
LFS=" " read -r -a line_array <<< ${line}
@ -34,17 +34,12 @@ function Run_Export(){
# Run converter on x86 platform:
function Run_Converter() {
# Unzip x86 runtime and converter
cd ${x86_path} || exit 1
tar -zxf mindspore-lite-${version}-train-linux-x64.tar.gz || exit 1
cd ${x86_path}/mindspore-lite-${version}-train-linux-x64/ || exit 1
tar -zxf mindspore-lite-${version}-converter-linux-x64.tar.gz || exit 1
cd ${x86_path}/mindspore-lite-${version}-converter-linux-x64 || exit 1
cp converter/converter_lite ./ || exit 1
# Convert the models
cd ${x86_path}/mindspore-lite-${version}-converter-linux-x64 || exit 1
cp tools/converter/converter/converter_lite ./ || exit 1
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./tools/converter/lib/:./tools/converter/third_party/glog/lib
rm -rf ${ms_models_path}
mkdir -p ${ms_models_path}
@ -58,10 +53,7 @@ function Run_Converter() {
fi
echo ${model_name}'_train' >> "${run_converter_log_file}"
echo './converter_lite --fmk=MINDIR --modelFile='${models_path}'/'${model_name}'_train.mindir --outputFile='${ms_models_path}'/'${model_name}'_train --trainModel=true' >> "${run_converter_log_file}"
LD_LIBRARY_PATH=./lib/:./third_party/protobuf/lib:./third_party/flatbuffers/lib:./third_party/glog/lib \
./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name}_train.mindir \
--outputFile=${ms_models_path}/${model_name}'_train' \
--trainModel=true
./converter_lite --fmk=MINDIR --modelFile=${models_path}/${model_name}_train.mindir --outputFile=${ms_models_path}/${model_name}'_train' --trainModel=true
if [ $? = 0 ]; then
converter_result='converter mindspore '${model_name}'_train pass';echo ${converter_result} >> ${run_converter_result_file}
else
@ -74,6 +66,8 @@ function Run_Converter() {
# Run on x86 platform:
function Run_x86() {
cd ${x86_path}/mindspore-lite-${version}-train-linux-x64 || return 1
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./train/lib:./train/minddata/lib:./train/minddata/third_party/libjpeg-turbo/lib
# Run mindspore converted train models:
fail=0
while read line; do
@ -84,12 +78,7 @@ function Run_x86() {
fi
echo ${model_name}'_train' >> "${run_x86_log_file}"
echo 'cd '${x86_path}'/mindspore-lite-'${version}'-train-linux-x64' >> "${run_x86_log_file}"
cd ${x86_path}/mindspore-lite-${version}-train-linux-x64 || return 1
echo 'LD_LIBRARY_PATH='${LD_LIBRARY_PATH}':./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib ./benchmark_train/benchmark_train --epochs='${epoch_num}' --modelFile='${ms_models_path}'/'${model_name}'_train.ms --inDataFile='${train_io_path}/${model_name}_input1.bin,${train_io_path}/${model_name}_input2.bin' --expectedDataFile='${train_io_path}'/'${model_name}'_output --exportFile='${ms_models_path}'/'${model_name}'_train_exported.ms' >> "${run_x86_log_file}"
echo '-------------------------------------------------------------------------------' >> "${run_x86_log_file}"
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./lib:./third_party/libjpeg-turbo/lib:./third_party/opencv/lib:./minddata/lib:./minddata/third_party/libjpeg-turbo/lib \
${run_valgrind}./benchmark_train/benchmark_train \
${run_valgrind}./tools/benchmark_train/benchmark_train \
--modelFile=${ms_models_path}/${model_name}_train.ms \
--inDataFile=${train_io_path}/${model_name}_input1.bin,${train_io_path}/${model_name}_input2.bin \
--expectedDataFile=${train_io_path}/${model_name}_output >> "${run_x86_log_file}" \
@ -135,23 +124,19 @@ function Run_arm() {
# If build with minddata, copy the minddata related libs
cd ${benchmark_train_test_path} || exit 1
if [ -f ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/minddata/lib/libminddata-lite.so ]; then
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/minddata/third_party/libjpeg-turbo/lib/libjpeg.so ${benchmark_train_test_path}/libjpeg.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/minddata/third_party/libjpeg-turbo/lib/libturbojpeg.so ${benchmark_train_test_path}/libturbojpeg.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/minddata/lib/libminddata-lite.so ${benchmark_train_test_path}/libminddata-lite.so || exit 1
if [ -f ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/minddata/lib/libminddata-lite.so ]; then
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/minddata/third_party/libjpeg-turbo/lib/libjpeg.so ${benchmark_train_test_path}/libjpeg.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/minddata/third_party/libjpeg-turbo/lib/libturbojpeg.so ${benchmark_train_test_path}/libturbojpeg.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/minddata/lib/libminddata-lite.so ${benchmark_train_test_path}/libminddata-lite.so || exit 1
fi
if [ "$1" == arm64 ]; then
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai.so ${benchmark_train_test_path}/libhiai.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir.so ${benchmark_train_test_path}/libhiai_ir.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/third_party/hiai_ddk/lib/libhiai_ir_build.so ${benchmark_train_test_path}/libhiai_ir_build.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/third_party/hiai_ddk/lib/libhiai.so ${benchmark_train_test_path}/libhiai.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/third_party/hiai_ddk/lib/libhiai_ir.so ${benchmark_train_test_path}/libhiai_ir.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/third_party/hiai_ddk/lib/libhiai_ir_build.so ${benchmark_train_test_path}/libhiai_ir_build.so || exit 1
fi
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/lib/libmindspore-lite.so ${benchmark_train_test_path}/libmindspore-lite.so || exit 1
# if [ "$1" == arm64 ]; then
# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-fp16.so ${benchmark_train_test_path}/libmindspore-lite-fp16.so || exit 1
# cp -a ${arm_path}/mindspore-lite-${version_arm}-runtime-${arm_type}-${process_unit}-train/lib/libmindspore-lite-optimize.so ${benchmark_train_test_path}/libmindspore-lite-optimize.so || exit 1
# fi
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/benchmark_train/benchmark_train ${benchmark_train_test_path}/benchmark_train || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/lib/libmindspore-lite.so ${benchmark_train_test_path}/libmindspore-lite.so || exit 1
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/tools/benchmark_train/benchmark_train ${benchmark_train_test_path}/benchmark_train || exit 1
# adb push all needed files to the phone
adb -s ${device_id} push ${benchmark_train_test_path} /data/local/tmp/ > ${adb_push_log_file}

@ -17,13 +17,13 @@
setlocal enabledelayedexpansion
SET BASEPATH=%CD%
SET OUTPUT_PATH=%BASEPATH%/output
SET OUTPUT_PATH=%BASEPATH%\output
SET TOOL_PATH=%1
SET TOOL_PATH=%TOOL_PATH:"=%/windows_x64
SET TOOL_PATH=%TOOL_PATH:"=%\windows_x64
SET MODEL_PATH_BASE=%2
SET MODEL_PATH=%MODEL_PATH_BASE:"=%/models/hiai
SET BENCHMARK_BASE=%BASEPATH:"=%/output/benchmark
SET MODEL_CONFIG=%BASEPATH%/win_models.cfg
SET MODEL_PATH=%MODEL_PATH_BASE:"=%\models\hiai
SET BENCHMARK_BASE=%BASEPATH:"=%\output\benchmark
SET MODEL_CONFIG=%BASEPATH%\win_models.cfg
cd /d %BASEPATH%
IF EXIST "%BASEPATH%/output" (
@ -38,22 +38,15 @@ md benchmark
SET RET_CODE=0
7z x -r "%TOOL_PATH%/mindspore-lite-*-converter-win-x64.zip" -o"%BENCHMARK_BASE%"
IF NOT %errorlevel% == 0 (
echo "Decompression of converter tool fail!"
SET RET_CODE=1
goto run_eof
)
SET SO_PATH=mindspore-lite-*-inference-win-x64
SET SO_PATH=mindspore-lite-1.2.0-inference-win-x64
IF "%3%" == "sse" (
SET SO_PATH=mindspore-lite-*-inference-win-x64-sse
SET SO_PATH=mindspore-lite-1.2.0-inference-win-x64-sse
)
IF "%3%" == "avx" (
SET SO_PATH=mindspore-lite-*-inference-win-x64-avx
SET SO_PATH=mindspore-lite-1.2.0-inference-win-x64-avx
)
IF "%3%" == "avx512" (
SET SO_PATH=mindspore-lite-*-inference-win-x64-avx512
SET SO_PATH=mindspore-lite-1.2.0-inference-win-x64-avx512
)
7z x -r "%TOOL_PATH%/%SO_PATH%.zip" -o"%BENCHMARK_BASE%"
IF NOT %errorlevel% == 0 (
@ -70,7 +63,8 @@ SET MODEL_NAME=''
SET SUFFIX=''
echo "Convert models"
cd mindspore-lite-*-converter-win-x64/converter
copy %BENCHMARK_BASE%\%SO_PATH%\tools\converter\lib\* %BENCHMARK_BASE%\%SO_PATH%\tools\converter\converter\
cd /d %BENCHMARK_BASE%\%SO_PATH%\tools\converter\converter\
for /f "tokens=1-2 delims= " %%i in (%MODEL_CONFIG%) do (
for /f "tokens=1-2 delims=." %%k in ("%%j") do (
@ -98,7 +92,8 @@ for /f "tokens=1-2 delims= " %%i in (%MODEL_CONFIG%) do (
)
echo "Run converted models"
cd /d %BENCHMARK_BASE%/%SO_PATH%/benchmark
copy %BENCHMARK_BASE%\%SO_PATH%\inference\lib\* %BENCHMARK_BASE%\%SO_PATH%\tools\benchmark\
cd /d %BENCHMARK_BASE%\%SO_PATH%\tools\benchmark\
SET INPUT_BASE=%MODEL_PATH%/input_output/input
SET OUTPUT_BASE=%MODEL_PATH%/input_output/output

@ -24,7 +24,3 @@ else()
target_link_libraries(benchmark_train mindspore-lite pthread minddata-lite)
endif()
endif()
install(TARGETS benchmark_train
RUNTIME DESTINATION ${MAIN_DIR}-${RUNTIME_COMPONENT_NAME}/benchmark_train
COMPONENT ${RUNTIME_COMPONENT_NAME})

@ -1,5 +1,5 @@
#!/bin/bash
# Copyright 2020 Huawei Technologies Co., Ltd
# Copyright 2020-2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@ -48,83 +48,81 @@ function verify_every_file() {
function android_release_package()
{
for name in "train" "inference"
for arch in "aarch32" "aarch64"
do
src_arm64_pkg_name="mindspore-lite-${version}-${name}-android-aarch64"
src_arm32_pkg_name="mindspore-lite-${version}-${name}-android-aarch32"
dst_android_pkg_name="mindspore-lite-${version}-${name}-android"
tar -xzf ${input_path}/android_aarch64/${src_arm64_pkg_name}.tar.gz
tar -xzf ${input_path}/android_aarch32/${src_arm32_pkg_name}.tar.gz
# ARM32 and ARM64 have the same header file.
mkdir -p ${dst_android_pkg_name}/minddata/
cp -r ${src_arm64_pkg_name}/include/ ${dst_android_pkg_name}/
cp -r ${src_arm64_pkg_name}/minddata/include/ ${dst_android_pkg_name}/minddata/
cp ${src_arm64_pkg_name}/.commit_id ${dst_android_pkg_name}/
# Executable files and dynamic libraries are different in different architectures.
mkdir -p ${dst_android_pkg_name}/benchmark/aarch64/
mkdir -p ${dst_android_pkg_name}/benchmark/aarch32/
mkdir -p ${dst_android_pkg_name}/lib/aarch64/
mkdir -p ${dst_android_pkg_name}/lib/aarch32/
mkdir -p ${dst_android_pkg_name}/minddata/lib/aarch64/
mkdir -p ${dst_android_pkg_name}/minddata/lib/aarch32/
cp ${src_arm64_pkg_name}/benchmark/* ${dst_android_pkg_name}/benchmark/aarch64/
cp ${src_arm32_pkg_name}/benchmark/* ${dst_android_pkg_name}/benchmark/aarch32/
cp ${src_arm64_pkg_name}/lib/* ${dst_android_pkg_name}/lib/aarch64/
cp ${src_arm32_pkg_name}/lib/* ${dst_android_pkg_name}/lib/aarch32/
cp ${src_arm64_pkg_name}/minddata/lib/* ${dst_android_pkg_name}/minddata/lib/aarch64/
cp ${src_arm32_pkg_name}/minddata/lib/* ${dst_android_pkg_name}/minddata/lib/aarch32/
if [ ${name} == "train" ]
then
mkdir -p ${dst_android_pkg_name}/benchmark_train/aarch64/
mkdir -p ${dst_android_pkg_name}/benchmark_train/aarch32/
mkdir -p ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch64/
mkdir -p ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch32/
cp ${src_arm64_pkg_name}/benchmark_train/* ${dst_android_pkg_name}/benchmark_train/aarch64/
cp ${src_arm32_pkg_name}/benchmark_train/* ${dst_android_pkg_name}/benchmark_train/aarch32/
cp ${src_arm64_pkg_name}/minddata/third_party/libjpeg-turbo/lib/* ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch64/
cp ${src_arm32_pkg_name}/minddata/third_party/libjpeg-turbo/lib/* ${dst_android_pkg_name}/minddata/third_party/libjpeg-turbo/lib/aarch32/
fi
mkdir -p ${dst_android_pkg_name}/third_party/hiai_ddk/lib/aarch64/
cp -r ${src_arm64_pkg_name}/third_party/hiai_ddk/lib/* ${dst_android_pkg_name}/third_party/hiai_ddk/lib/aarch64/
if [ ${name} == "inference" ]
then
# Copy java runtime to Android package
cp ${input_path}/aar/* ${dst_android_pkg_name}
fi
src_inference_pkg_name="mindspore-lite-${version}-inference-android-${arch}"
src_train_pkg_name="mindspore-lite-${version}-train-android-${arch}"
dst_pkg_name="mindspore-lite-${version}-android-${arch}"
rm -rf ${src_inference_pkg_name}
rm -rf ${src_train_pkg_name}
rm -rf ${dst_pkg_name}
tar -xzf ${input_path}/android_${arch}/${src_inference_pkg_name}.tar.gz
tar -xzf ${input_path}/android_${arch}/${src_train_pkg_name}.tar.gz
cp -r ${src_train_pkg_name}/tools/benchmark_train/ ${src_inference_pkg_name}/tools/
cp -r ${src_train_pkg_name}/train/ ${src_inference_pkg_name}/
mkdir -p ${output_path}/release/android/
tar -czf ${output_path}/release/android/${dst_android_pkg_name}.tar.gz ${dst_android_pkg_name}
mv ${src_inference_pkg_name} ${dst_pkg_name}
# Copy java runtime to Android package
cp ${input_path}/aar/* ${dst_pkg_name}
tar -czf ${output_path}/release/android/${dst_pkg_name}.tar.gz ${dst_pkg_name}
cd ${output_path}/release/android/
sha256sum ${dst_android_pkg_name}.tar.gz > ${dst_android_pkg_name}.tar.gz.sha256
sha256sum ${dst_pkg_name}.tar.gz > ${dst_pkg_name}.tar.gz.sha256
cd -
verify_every_file ${src_arm64_pkg_name} ${dst_android_pkg_name}
verify_every_file ${src_arm32_pkg_name} ${dst_android_pkg_name}
rm -rf ${src_arm64_pkg_name}
rm -rf ${src_arm32_pkg_name}
rm -rf ${dst_android_pkg_name}
verify_every_file ${src_train_pkg_name}/tools/benchmark_train/ ${dst_pkg_name}
verify_every_file ${src_train_pkg_name}/train/ ${dst_pkg_name}
rm -rf ${src_train_pkg_name}
rm -rf ${dst_pkg_name}
done
}
function linux_release_package()
{
src_inference_pkg_name="mindspore-lite-${version}-inference-linux-x64-avx"
src_train_pkg_name="mindspore-lite-${version}-train-linux-x64"
dst_pkg_name="mindspore-lite-${version}-linux-x64"
rm -rf ${src_inference_pkg_name}
rm -rf ${src_train_pkg_name}
rm -rf ${dst_pkg_name}
tar -xzf ${input_path}/ubuntu_x86/${src_inference_pkg_name}.tar.gz
tar -xzf ${input_path}/ubuntu_x86/${src_train_pkg_name}.tar.gz
cp -r ${src_train_pkg_name}/tools/benchmark_train/ ${src_inference_pkg_name}/tools/
cp -r ${src_train_pkg_name}/train/ ${src_inference_pkg_name}/
mkdir -p ${output_path}/release/linux/
cp ${input_path}/ubuntu_x86/mindspore-lite-${version}-converter-* ${output_path}/release/linux/
cp ${input_path}/ubuntu_x86/mindspore-lite-${version}-inference-linux-x64-avx.tar.gz ${output_path}/release/linux/mindspore-lite-${version}-inference-linux-x64.tar.gz
cp ${input_path}/ubuntu_x86/mindspore-lite-${version}-inference-linux-x64-avx.tar.gz.sha256 ${output_path}/release/linux/mindspore-lite-${version}-inference-linux-x64.tar.gz.sha256
cp ${input_path}/ubuntu_x86/mindspore-lite-${version}-train-* ${output_path}/release/linux/
mv ${src_inference_pkg_name} ${dst_pkg_name}
tar -czf ${output_path}/release/linux/${dst_pkg_name}.tar.gz ${dst_pkg_name}
cd ${output_path}/release/linux/
sha256sum ${dst_pkg_name}.tar.gz > ${dst_pkg_name}.tar.gz.sha256
cd -
verify_every_file ${src_train_pkg_name}/tools/benchmark_train/ ${dst_pkg_name}
verify_every_file ${src_train_pkg_name}/train/ ${dst_pkg_name}
rm -rf ${src_train_pkg_name}
rm -rf ${dst_pkg_name}
}
function windows_release_package()
{
src_inference_pkg_name="mindspore-lite-${version}-inference-win-x64-avx"
dst_pkg_name="mindspore-lite-${version}-win-x64"
rm -rf ${src_inference_pkg_name}
rm -rf ${dst_pkg_name}
unzip ${input_path}/windows_x64/${src_inference_pkg_name}.zip
mv ${src_inference_pkg_name} ${dst_pkg_name}
mkdir -p ${output_path}/release/windows/
cp ${input_path}/windows_x64/mindspore-lite-${version}-converter-* ${output_path}/release/windows/
cp ${input_path}/windows_x64/mindspore-lite-${version}-inference-win-x64-avx.zip ${output_path}/release/windows/mindspore-lite-${version}-inference-win-x64.zip
cp ${input_path}/windows_x64/mindspore-lite-${version}-inference-win-x64-avx.zip.sha256 ${output_path}/release/windows/mindspore-lite-${version}-inference-win-x64.zip.sha256
zip -r ${output_path}/release/windows/${dst_pkg_name}.zip ${dst_pkg_name}
cd ${output_path}/release/windows/
sha256sum ${dst_pkg_name}.zip > ${dst_pkg_name}.zip.sha256
cd -
rm -rf ${dst_pkg_name}
}
echo "============================== begin =============================="

Loading…
Cancel
Save