!7420 [MS][LITE][Develop]support benchmark running on windows10

Merge pull request !7420 from chenjianping/lite_windows
This commit is contained in:
mindspore-ci-bot 2020-10-17 15:29:29 +08:00 committed by Gitee
commit 6207210c22
5 changed files with 53 additions and 20 deletions

View File

@ -31,6 +31,7 @@ IF NOT EXIST "%BUILD_PATH%/mindspore" (
cd %CD%/mindspore
IF "%1%" == "lite" (
IF "%3%" == "" (
call :run_cmake
IF errorlevel 1 (
echo "cmake fail one time."
@ -45,6 +46,7 @@ IF "%1%" == "lite" (
call :gene_protobuf
call :gene_flatbuffer
)
)
cd %BUILD_PATH%/mindspore
IF "%2%" == "" (
@ -88,7 +90,7 @@ goto run_eof
set VERSION_REVISION=0
echo "============ Start building MindSpore Lite %VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_REVISION% ============"
cd %BUILD_PATH%/mindspore
cmake -DBUILD_DEVICE=on -DBUILD_CONVERTER=on -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
cmake -DBUILD_DEVICE=on -DENABLE_CONVERTER=on -DPLATFORM_ARM64=off -DSUPPORT_TRAIN=off ^
-DCMAKE_BUILD_TYPE=Release -DSUPPORT_GPU=off -DBUILD_MINDDATA=off -DOFFLINE_COMPILE=off ^
-DMS_VERSION_MAJOR=%VERSION_MAJOR% -DMS_VERSION_MINOR=%VERSION_MINOR% -DMS_VERSION_REVISION=%VERSION_REVISION% ^
-G "CodeBlocks - MinGW Makefiles" "%BASEPATH%/mindspore/lite"

View File

@ -19,6 +19,11 @@ set(OPENCV_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/opencv)
set(PROTOBF_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/protobuf)
set(FLATBF_DIR_RUN_X86 ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/third_party/flatbuffers)
set(WIN_INC_DIR_RUN_X86 ${MAIN_DIR}-${WIN_RUN_X86_NAME}/include)
set(WIN_X86_BENCHMARK_DIR ${MAIN_DIR}-${WIN_RUN_X86_NAME}/benchmark)
set(WIN_FLATBF_DIR_RUN_X86 ${MAIN_DIR}-${WIN_RUN_X86_NAME}/third_party/flatbuffers)
set(WIN_LIB_DIR_RUN_X86 ${MAIN_DIR}-${WIN_RUN_X86_NAME}/lib)
if (BUILD_MINDDATA STREQUAL "lite")
install(DIRECTORY ${TOP_DIR}/mindspore/ccsrc/minddata/dataset/include/ DESTINATION ${INC_DIR} COMPONENT ${COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
if (PLATFORM_ARM64)
@ -78,9 +83,20 @@ elseif (PLATFORM_ARM32)
elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
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)
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/converter_lite.exe DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${COMPONENT_NAME})
install(FILES ${LIB_LIST} DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${COMPONENT_NAME})
if (ENABLE_CONVERTER)
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/converter_lite.exe DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${COMPONENT_NAME})
install(FILES ${TOP_DIR}/build/mindspore/tools/converter/libconverter_parser.a DESTINATION ${TOP_DIR}/build/mindspore/package COMPONENT ${PARSER_NAME})
endif ()
install(FILES ${LIB_LIST} DESTINATION ${WIN_X86_BENCHMARK_DIR} COMPONENT ${WIN_RUN_X86_NAME})
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${WIN_INC_DIR_RUN_X86} COMPONENT ${WIN_RUN_X86_NAME} FILES_MATCHING PATTERN "*.h")
install(FILES ${TOP_DIR}/build/mindspore/schema/model_generated.h DESTINATION ${WIN_INC_DIR_RUN_X86}/schema COMPONENT ${WIN_RUN_X86_NAME})
install(FILES ${TOP_DIR}/build/mindspore/schema/ops_generated.h DESTINATION ${WIN_INC_DIR_RUN_X86}/schema COMPONENT ${WIN_RUN_X86_NAME})
install(FILES ${TOP_DIR}/mindspore/core/ir/dtype/type_id.h DESTINATION ${WIN_INC_DIR_RUN_X86}/ir/dtype COMPONENT ${WIN_RUN_X86_NAME})
install(DIRECTORY ${flatbuffers_INC} DESTINATION ${WIN_FLATBF_DIR_RUN_X86} COMPONENT ${WIN_RUN_X86_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.a DESTINATION ${WIN_LIB_DIR_RUN_X86} COMPONENT ${WIN_RUN_X86_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll.a DESTINATION ${WIN_LIB_DIR_RUN_X86} COMPONENT ${WIN_RUN_X86_NAME})
install(FILES ${TOP_DIR}/build/mindspore/src/libmindspore-lite.dll DESTINATION ${WIN_LIB_DIR_RUN_X86} COMPONENT ${WIN_RUN_X86_NAME})
else ()
install(DIRECTORY ${TOP_DIR}/mindspore/lite/include/ DESTINATION ${INC_DIR_RUN_X86} COMPONENT ${RUN_X86_COMPONENT_NAME} FILES_MATCHING PATTERN "*.h")
install(FILES ${TOP_DIR}/mindspore/lite/build/schema/model_generated.h DESTINATION ${INC_DIR_RUN_X86}/schema COMPONENT ${RUN_X86_COMPONENT_NAME})
@ -100,7 +116,7 @@ set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)
if (PLATFORM_ARM64 OR PLATFORM_ARM32)
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME})
elseif (WIN32)
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME})
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME} ${WIN_RUN_X86_NAME})
else ()
set(CPACK_COMPONENTS_ALL ${COMPONENT_NAME} ${RUN_X86_COMPONENT_NAME})
endif ()

