forked from mindspore-Ecosystem/mindspore
merge compilation of MS Lite Inference and Train
This commit is contained in:
parent
e16bd3f7e2
commit
be688a92cd
12
build.sh
12
build.sh
|
@ -506,11 +506,11 @@ build_lite_x86_64_jni_and_jar()
|
||||||
tar -zxf ${BASEPATH}/output/tmp/${pkg_name}.tar.gz
|
tar -zxf ${BASEPATH}/output/tmp/${pkg_name}.tar.gz
|
||||||
rm -rf ${LITE_JAVA_PATH}/java/linux_x86/libs/ && mkdir -pv ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
rm -rf ${LITE_JAVA_PATH}/java/linux_x86/libs/ && mkdir -pv ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
||||||
rm -rf ${LITE_JAVA_PATH}/native/libs/linux_x86/ && mkdir -pv ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
rm -rf ${LITE_JAVA_PATH}/native/libs/linux_x86/ && mkdir -pv ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
||||||
cp ./${pkg_name}/${inference_or_train}/lib/*.so* ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
cp ./${pkg_name}/inference/lib/*.so* ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
||||||
cp ./${pkg_name}/${inference_or_train}/lib/*.so* ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
cp ./${pkg_name}/inference/lib/*.so* ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
||||||
if [ -f "mindspore-lite-${VERSION_STR}-train-linux-x64.tar.gz" ]; then
|
if [ -f "mindspore-lite-${VERSION_STR}-train-linux-x64.tar.gz" ]; then
|
||||||
cp ./${pkg_name}/train/third_party/libjpeg-turbo/lib/*.so* ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
cp ./${pkg_name}/inference/third_party/libjpeg-turbo/lib/*.so* ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
||||||
cp ./${pkg_name}/train/third_party/libjpeg-turbo/lib/*.so* ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
cp ./${pkg_name}/inference/third_party/libjpeg-turbo/lib/*.so* ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
||||||
fi
|
fi
|
||||||
# build jni so
|
# build jni so
|
||||||
cd ${BASEPATH}/mindspore/lite/build
|
cd ${BASEPATH}/mindspore/lite/build
|
||||||
|
@ -525,7 +525,7 @@ build_lite_x86_64_jni_and_jar()
|
||||||
fi
|
fi
|
||||||
cp ./libmindspore-lite-jni.so ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
cp ./libmindspore-lite-jni.so ${LITE_JAVA_PATH}/java/linux_x86/libs/
|
||||||
cp ./libmindspore-lite-jni.so ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
cp ./libmindspore-lite-jni.so ${LITE_JAVA_PATH}/native/libs/linux_x86/
|
||||||
cp ./libmindspore-lite-jni.so ${BASEPATH}/output/tmp/${pkg_name}/${inference_or_train}/lib/
|
cp ./libmindspore-lite-jni.so ${BASEPATH}/output/tmp/${pkg_name}/inference/lib/
|
||||||
|
|
||||||
# build java common
|
# build java common
|
||||||
cd ${LITE_JAVA_PATH}/java/common
|
cd ${LITE_JAVA_PATH}/java/common
|
||||||
|
@ -537,7 +537,7 @@ build_lite_x86_64_jni_and_jar()
|
||||||
cd ${LITE_JAVA_PATH}/java/linux_x86/
|
cd ${LITE_JAVA_PATH}/java/linux_x86/
|
||||||
gradle clean
|
gradle clean
|
||||||
gradle releaseJar
|
gradle releaseJar
|
||||||
cp ./build/lib/jar/*.jar ${BASEPATH}/output/tmp/${pkg_name}/${inference_or_train}/lib/
|
cp ./build/lib/jar/*.jar ${BASEPATH}/output/tmp/${pkg_name}/inference/lib/
|
||||||
|
|
||||||
# package
|
# package
|
||||||
cd ${BASEPATH}/output/tmp
|
cd ${BASEPATH}/output/tmp
|
||||||
|
|
|
@ -7,27 +7,19 @@ set(CONVERTER_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/converter)
|
||||||
set(OBFUSCATOR_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/obfuscator)
|
set(OBFUSCATOR_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/obfuscator)
|
||||||
set(CROPPER_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/cropper)
|
set(CROPPER_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/cropper)
|
||||||
|
|
||||||
if(SUPPORT_TRAIN)
|
set(RUNTIME_DIR ${RUNTIME_PKG_NAME}/inference)
|
||||||
set(RUNTIME_DIR ${RUNTIME_PKG_NAME}/train)
|
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/inference/include)
|
||||||
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/train/include)
|
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/inference/lib)
|
||||||
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/train/lib)
|
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/inference/include/dataset)
|
||||||
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/train/include/dataset)
|
set(TURBO_DIR ${RUNTIME_PKG_NAME}/inference/third_party/libjpeg-turbo)
|
||||||
set(TURBO_DIR ${RUNTIME_PKG_NAME}/train/third_party/libjpeg-turbo)
|
set(SECUREC_DIR ${RUNTIME_PKG_NAME}/inference/third_party/securec)
|
||||||
set(SECUREC_DIR ${RUNTIME_PKG_NAME}/train/third_party/securec)
|
set(MINDSPORE_LITE_LIB_NAME libmindspore-lite)
|
||||||
set(MINDSPORE_LITE_LIB_NAME libmindspore-lite-train)
|
set(BENCHMARK_NAME benchmark)
|
||||||
set(BENCHMARK_NAME benchmark_train)
|
set(BENCHMARK_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark)
|
||||||
set(BENCHMARK_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
|
|
||||||
else()
|
set(MINDSPORE_LITE_TRAIN_LIB_NAME libmindspore-lite-train)
|
||||||
set(RUNTIME_DIR ${RUNTIME_PKG_NAME}/inference)
|
set(BENCHMARK_TRAIN_NAME benchmark_train)
|
||||||
set(RUNTIME_INC_DIR ${RUNTIME_PKG_NAME}/inference/include)
|
set(BENCHMARK_TRAIN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
|
||||||
set(RUNTIME_LIB_DIR ${RUNTIME_PKG_NAME}/inference/lib)
|
|
||||||
set(MIND_DATA_INC_DIR ${RUNTIME_PKG_NAME}/inference/include/dataset)
|
|
||||||
set(TURBO_DIR ${RUNTIME_PKG_NAME}/inference/third_party/libjpeg-turbo)
|
|
||||||
set(SECUREC_DIR ${RUNTIME_PKG_NAME}/inference/third_party/securec)
|
|
||||||
set(MINDSPORE_LITE_LIB_NAME libmindspore-lite)
|
|
||||||
set(BENCHMARK_NAME benchmark)
|
|
||||||
set(BENCHMARK_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(BUILD_MINDDATA STREQUAL "full")
|
if(BUILD_MINDDATA STREQUAL "full")
|
||||||
install(FILES
|
install(FILES
|
||||||
|
@ -45,7 +37,7 @@ if(BUILD_MINDDATA STREQUAL "full")
|
||||||
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
|
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite_static.a DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.a DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${JPEGTURBO_LIB_LIST} DESTINATION ${TURBO_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(FILES ${JPEGTURBO_LIB_LIST} DESTINATION ${TURBO_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/securec/src/libsecurec.a
|
install(FILES ${TOP_DIR}/mindspore/lite/build/securec/src/libsecurec.a
|
||||||
|
@ -54,7 +46,7 @@ if(BUILD_MINDDATA STREQUAL "full")
|
||||||
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
|
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite_static.a DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.a DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${JPEGTURBO_LIB_LIST} DESTINATION ${TURBO_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(FILES ${JPEGTURBO_LIB_LIST} DESTINATION ${TURBO_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/securec/src/libsecurec.a
|
install(FILES ${TOP_DIR}/mindspore/lite/build/securec/src/libsecurec.a
|
||||||
|
@ -62,7 +54,7 @@ if(BUILD_MINDDATA STREQUAL "full")
|
||||||
else()
|
else()
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.so DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite_static.a DESTINATION
|
install(FILES ${TOP_DIR}/mindspore/lite/build/minddata/libminddata-lite.a DESTINATION
|
||||||
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(FILES ${jpeg_turbo_LIBPATH}/libjpeg.so.62.3.0 DESTINATION ${TURBO_DIR}/lib
|
install(FILES ${jpeg_turbo_LIBPATH}/libjpeg.so.62.3.0 DESTINATION ${TURBO_DIR}/lib
|
||||||
RENAME libjpeg.so.62 COMPONENT ${RUNTIME_COMPONENT_NAME})
|
RENAME libjpeg.so.62 COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
@ -162,6 +154,10 @@ if(PLATFORM_ARM64)
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.so DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.a DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
||||||
|
@ -194,6 +190,10 @@ if(PLATFORM_ARM64)
|
||||||
install(TARGETS wrapper ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS wrapper ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
if(MSLITE_ENABLE_TOOLS)
|
if(MSLITE_ENABLE_TOOLS)
|
||||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
if(SUPPORT_TRAIN)
|
||||||
|
install(TARGETS ${BENCHMARK_TRAIN_NAME} RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR} COMPONENT
|
||||||
|
${RUNTIME_COMPONENT_NAME})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(PLATFORM_ARM32)
|
elseif(PLATFORM_ARM32)
|
||||||
if(SUPPORT_NPU)
|
if(SUPPORT_NPU)
|
||||||
|
@ -207,6 +207,10 @@ elseif(PLATFORM_ARM32)
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.so DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.a DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
||||||
|
@ -239,6 +243,10 @@ elseif(PLATFORM_ARM32)
|
||||||
install(TARGETS wrapper ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS wrapper ARCHIVE DESTINATION ${CODEGEN_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
if(MSLITE_ENABLE_TOOLS)
|
if(MSLITE_ENABLE_TOOLS)
|
||||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
if(SUPPORT_TRAIN)
|
||||||
|
install(TARGETS ${BENCHMARK_TRAIN_NAME} RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR} COMPONENT
|
||||||
|
${RUNTIME_COMPONENT_NAME})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
|
get_filename_component(CXX_DIR ${CMAKE_CXX_COMPILER} PATH)
|
||||||
|
@ -279,6 +287,10 @@ elseif(WIN32)
|
||||||
endif()
|
endif()
|
||||||
if(MSLITE_ENABLE_TOOLS)
|
if(MSLITE_ENABLE_TOOLS)
|
||||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
if(SUPPORT_TRAIN)
|
||||||
|
install(TARGETS ${BENCHMARK_TRAIN_NAME} RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR} COMPONENT
|
||||||
|
${RUNTIME_COMPONENT_NAME})
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(FILES ${LIB_LIST} DESTINATION ${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
install(DIRECTORY ${flatbuffers_INC} DESTINATION ${RUNTIME_INC_DIR}/third_party/
|
install(DIRECTORY ${flatbuffers_INC} DESTINATION ${RUNTIME_INC_DIR}/third_party/
|
||||||
|
@ -305,6 +317,10 @@ else()
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "*registry.h" EXCLUDE)
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.so DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
install(FILES ${TOP_DIR}/mindspore/lite/build/src/${MINDSPORE_LITE_TRAIN_LIB_NAME}.a DESTINATION
|
||||||
|
${RUNTIME_LIB_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${RUNTIME_INC_DIR}
|
||||||
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "train*" EXCLUDE
|
||||||
|
@ -360,6 +376,10 @@ else()
|
||||||
endif()
|
endif()
|
||||||
if(MSLITE_ENABLE_TOOLS)
|
if(MSLITE_ENABLE_TOOLS)
|
||||||
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
install(TARGETS ${BENCHMARK_NAME} RUNTIME DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
if(SUPPORT_TRAIN)
|
||||||
|
install(TARGETS ${BENCHMARK_TRAIN_NAME} RUNTIME DESTINATION ${BENCHMARK_TRAIN_ROOT_DIR} COMPONENT
|
||||||
|
${RUNTIME_COMPONENT_NAME})
|
||||||
|
endif()
|
||||||
install(TARGETS cropper RUNTIME DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
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
|
install(FILES ${TOP_DIR}/mindspore/lite/build/tools/cropper/cropper_mapping_cpu.cfg
|
||||||
DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
|
||||||
|
|
|
@ -74,20 +74,6 @@ int TileInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o
|
||||||
param->multiples_[i] = input1_data[i];
|
param->multiples_[i] = input1_data[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
const size_t in_dims = input->shape_size_;
|
|
||||||
const size_t delta_dims = in_dims - multiples_size;
|
|
||||||
|
|
||||||
size_t i = 0;
|
|
||||||
for (; i < delta_dims; ++i) {
|
|
||||||
int tmp = input->shape_[i];
|
|
||||||
ShapePush(out_shape, &out_shape_size, tmp);
|
|
||||||
}
|
|
||||||
for (; i < in_dims; ++i) {
|
|
||||||
int tmp = input->shape_[i] * (param->multiples_[i - delta_dims]);
|
|
||||||
ShapePush(out_shape, &out_shape_size, tmp);
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int *dims = param->dims_;
|
int *dims = param->dims_;
|
||||||
size_t dims_size = param->dims_size_;
|
size_t dims_size = param->dims_size_;
|
||||||
if (dims_size == 0) {
|
if (dims_size == 0) {
|
||||||
|
@ -110,7 +96,6 @@ int TileInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **o
|
||||||
}
|
}
|
||||||
// change caffe param format to tflite
|
// change caffe param format to tflite
|
||||||
TileParamCaffe2Tflite(param, out_shape_size);
|
TileParamCaffe2Tflite(param, out_shape_size);
|
||||||
#endif
|
|
||||||
SetShapeArray(output, out_shape, out_shape_size);
|
SetShapeArray(output, out_shape, out_shape_size);
|
||||||
return NNACL_OK;
|
return NNACL_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,9 +336,8 @@ add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/micro/coder)
|
||||||
if(NOT APPLE AND MSLITE_ENABLE_TOOLS)
|
if(NOT APPLE AND MSLITE_ENABLE_TOOLS)
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark_train)
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark_train)
|
||||||
else()
|
|
||||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
|
||||||
endif()
|
endif()
|
||||||
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
|
||||||
endif()
|
endif()
|
||||||
if(NOT WIN32)
|
if(NOT WIN32)
|
||||||
if(MSLITE_ENABLE_TOOLS)
|
if(MSLITE_ENABLE_TOOLS)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
BASE_DIR=$(realpath ../../../../)
|
BASE_DIR=$(realpath ../../../../)
|
||||||
APP:=bin/net_runner
|
APP:=bin/net_runner
|
||||||
LMSLIB:=-lmindspore-lite-train
|
LMSLIB:=-lmindspore-lite-train -lmindspore-lite
|
||||||
LMDLIB:=-lminddata-lite
|
LMDLIB:=-lminddata-lite
|
||||||
MSDIR:=$(realpath package-$(TARGET)/lib)
|
MSDIR:=$(realpath package-$(TARGET)/lib)
|
||||||
ifneq ("$(wildcard $(MSDIR)/libhiai.so)","")
|
ifneq ("$(wildcard $(MSDIR)/libhiai.so)","")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
BASE_DIR=$(realpath ../../../../)
|
BASE_DIR=$(realpath ../../../../)
|
||||||
APP:=bin/net_runner
|
APP:=bin/net_runner
|
||||||
LMSLIB:=-lmindspore-lite-train
|
LMSLIB:=-lmindspore-lite-train -lmindspore-lite
|
||||||
LMDLIB:=-lminddata-lite
|
LMDLIB:=-lminddata-lite
|
||||||
MSDIR:=$(realpath package-$(TARGET)/lib)
|
MSDIR:=$(realpath package-$(TARGET)/lib)
|
||||||
ifneq ("$(wildcard $(MSDIR)/libhiai.so)","")
|
ifneq ("$(wildcard $(MSDIR)/libhiai.so)","")
|
||||||
|
|
|
@ -60,7 +60,6 @@ set(JNI_SRC
|
||||||
set(LITE_SO_NAME mindspore-lite)
|
set(LITE_SO_NAME mindspore-lite)
|
||||||
|
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
set(LITE_SO_NAME mindspore-lite-train)
|
|
||||||
set(JNI_SRC
|
set(JNI_SRC
|
||||||
${JNI_SRC}
|
${JNI_SRC}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/train_session.cpp
|
${CMAKE_CURRENT_SOURCE_DIR}/runtime/train_session.cpp
|
||||||
|
|
|
@ -297,6 +297,7 @@ if(BUILD_MINDDATA STREQUAL "full")
|
||||||
${CORE_DIR}/utils/ms_utils.cc
|
${CORE_DIR}/utils/ms_utils.cc
|
||||||
${MINDDATA_FULL_SRC}
|
${MINDDATA_FULL_SRC}
|
||||||
)
|
)
|
||||||
|
set_target_properties(minddata-lite_static PROPERTIES OUTPUT_NAME "minddata-lite")
|
||||||
|
|
||||||
add_dependencies(minddata-lite fbs_src)
|
add_dependencies(minddata-lite fbs_src)
|
||||||
add_dependencies(minddata-lite_static fbs_src)
|
add_dependencies(minddata-lite_static fbs_src)
|
||||||
|
|
|
@ -110,33 +110,25 @@ if(MSLITE_GPU_BACKEND STREQUAL cuda)
|
||||||
${CUDA_RUNTIME_SRC}
|
${CUDA_RUNTIME_SRC}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
if(SUPPORT_TRAIN)
|
set(TRAIN_SRC
|
||||||
set(ANF_SRC
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_populate_parameter.cc
|
||||||
${ANF_SRC}
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_session.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/transfer_session.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_loop.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_utils.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/loss_monitor.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/lr_scheduler.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/accuracy_metrics.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/accuracy_monitor.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/classification_train_accuracy_monitor.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_export.cc
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/../tools/common/storage.cc
|
||||||
|
)
|
||||||
|
if(ENABLE_V0)
|
||||||
|
set(TRAIN_SRC
|
||||||
|
${TRAIN_SRC}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/train/train_populate_parameter_v0.cc
|
||||||
)
|
)
|
||||||
set(PASS_SRC)
|
|
||||||
set(LITE_SRC
|
|
||||||
${LITE_SRC}
|
|
||||||
${ANF_SRC}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_populate_parameter.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_session.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/transfer_session.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_loop.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_utils.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/loss_monitor.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/lr_scheduler.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/accuracy_metrics.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/accuracy_monitor.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/classification_train_accuracy_monitor.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_export.cc
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/../tools/common/storage.cc
|
|
||||||
)
|
|
||||||
if(ENABLE_V0)
|
|
||||||
set(LITE_SRC
|
|
||||||
${LITE_SRC}
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/train/train_populate_parameter_v0.cc
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_MINDRT)
|
if(ENABLE_MINDRT)
|
||||||
|
@ -193,11 +185,19 @@ if(BUILD_MINDDATA STREQUAL "lite")
|
||||||
target_link_libraries(mindspore-lite minddata_eager_mid minddata-lite)
|
target_link_libraries(mindspore-lite minddata_eager_mid minddata-lite)
|
||||||
target_link_libraries(mindspore-lite_static minddata_eager_mid)
|
target_link_libraries(mindspore-lite_static minddata_eager_mid)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SUPPORT_TRAIN)
|
if(SUPPORT_TRAIN)
|
||||||
add_dependencies(mindspore-lite fbs_inner_src)
|
add_library(mindspore-lite-train SHARED ${TRAIN_SRC})
|
||||||
add_dependencies(mindspore-lite_static fbs_inner_src)
|
set_target_properties(mindspore-lite-train PROPERTIES OUTPUT_NAME "mindspore-lite-train")
|
||||||
target_link_libraries(mindspore-lite minddata-lite)
|
add_dependencies(mindspore-lite-train fbs_src fbs_inner_src)
|
||||||
target_link_libraries(mindspore-lite_static minddata-lite)
|
set_target_properties(mindspore-lite-train PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
target_link_libraries(mindspore-lite-train minddata-lite mindspore-lite)
|
||||||
|
|
||||||
|
add_library(mindspore-lite-train_static STATIC ${TRAIN_SRC})
|
||||||
|
set_target_properties(mindspore-lite-train_static PROPERTIES OUTPUT_NAME "mindspore-lite-train")
|
||||||
|
add_dependencies(mindspore-lite-train_static fbs_inner_src)
|
||||||
|
set_target_properties(mindspore-lite-train_static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
target_link_libraries(mindspore-lite-train_static minddata-lite mindspore-lite)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
|
||||||
|
@ -279,11 +279,6 @@ if(NOT WIN32)
|
||||||
target_link_libraries(mindspore-lite dl)
|
target_link_libraries(mindspore-lite dl)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(SUPPORT_TRAIN)
|
|
||||||
set_target_properties(mindspore-lite PROPERTIES OUTPUT_NAME "mindspore-lite-train")
|
|
||||||
set_target_properties(mindspore-lite_static PROPERTIES OUTPUT_NAME "mindspore-lite-train")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(ENABLE_MODEL_OBF)
|
if(ENABLE_MODEL_OBF)
|
||||||
target_link_libraries(mindspore-lite ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
|
target_link_libraries(mindspore-lite ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
|
||||||
target_link_libraries(mindspore-lite_static ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
|
target_link_libraries(mindspore-lite_static ${OBF_LIB_DIR}/libmsdeobfuscator-lite.so)
|
||||||
|
|
|
@ -72,15 +72,11 @@ int MatmulFp32BaseCPUKernel::InitBufferA() {
|
||||||
if (a_pack_ptr_ != nullptr) {
|
if (a_pack_ptr_ != nullptr) {
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
if (op_parameter_->is_train_session_) {
|
if (op_parameter_->is_train_session_) {
|
||||||
a_pack_ptr_ = reinterpret_cast<float *>(workspace());
|
a_pack_ptr_ = reinterpret_cast<float *>(workspace());
|
||||||
} else {
|
} else {
|
||||||
a_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_a_pack_size_ * sizeof(float)));
|
a_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_a_pack_size_ * sizeof(float)));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
a_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_a_pack_size_ * sizeof(float)));
|
|
||||||
#endif
|
|
||||||
if (a_pack_ptr_ == nullptr) {
|
if (a_pack_ptr_ == nullptr) {
|
||||||
MS_LOG(ERROR) << "malloc a_pack_ptr_ failed";
|
MS_LOG(ERROR) << "malloc a_pack_ptr_ failed";
|
||||||
return RET_ERROR;
|
return RET_ERROR;
|
||||||
|
@ -92,15 +88,11 @@ int MatmulFp32BaseCPUKernel::InitBufferB() {
|
||||||
if (b_pack_ptr_ != nullptr) {
|
if (b_pack_ptr_ != nullptr) {
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
if (op_parameter_->is_train_session_) {
|
if (op_parameter_->is_train_session_) {
|
||||||
b_pack_ptr_ = reinterpret_cast<float *>(workspace()) + matrix_a_pack_size_;
|
b_pack_ptr_ = reinterpret_cast<float *>(workspace()) + matrix_a_pack_size_;
|
||||||
} else {
|
} else {
|
||||||
b_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_b_pack_size_ * sizeof(float)));
|
b_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_b_pack_size_ * sizeof(float)));
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
b_pack_ptr_ = reinterpret_cast<float *>(context_->allocator->Malloc(matrix_b_pack_size_ * sizeof(float)));
|
|
||||||
#endif
|
|
||||||
if (b_pack_ptr_ == nullptr) {
|
if (b_pack_ptr_ == nullptr) {
|
||||||
MS_LOG(ERROR) << "malloc b_pack_ptr_ failed";
|
MS_LOG(ERROR) << "malloc b_pack_ptr_ failed";
|
||||||
return RET_ERROR;
|
return RET_ERROR;
|
||||||
|
@ -328,9 +320,9 @@ int MatmulFp32BaseCPUKernel::ReSize() {
|
||||||
<< "matrix_a_pack_size=" << matrix_a_pack_size_ << "matrix_b_pack_size" << matrix_b_pack_size_;
|
<< "matrix_a_pack_size=" << matrix_a_pack_size_ << "matrix_b_pack_size" << matrix_b_pack_size_;
|
||||||
return RET_ERROR;
|
return RET_ERROR;
|
||||||
}
|
}
|
||||||
#ifdef SUPPORT_TRAIN
|
if (op_parameter_->is_train_session_) {
|
||||||
set_workspace_size((matrix_a_pack_size_ + matrix_b_pack_size_) * sizeof(float));
|
set_workspace_size((matrix_a_pack_size_ + matrix_b_pack_size_) * sizeof(float));
|
||||||
#endif
|
}
|
||||||
|
|
||||||
if (params_->b_const_ == true && src_b_ != nullptr) {
|
if (params_->b_const_ == true && src_b_ != nullptr) {
|
||||||
if (RET_OK != InitBufferB()) {
|
if (RET_OK != InitBufferB()) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ function Run_Converter() {
|
||||||
# Run on x86 platform:
|
# Run on x86 platform:
|
||||||
function Run_x86() {
|
function Run_x86() {
|
||||||
cd ${x86_path}/mindspore-lite-${version}-train-linux-x64 || return 1
|
cd ${x86_path}/mindspore-lite-${version}-train-linux-x64 || return 1
|
||||||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./train/lib:./train/third_party/libjpeg-turbo/lib
|
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:./inference/lib:./inference/third_party/libjpeg-turbo/lib
|
||||||
# Run mindspore converted train models:
|
# Run mindspore converted train models:
|
||||||
fail=0
|
fail=0
|
||||||
while read line; do
|
while read line; do
|
||||||
|
@ -141,18 +141,19 @@ function Run_arm() {
|
||||||
|
|
||||||
# If build with minddata, copy the minddata related libs
|
# If build with minddata, copy the minddata related libs
|
||||||
cd ${benchmark_train_test_path} || exit 1
|
cd ${benchmark_train_test_path} || exit 1
|
||||||
if [ -f ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/lib/libminddata-lite.so ]; then
|
if [ -f ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/lib/libminddata-lite.so ]; then
|
||||||
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/third_party/libjpeg-turbo/lib/libjpeg.so* ${benchmark_train_test_path}/ || exit 1
|
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/third_party/libjpeg-turbo/lib/libjpeg.so* ${benchmark_train_test_path}/ || exit 1
|
||||||
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/third_party/libjpeg-turbo/lib/libturbojpeg.so* ${benchmark_train_test_path}/ || exit 1
|
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/third_party/libjpeg-turbo/lib/libturbojpeg.so* ${benchmark_train_test_path}/ || exit 1
|
||||||
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/lib/libminddata-lite.so ${benchmark_train_test_path}/libminddata-lite.so || exit 1
|
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/lib/libminddata-lite.so ${benchmark_train_test_path}/libminddata-lite.so || exit 1
|
||||||
fi
|
fi
|
||||||
if [ "$1" == arm64 ] || [ "$1" == arm32 ]; then
|
if [ "$1" == arm64 ] || [ "$1" == arm32 ]; then
|
||||||
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}/inference/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}/inference/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
|
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/third_party/hiai_ddk/lib/libhiai_ir_build.so ${benchmark_train_test_path}/libhiai_ir_build.so || exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/train/lib/libmindspore-lite-train.so ${benchmark_train_test_path}/libmindspore-lite-train.so || exit 1
|
cp -a ${arm_path}/mindspore-lite-${version_arm}-train-android-${process_unit}/inference/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}/inference/lib/libmindspore-lite-train.so ${benchmark_train_test_path}/libmindspore-lite-train.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
|
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 push all needed files to the phone
|
||||||
|
|
|
@ -69,6 +69,7 @@ int FcTestInit1(std::vector<lite::Tensor *> *inputs_, std::vector<lite::Tensor *
|
||||||
matmal_param->has_bias_ = true;
|
matmal_param->has_bias_ = true;
|
||||||
matmal_param->act_type_ = ActType_No;
|
matmal_param->act_type_ = ActType_No;
|
||||||
matmal_param->op_parameter_.type_ = 67;
|
matmal_param->op_parameter_.type_ = 67;
|
||||||
|
matmal_param->op_parameter_.is_train_session_ = false;
|
||||||
KernelInferShape(*inputs_, *outputs_, reinterpret_cast<OpParameter *>(matmal_param));
|
KernelInferShape(*inputs_, *outputs_, reinterpret_cast<OpParameter *>(matmal_param));
|
||||||
return out_t->ElementsNum();
|
return out_t->ElementsNum();
|
||||||
}
|
}
|
||||||
|
@ -84,15 +85,9 @@ TEST_F(TestFcFp32, FcTest1) {
|
||||||
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
||||||
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
||||||
fc->Init();
|
fc->Init();
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::AllocWorkspace(fc->workspace_size());
|
|
||||||
#endif
|
|
||||||
fc->Run();
|
fc->Run();
|
||||||
ASSERT_EQ(0, CompareOutputData(reinterpret_cast<float *>(outputs_[0]->MutableData()), correct, total_size, 0.0001));
|
ASSERT_EQ(0, CompareOutputData(reinterpret_cast<float *>(outputs_[0]->MutableData()), correct, total_size, 0.0001));
|
||||||
delete ctx;
|
delete ctx;
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::FreeWorkspace();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int FcTestInit2(std::vector<lite::Tensor *> *inputs_, std::vector<lite::Tensor *> *outputs_,
|
int FcTestInit2(std::vector<lite::Tensor *> *inputs_, std::vector<lite::Tensor *> *outputs_,
|
||||||
|
@ -149,15 +144,9 @@ TEST_F(TestFcFp32, FcTest2) {
|
||||||
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
||||||
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
||||||
fc->Init();
|
fc->Init();
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::AllocWorkspace(fc->workspace_size());
|
|
||||||
#endif
|
|
||||||
fc->Run();
|
fc->Run();
|
||||||
ASSERT_EQ(0, CompareOutputData(reinterpret_cast<float *>(outputs_[0]->MutableData()), correct, total_size, 0.0001));
|
ASSERT_EQ(0, CompareOutputData(reinterpret_cast<float *>(outputs_[0]->MutableData()), correct, total_size, 0.0001));
|
||||||
delete ctx;
|
delete ctx;
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::FreeWorkspace();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FcTestInit3(std::vector<lite::Tensor *> *inputs_, std::vector<lite::Tensor *> *outputs_,
|
void FcTestInit3(std::vector<lite::Tensor *> *inputs_, std::vector<lite::Tensor *> *outputs_,
|
||||||
|
@ -204,18 +193,12 @@ TEST_F(TestFcFp32, FcTest3) {
|
||||||
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
ASSERT_EQ(lite::RET_OK, ctx->Init());
|
||||||
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
auto *fc = new kernel::FullconnectionCPUKernel(reinterpret_cast<OpParameter *>(matmul_param), inputs_, outputs_, ctx);
|
||||||
fc->Init();
|
fc->Init();
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::AllocWorkspace(fc->workspace_size());
|
|
||||||
#endif
|
|
||||||
struct timeval start, end;
|
struct timeval start, end;
|
||||||
gettimeofday(&start, nullptr);
|
gettimeofday(&start, nullptr);
|
||||||
for (int i = 0; i < 100000; ++i) fc->Run();
|
for (int i = 0; i < 100000; ++i) fc->Run();
|
||||||
gettimeofday(&end, nullptr);
|
gettimeofday(&end, nullptr);
|
||||||
// printf("## elapsed: %llu\n", 1000000 * (end.tv_sec - start.tv_sec) + end.tv_usec - end.tv_usec);
|
// printf("## elapsed: %llu\n", 1000000 * (end.tv_sec - start.tv_sec) + end.tv_usec - end.tv_usec);
|
||||||
delete ctx;
|
delete ctx;
|
||||||
#ifdef SUPPORT_TRAIN
|
|
||||||
mindspore::kernel::InnerKernel::FreeWorkspace();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mindspore
|
} // namespace mindspore
|
||||||
|
|
|
@ -10,21 +10,22 @@ add_executable(benchmark_train
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/net_train.cc
|
${CMAKE_CURRENT_SOURCE_DIR}/net_train.cc
|
||||||
${COMMON_SRC})
|
${COMMON_SRC})
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
add_dependencies(benchmark_train fbs_src mindspore-lite_static)
|
add_dependencies(benchmark_train fbs_src mindspore-lite_static mindspore-lite-train_static)
|
||||||
else()
|
else()
|
||||||
add_dependencies(benchmark_train fbs_src)
|
add_dependencies(benchmark_train fbs_src mindspore-lite_static mindspore-lite-train_static)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||||
if(SUPPORT_NPU AND ANDROID_STL STREQUAL "c++_static")
|
if(SUPPORT_NPU AND ANDROID_STL STREQUAL "c++_static")
|
||||||
target_link_libraries(benchmark_train mindspore-lite minddata-lite c++_shared)
|
target_link_libraries(benchmark_train mindspore-lite minddata-lite mindspore-lite-train c++_shared)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(benchmark_train mindspore-lite minddata-lite)
|
target_link_libraries(benchmark_train mindspore-lite minddata-lite mindspore-lite-train)
|
||||||
endif()
|
endif()
|
||||||
else()
|
else()
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
target_link_libraries(benchmark_train mindspore-lite_static pthread cpu_kernel_mid nnacl_mid minddata-lite)
|
target_link_libraries(benchmark_train mindspore-lite_static mindspore-lite-train_static pthread cpu_kernel_mid
|
||||||
|
nnacl_mid minddata-lite)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(benchmark_train mindspore-lite pthread minddata-lite)
|
target_link_libraries(benchmark_train mindspore-lite mindspore-lite-train pthread minddata-lite)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue