remove nnie so files

This commit is contained in:
jianghui58 2021-07-15 15:06:50 +08:00
parent 24887686c6
commit 0785d7db8c
28 changed files with 174 additions and 148 deletions

View File

@ -279,21 +279,11 @@ elseif(PLATFORM_ARM32)
install(DIRECTORY ${TOP_DIR}/include/api/ DESTINATION ${RUNTIME_INC_DIR}/api
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h" PATTERN "ops*" EXCLUDE)
__install_micro_wrapper()
if(MSLITE_ENABLE_NNIE AND TARGET_HIMIX200)
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libmslite_nnie.so
DESTINATION ${RUNTIME_PKG_NAME}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libnnie_proposal.so
DESTINATION ${RUNTIME_PKG_NAME}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/benchmark
DESTINATION ${BENCHMARK_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
else()
if(MSLITE_ENABLE_TOOLS)
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()
if(MSLITE_ENABLE_TOOLS)
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()
elseif(WIN32)
@ -477,10 +467,6 @@ else()
DESTINATION ${CONVERTER_ROOT_DIR}/lib COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${CONVERTER_ROOT_DIR}/lib RENAME libglog.so.0
COMPONENT ${RUNTIME_COMPONENT_NAME})
if(MSLITE_ENABLE_NNIE)
install(FILES ${glog_LIBPATH}/libglog.so.0.4.0 DESTINATION ${CONVERTER_ROOT_DIR}/lib RENAME libglog.so
COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
__install_micro_wrapper()
__install_micro_codegen()
endif()
@ -498,22 +484,6 @@ else()
install(FILES ${TOP_DIR}/mindspore/lite/build/tools/cropper/cropper_mapping_npu.cfg
DESTINATION ${CROPPER_ROOT_DIR} COMPONENT ${RUNTIME_COMPONENT_NAME})
endif()
if(NOT SUPPORT_TRAIN AND MSLITE_ENABLE_NNIE)
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/converter.cfg
DESTINATION ${CONVERTER_ROOT_DIR}/converter COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libmslite_nnie_converter.so
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D/ COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libmslite_nnie_data_process.so
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
install(FILES ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/libnnie_mapper.so
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D COMPONENT ${RUNTIME_COMPONENT_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/opencv-4.2.0/lib/
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D/third_party/opencv-4.2.0
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.so*")
install(DIRECTORY ${TOP_DIR}/mindspore/lite/tools/providers/NNIE/Hi3516D/protobuf-3.9.0/lib/
DESTINATION ${CONVERTER_ROOT_DIR}/providers/Hi3516D/third_party/protobuf-3.9.0
COMPONENT ${RUNTIME_COMPONENT_NAME} FILES_MATCHING PATTERN "*.so*")
endif()
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows")

View File

@ -57,7 +57,7 @@ function Run_Hi3516() {
chmod +x ./tools/benchmark/benchmark
# copy related files to benchmark_test
cp -a ./providers/Hi3516D/libmslite_nnie.so ${benchmark_test_path}/libmslite_nnie.so || exit 1
cp -a ./providers/Hi3516D/libnnie_proposal.so ${benchmark_test_path}/libnnie_proposal.so || exit 1
cp -a ./providers/Hi3516D/libmslite_proposal.so ${benchmark_test_path}/libmslite_proposal.so || exit 1
cp -a ./tools/benchmark/benchmark ${benchmark_test_path}/benchmark || exit 1
cp -a ./runtime/lib/libmindspore-lite.so ${benchmark_test_path}/libmindspore-lite.so || exit 1

View File

@ -4,42 +4,23 @@ set(COMMON_SRC
${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/file_utils.cc
${CMAKE_CURRENT_SOURCE_DIR}/../../src/common/utils.cc
)
if(NOT TARGET_HIMIX200)
add_executable(benchmark
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/run_benchmark.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_base.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_unified_api.cc
${COMMON_SRC})
add_dependencies(benchmark fbs_src)
add_executable(benchmark
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/run_benchmark.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_base.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark_unified_api.cc
${COMMON_SRC})
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
if(SUPPORT_NPU AND ANDROID_STL STREQUAL "c++_static")
target_link_libraries(benchmark mindspore-lite mindspore::json c++_shared)
else()
target_link_libraries(benchmark mindspore-lite mindspore::json)
endif()
add_dependencies(benchmark fbs_src)
if((PLATFORM_ARM32 OR PLATFORM_ARM64) AND NOT TARGET_HIMIX200)
if(SUPPORT_NPU AND ANDROID_STL STREQUAL "c++_static")
target_link_libraries(benchmark mindspore-lite mindspore::json c++_shared)
else()
target_link_libraries(benchmark mindspore-lite mindspore::json pthread)
target_link_libraries(benchmark mindspore-lite mindspore::json)
endif()
endif()
if(MSLITE_COMPILE_NNIE AND TARGET_HIMIX200 AND PLATFORM_ARM)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/nnie/third_patry/hi3516_sdk)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/nnie/third_patry/hi3516_sdk/lib)
set(CMAKE_SKIP_BUILD_RPATH on)
add_subdirectory(nnie)
add_subdirectory(nnie_proposal)
add_executable(benchmark
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark.cc
${COMMON_SRC})
add_dependencies(benchmark fbs_src)
target_link_libraries(benchmark mindspore-lite mindspore::json pthread nnie_proposal
mslite_nnie dl nnie mpi VoiceEngine upvqe dnvqe securec)
else()
target_link_libraries(benchmark mindspore-lite mindspore::json pthread)
endif()

View File

@ -33,12 +33,6 @@
#include <asm/unistd.h>
#include <unistd.h>
#endif
#ifdef SUPPORT_NNIE
#include "include/hi_common.h"
#include "include/hi_comm_vb.h"
#include "include/mpi_sys.h"
#include "include/mpi_vb.h"
#endif
namespace mindspore {
namespace lite {

View File

@ -33,12 +33,6 @@
#include <asm/unistd.h>
#include <unistd.h>
#endif
#ifdef SUPPORT_NNIE
#include "include/hi_common.h"
#include "include/hi_comm_vb.h"
#include "include/mpi_sys.h"
#include "include/mpi_vb.h"
#endif
namespace mindspore {
namespace lite {
@ -539,67 +533,11 @@ int BenchmarkBase::PrintPerfResult(const std::vector<std::string> &title,
}
#endif
#ifdef SUPPORT_NNIE
int SvpSysInit() {
HI_S32 ret = HI_SUCCESS;
VB_CONFIG_S struVbConf;
HI_MPI_SYS_Exit();
HI_MPI_VB_Exit();
memset(&struVbConf, 0, sizeof(VB_CONFIG_S));
struVbConf.u32MaxPoolCnt = 2;
struVbConf.astCommPool[1].u64BlkSize = 768 * 576 * 2;
struVbConf.astCommPool[1].u32BlkCnt = 1;
ret = HI_MPI_VB_SetConfig((const VB_CONFIG_S *)&struVbConf);
if (HI_SUCCESS != ret) {
MS_LOG(ERROR) << "Error:HI_MPI_VB_SetConf failed!";
return RET_ERROR;
}
ret = HI_MPI_VB_Init();
if (HI_SUCCESS != ret) {
MS_LOG(ERROR) << "Error:HI_MPI_VB_Init failed!";
return RET_ERROR;
}
ret = HI_MPI_SYS_Init();
if (HI_SUCCESS != ret) {
MS_LOG(ERROR) << "Error:HI_MPI_SYS_Init failed!";
return RET_ERROR;
}
return RET_OK;
}
int SvpSysExit() {
HI_S32 ret = HI_SUCCESS;
ret = HI_MPI_SYS_Exit();
if (HI_SUCCESS != ret) {
MS_LOG(ERROR) << "Error:HI_MPI_SYS_Exit failed!";
return RET_ERROR;
}
ret = HI_MPI_VB_Exit();
if (HI_SUCCESS != ret) {
MS_LOG(ERROR) << "Error:HI_MPI_VB_Exit failed!";
return RET_ERROR;
}
return RET_OK;
}
#endif
BenchmarkBase::~BenchmarkBase() {
for (const auto &iter : this->benchmark_data_) {
delete (iter.second);
}
this->benchmark_data_.clear();
#ifdef SUPPORT_NNIE
SvpSysExit();
#endif
}
} // namespace lite

View File

@ -33,12 +33,6 @@
#include <asm/unistd.h>
#include <unistd.h>
#endif
#ifdef SUPPORT_NNIE
#include "include/hi_common.h"
#include "include/hi_comm_vb.h"
#include "include/mpi_sys.h"
#include "include/mpi_vb.h"
#endif
namespace mindspore {
namespace lite {

View File

@ -22,9 +22,6 @@ namespace lite {
int RunBenchmark(int argc, const char **argv) {
BenchmarkFlags flags;
Option<std::string> err = flags.ParseFlags(argc, argv);
#ifdef SUPPORT_NNIE
SvpSysInit();
#endif
if (err.IsSome()) {
std::cerr << err.Get() << std::endl;
std::cerr << flags.Usage() << std::endl;

View File

@ -0,0 +1,153 @@
#!/bin/bash
# Build x86 for nnie
function Run_Build_x86() {
# decompress release_pkg
cd ${open_source_ms_path}/output/ || exit 1
file_name=$(ls ./*linux-x64.tar.gz)
IFS="-" read -r -a file_name_array <<< "$file_name"
version=${file_name_array[2]}
tar -xf mindspore-lite-${version}-linux-x64.tar.gz
# cp tools folder
cd ${open_source_ms_path}/output/mindspore-lite-${version}-linux-x64 || exit 1
rm -rf ${nnie_code_path}/mindspore/mindspore/lite/tools/converter/nnie/third_party/ms_lite/
mkdir -p ${nnie_code_path}/mindspore/mindspore/lite/tools/converter/nnie/third_party/ms_lite/ || exit 1
cp -r ./tools/ ${nnie_code_path}/mindspore/mindspore/lite/tools/converter/nnie/third_party/ms_lite/ || exit 1
# compile nnie converter so
export MSLITE_ENABLE_NNIE=on
export MSLITE_ENABLE_CONVERTER=off
export MSLITE_ENABLE_TRAIN=off
bash ${nnie_code_path}/mindspore/build.sh -I x86_64 -j 64
if [ $? = 0 ]; then
echo "build x86 for nnie success"
hi3516d_release_path=${open_source_ms_path}/output/mindspore-lite-${version}-linux-x64/tools/converter/providers/Hi3516D
rm -rf ${hi3516d_release_path}
mkdir -p ${hi3516d_release_path}/third_party
cp -r ${nnie_code_path}/mindspore/mindspore/lite/tools/providers/NNIE/Hi3516D/opencv-4.2.0/ ${hi3516d_release_path}/third_party/
cp -r ${nnie_code_path}/mindspore/mindspore/lite/tools/providers/NNIE/Hi3516D/protobuf-3.9.0/ ${hi3516d_release_path}/third_party/
cp ${nnie_code_path}/mindspore/mindspore/lite/tools/providers/NNIE/Hi3516D/libnnie_mapper.so ${hi3516d_release_path}/
cp ${nnie_code_path}/mindspore/mindspore/lite/build/tools/converter/nnie/libmslite_nnie_converter.so ${hi3516d_release_path}/ || exit 1
cp ${nnie_code_path}/mindspore/mindspore/lite/build/tools/converter/nnie/data_process/libmslite_nnie_data_process.so ${hi3516d_release_path}/ || exit 1
echo "cp new nnie so to release pkg success"
cd ${open_source_ms_path}/output/ || exit 1
rm ${open_source_ms_path}/output/mindspore-lite-${version}-linux-x64.tar.gz
tar -zcf ./mindspore-lite-${version}-linux-x64.tar.gz ./mindspore-lite-${version}-linux-x64/
sha256sum ./mindspore-lite-${version}-linux-x64.tar.gz > ./mindspore-lite-${version}-linux-x64.tar.gz.sha256
else
echo "build x86 for nnie failed"; return 1
fi
}
# Build arm32 for nnie
function Run_Build_arm32() {
# decompress release_pkg
cd ${open_source_ms_path}/output/ || exit 1
file_name=$(ls ./*linux-aarch32.tar.gz)
IFS="-" read -r -a file_name_array <<< "$file_name"
version=${file_name_array[2]}
tar -xf mindspore-lite-${version}-linux-aarch32.tar.gz
# cp runtime folder
cd ${open_source_ms_path}/output/mindspore-lite-${version}-linux-aarch32 || exit 1
rm -rf ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie/third_patry/runtime/
mkdir -p ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie/third_patry/runtime/ || exit 1
rm -rf ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie_proposal/third_patry/runtime/
mkdir -p ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie_proposal/third_patry/runtime/ || exit 1
cp -r ./runtime/ ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie/third_patry/
cp -r ./runtime/ ${nnie_code_path}/mindspore/mindspore/lite/tools/benchmark/nnie_proposal/third_patry/
# compile nnie runtime so
export TOOLCHAIN_FILE=${nnie_code_path}/mindspore/cmake/toolchains/himix200.toolchain.cmake
export TOOLCHAIN_NAME=himix200
# disable gpu & npu & train
export MSLITE_GPU_BACKEND=off
export MSLITE_ENABLE_NPU=off
export MSLITE_ENABLE_TRAIN=off
export MSLITE_ENABLE_NNIE=on
bash ${nnie_code_path}/mindspore/build.sh -I arm32 -j 64
if [ $? = 0 ]; then
echo "build arm32 for nnie success"
hi3516d_release_path=${open_source_ms_path}/output/mindspore-lite-${version}-linux-aarch32/providers/Hi3516D/
rm -rf ${hi3516d_release_path}
mkdir -p ${hi3516d_release_path}
cp ${nnie_code_path}/mindspore/mindspore/lite/build/tools/benchmark/benchmark ${open_source_ms_path}/output/mindspore-lite-${version}-linux-aarch32/tools/benchmark/ || exit 1
cp ${nnie_code_path}/mindspore/mindspore/lite/build/tools/benchmark/nnie/libmslite_nnie.so ${hi3516d_release_path}/ || exit 1
cp ${nnie_code_path}/mindspore/mindspore/lite/build/tools/benchmark/nnie_proposal/libmslite_proposal.so ${hi3516d_release_path}/ || exit 1
echo "cp new nnie so to release pkg success"
cd ${open_source_ms_path}/output/ || exit 1
rm ${open_source_ms_path}/output/mindspore-lite-${version}-linux-aarch32.tar.gz
tar -zcf ./mindspore-lite-${version}-linux-aarch32.tar.gz ./mindspore-lite-${version}-linux-aarch32/
sha256sum /mindspore-lite-${version}-linux-aarch32.tar.gz > /mindspore-lite-${version}-linux-aarch32.tar.gz.sha256
else
echo "build arm32 for nnie failed"; return 1
fi
}
# bashpath should be /home/jenkins/agent-working-dir/workspace/Compile_Lite_ARM32_3516D/
basepath=$(pwd)
echo "basepath is ${basepath}"
#set -e
open_source_ms_path=${basepath}/mindspore
# Example:sh compile_nnie.sh -I arm32 -b nnie_master
while getopts "I:b:" opt; do
case ${opt} in
I)
task=${OPTARG}
echo "compile task is ${OPTARG}"
;;
b)
branch_name=${OPTARG}
echo "branch name is ${OPTARG}"
;;
?)
echo "unknown para"
exit 1;;
esac
done
# download nnie repository
nnie_code_path=${basepath}/nnie_code/
rm -rf ${nnie_code_path}
mkdir -p ${nnie_code_path}
cd ${nnie_code_path} || exit 1
if [[ "${GITEE_CREDENTIAL_USR}" && "${GITEE_CREDENTIAL_PSW}" ]]; then
gitee_user_name=${GITEE_CREDENTIAL_USR}
gitee_user_pass=${GITEE_CREDENTIAL_PSW}
else
echo "ERROR: ENV GITEE_CREDENTIAL_USR or GITEE_CREDENTIAL_PSW not found."
exit 1
fi
git clone https://${gitee_user_name}:${gitee_user_pass}@gitee.com/ms-incubator/mindspore.git -b ${branch_name}
if [[ $? -ne 0 ]]; then
echo "git clone https://gitee.com/ms-incubator/mindspore.git -b ${branch_name} failed."
exit 1
fi
if [ ${task} == "x86_64" ]; then
echo "start building x86 for nnie..."
Run_Build_x86 &
Run_build_x86_PID=$!
sleep 1
elif [ ${task} == "arm32" ]; then
echo "start building arm32 for nnie..."
Run_Build_arm32 &
Run_build_arm32_PID=$!
sleep 1
fi
if [ ${task} == "x86_64" ]; then
wait ${Run_build_x86_PID}
Run_build_x86_status=$?
exit ${Run_build_x86_status}
elif [ ${task} == "arm32" ]; then
wait ${Run_build_arm32_PID}
Run_build_arm32_status=$?
exit ${Run_build_arm32_status}
fi

View File

@ -1 +0,0 @@
plugin_path=../providers/Hi3516D/libmslite_nnie_converter.so