View File

@ -51,6 +51,7 @@ if (SUPPORT_TRAIN)
elseif (WIN32)
set(PARSER_NAME libconverter-parser-win-${PROCESS_UNIT}-train)
set(COMPONENT_NAME converter-win-${PROCESS_UNIT}-train)
set(WIN_RUN_X86_NAME win-runtime-x86-${PROCESS_UNIT})
else ()
set(COMPONENT_NAME converter-ubuntu-train)
endif()
@ -63,6 +64,7 @@ else ()
elseif (WIN32)
set(PARSER_NAME libconverter-parser-win-${PROCESS_UNIT})
set(COMPONENT_NAME converter-win-${PROCESS_UNIT})
set(WIN_RUN_X86_NAME win-runtime-x86-${PROCESS_UNIT})
else ()
set(COMPONENT_NAME converter-ubuntu)
endif()
@ -225,9 +227,11 @@ endif ()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/internal)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/nnacl)
if (NOT WIN32)
if (ENABLE_TOOLS)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
endif()
if (NOT WIN32)
if (ENABLE_TOOLS)
if (NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/schema_gen)
endif ()

View File

@ -9,17 +9,30 @@ add_executable(benchmark
${CMAKE_CURRENT_SOURCE_DIR}/main.cc
${CMAKE_CURRENT_SOURCE_DIR}/benchmark.cc
${COMMON_SRC})
if (WIN32)
add_dependencies(benchmark fbs_src mindspore-lite_static)
else ()
add_dependencies(benchmark fbs_src)
endif ()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
target_link_libraries(benchmark mindspore-lite)
else()
if (WIN32)
target_link_libraries(benchmark mindspore-lite_static pthread cpu_kernel_mid nnacl_mid)
else ()
target_link_libraries(benchmark mindspore-lite pthread)
endif ()
endif()
if (PLATFORM_ARM32 OR PLATFORM_ARM64)
install(TARGETS benchmark
RUNTIME DESTINATION ${MAIN_DIR}-${COMPONENT_NAME}/benchmark COMPONENT ${COMPONENT_NAME})
else()
if (WIN32)
install(TARGETS benchmark
RUNTIME DESTINATION ${MAIN_DIR}-${WIN_RUN_X86_NAME}/benchmark COMPONENT ${WIN_RUN_X86_NAME})
else ()
install(TARGETS benchmark
RUNTIME DESTINATION ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/benchmark COMPONENT ${RUN_X86_COMPONENT_NAME})
endif ()
endif()

View File

@ -13,5 +13,3 @@ add_executable(schema_gen
${CMAKE_CURRENT_SOURCE_DIR}/../../src/ops/ops_def.cc
${COMMON_SRC})
target_link_libraries(schema_gen mindspore-lite pthread)
install(TARGETS schema_gen
RUNTIME DESTINATION ${MAIN_DIR}-${RUN_X86_COMPONENT_NAME}/schema_gen COMPONENT ${RUN_X86_COMPONENT_NAME})