forked from mindspore-Ecosystem/mindspore
reconstruct compile md step2
This commit is contained in:
parent
a05a097382
commit
3f07ae49ac
|
@ -24,23 +24,24 @@ set(CMAKE_OPTION -DCMAKE_BUILD_TYPE=Release -DCMAKE_SKIP_RPATH=TRUE -DWITH_SIMD=
|
|||
if(BUILD_LITE)
|
||||
set(jpeg_turbo_USE_STATIC_LIBS OFF)
|
||||
set(JPEG_TURBO_PATCHE ${TOP_DIR}/third_party/patch/jpeg_turbo/jpeg_turbo.patch001)
|
||||
if(PLATFORM_ARM64)
|
||||
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
-DANDROID_NATIVE_API_LEVEL=19
|
||||
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
||||
-DANDROID_ABI=arm64-v8a
|
||||
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
||||
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
if(ANDROID_NDK) # compile android on x86_64 env
|
||||
if(PLATFORM_ARM64)
|
||||
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
-DANDROID_NATIVE_API_LEVEL=19
|
||||
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
||||
-DANDROID_ABI=arm64-v8a
|
||||
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
||||
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
if(PLATFORM_ARM32)
|
||||
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
-DANDROID_NATIVE_API_LEVEL=19
|
||||
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
||||
-DANDROID_ABI=armeabi-v7a
|
||||
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
||||
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
endif()
|
||||
if(PLATFORM_ARM32)
|
||||
set(CMAKE_OPTION -DCMAKE_TOOLCHAIN_FILE=$ENV{ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
-DANDROID_NATIVE_API_LEVEL=19
|
||||
-DANDROID_NDK=$ENV{ANDROID_NDK}
|
||||
-DANDROID_ABI=armeabi-v7a
|
||||
-DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang
|
||||
-DANDROID_STL=c++_shared -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE})
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
mindspore_add_pkg(jpeg_turbo
|
||||
|
|
|
@ -32,7 +32,7 @@ set(BENCHMARK_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark)
|
|||
set(MINDSPORE_LITE_TRAIN_LIB_NAME libmindspore-lite-train)
|
||||
set(BENCHMARK_TRAIN_NAME benchmark_train)
|
||||
set(BENCHMARK_TRAIN_ROOT_DIR ${RUNTIME_PKG_NAME}/tools/benchmark_train)
|
||||
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so)
|
||||
file(GLOB JPEGTURBO_LIB_LIST ${jpeg_turbo_LIBPATH}/*.so*)
|
||||
|
||||
include(${TOP_DIR}/cmake/package_micro.cmake)
|
||||
|
||||
|
|
|
@ -554,9 +554,9 @@ inline void DivideImpl(const uint8_t *src0, const uint8_t *src1, uint8_t *dst, i
|
|||
uint16x8_t dst_l_16x8 = vcombine_u16(dst_ll_16x4, dst_lh_16x4);
|
||||
uint16x8_t dst_h_16x8 = vcombine_u16(dst_hl_16x4, dst_hh_16x4);
|
||||
|
||||
int8x8_t dst_l_8x8 = vqmovn_u16(dst_l_16x8);
|
||||
int8x8_t dst_h_8x8 = vqmovn_u16(dst_h_16x8);
|
||||
int8x16_t dst_8x16 = vcombine_u8(dst_l_8x8, dst_h_8x8);
|
||||
uint8x8_t dst_l_8x8 = vqmovn_u16(dst_l_16x8);
|
||||
uint8x8_t dst_h_8x8 = vqmovn_u16(dst_h_16x8);
|
||||
uint8x16_t dst_8x16 = vcombine_u8(dst_l_8x8, dst_h_8x8);
|
||||
|
||||
dst_8x16 = vandq_u8(dst_8x16, v_mask);
|
||||
vst1q_u8(dst + x, dst_8x16);
|
||||
|
@ -656,7 +656,7 @@ inline void MultiplyImpl(const uint8_t *src0, const uint8_t *src1, uint8_t *dst,
|
|||
uint8x16_t v_src01 = vld1q_u8(src0 + x + 16);
|
||||
uint8x16_t v_src10 = vld1q_u8(src1 + x);
|
||||
uint8x16_t v_src11 = vld1q_u8(src1 + x + 16);
|
||||
uint8x16_t v_dst_l, v_dst_h;
|
||||
uint16x8_t v_dst_l, v_dst_h;
|
||||
|
||||
v_dst_l = vmull_u8(vget_low_u8(v_src00), vget_low_u8(v_src10));
|
||||
v_dst_h = vmull_u8(vget_high_u8(v_src00), vget_high_u8(v_src10));
|
||||
|
|
|
@ -14,8 +14,6 @@ set(MSLITE_REGISTRY_DEVICE "off" CACHE STRING "Compile Mindspore Lite that suppo
|
|||
currently supported devices: Hi3516D/Hi3519A/Hi3559A/SD3403")
|
||||
set(MSLITE_MICRO_PLATFORM "auto" CACHE STRING "Platform of micro static library micro static, \
|
||||
currently supported : cortex-m7/auto")
|
||||
set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full")
|
||||
|
||||
option(MSLITE_ENABLE_NPU "enable npu, only arm64 or arm32 support" off)
|
||||
option(MSLITE_ENABLE_TRAIN "enable train" on)
|
||||
option(MSLITE_ENABLE_SSE "enable SSE instruction set, only x86_64 support" off)
|
||||
|
@ -160,9 +158,6 @@ endif()
|
|||
if(DEFINED ENV{MSLITE_ENABLE_ACL})
|
||||
set(MSLITE_ENABLE_ACL $ENV{MSLITE_ENABLE_ACL})
|
||||
endif()
|
||||
if(DEFINED ENV{MSLITE_MINDDATA_IMPLEMENT})
|
||||
set(MSLITE_MINDDATA_IMPLEMENT $ENV{MSLITE_MINDDATA_IMPLEMENT})
|
||||
endif()
|
||||
if(DEFINED ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
|
||||
if((${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND PLATFORM_X86_64)
|
||||
OR((PLATFORM_ARM64 OR PLATFORM_ARM32) AND ANDROID_NDK_TOOLCHAIN_INCLUDED))
|
||||
|
@ -342,9 +337,6 @@ endif()
|
|||
|
||||
if(MSLITE_ENABLE_TRAIN)
|
||||
set(SUPPORT_TRAIN on)
|
||||
if(NOT MSLITE_MINDDATA_IMPLEMENT STREQUAL "off" OR NOT PLATFORM_ARM)
|
||||
set(MSLITE_MINDDATA_IMPLEMENT full)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSLITE_ENABLE_NPU)
|
||||
|
@ -766,15 +758,7 @@ if(NOT PLATFORM_ARM)
|
|||
endif()
|
||||
|
||||
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "full"
|
||||
OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper")
|
||||
add_compile_definitions(ENABLE_ANDROID)
|
||||
if(NOT PLATFORM_ARM32 AND NOT PLATFORM_ARM64)
|
||||
add_compile_definitions(ENABLE_MD_LITE_X86_64)
|
||||
endif()
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minddata)
|
||||
endif()
|
||||
|
||||
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite_cv")
|
||||
OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "lite_cv")
|
||||
add_compile_definitions(ENABLE_ANDROID)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/minddata)
|
||||
endif()
|
||||
|
|
|
@ -299,7 +299,7 @@ build_lite() {
|
|||
checkndk
|
||||
export PATH=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin:${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${PATH}
|
||||
CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=on"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DANDROID_NATIVE_API_LEVEL=19 -DANDROID_NDK=${ANDROID_NDK} -DANDROID_ABI=armeabi-v7a -DANDROID_TOOLCHAIN_NAME=clang -DANDROID_STL=${MSLITE_ANDROID_STL}"
|
||||
fi
|
||||
|
@ -327,7 +327,7 @@ build_lite() {
|
|||
if [[ "${machine}" == "aarch64" ]]; then
|
||||
# CPU : Linux-aarch64
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMACHINE_LINUX_ARM64=on"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_TRAIN=off"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_GPU_BACKEND=off"
|
||||
else
|
||||
|
@ -336,7 +336,7 @@ build_lite() {
|
|||
export PATH=${ANDROID_NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin:${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:${PATH}
|
||||
CMAKE_TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DANDROID_NATIVE_API_LEVEL=19 -DANDROID_NDK=${ANDROID_NDK} -DANDROID_ABI=arm64-v8a -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-clang -DANDROID_STL=${MSLITE_ANDROID_STL}"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
|
||||
fi
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_ENABLE_FP16=on"
|
||||
fi
|
||||
|
@ -360,7 +360,7 @@ build_lite() {
|
|||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=off -DMSLITE_ENABLE_TRAIN=off -DMSLITE_GPU_BACKEND=off -DMSLITE_ENABLE_TOOLS=off"
|
||||
else
|
||||
# CPU : Linux-x86_64
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=lite_cv"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DMSLITE_MINDDATA_IMPLEMENT=full"
|
||||
LITE_CMAKE_ARGS="${LITE_CMAKE_ARGS} -DPLATFORM_X86_64=on"
|
||||
fi
|
||||
fi
|
||||
|
|
|
@ -101,6 +101,7 @@ AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/image/lite_cv MINDDATA_KERNELS_IMA
|
|||
|
||||
AUX_SOURCE_DIRECTORY(${MINDDATA_DIR}/kernels/ir MINDDATA_KERNELS_IR_SRC_FILES)
|
||||
|
||||
message(STATUS "Compile minddata in [${MSLITE_MINDDATA_IMPLEMENT}] mode")
|
||||
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "full")
|
||||
include_directories("${MINDDATA_DIR}")
|
||||
include_directories("${MINDDATA_DIR}/kernels/image")
|
||||
|
@ -321,20 +322,21 @@ if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "full")
|
|||
)
|
||||
|
||||
# ref: https://github.com/android/ndk/issues/1202
|
||||
if(PLATFORM_ARM32)
|
||||
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
|
||||
if(LIBCLANG_RT_LIB STREQUAL "")
|
||||
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
|
||||
endif()
|
||||
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
|
||||
target_link_libraries(minddata-lite_static ${LIBCLANG_RT_LIB})
|
||||
endif()
|
||||
if(ANDROID_NDK)
|
||||
if(PLATFORM_ARM32)
|
||||
file(GLOB_RECURSE LIBCLANG_RT_LIB $ENV{ANDROID_NDK}/libclang_rt.builtins-arm-android.a)
|
||||
if(LIBCLANG_RT_LIB STREQUAL "")
|
||||
MESSAGE(FATAL_ERROR "Cannot find libclang_rt.builtins-arm-androi2d.a in $ENV{ANDROID_NDK}")
|
||||
endif()
|
||||
target_link_libraries(minddata-lite ${LIBCLANG_RT_LIB})
|
||||
target_link_libraries(minddata-lite_static ${LIBCLANG_RT_LIB})
|
||||
endif()
|
||||
|
||||
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
target_link_libraries(minddata-lite log)
|
||||
target_link_libraries(minddata-lite_static log)
|
||||
elseif()
|
||||
endif()
|
||||
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
target_link_libraries(minddata-lite log)
|
||||
target_link_libraries(minddata-lite_static log)
|
||||
endif()
|
||||
endif()
|
||||
elseif(MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper")
|
||||
include_directories("${MINDDATA_DIR}/kernels/image")
|
||||
include_directories("${MINDDATA_DIR}/util")
|
||||
|
|
|
@ -359,6 +359,7 @@ set(TRAIN_SRC
|
|||
${TRAIN_SRC_WITH_MD}
|
||||
${EXPRESSION_SRC}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/common/quant_utils.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/cxx_api/metrics/accuracy.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/cxx_api/train/model_build.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/cxx_api/train/model_build_impl.cc
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/runtime/cxx_api/train/converters.cc
|
||||
|
|
|
@ -18,7 +18,13 @@
|
|||
#define MINDSPORE_LITE_SRC_COMMON_FILE_UTILS_H_
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if (defined(_WIN32) || defined(_WIN64)) && defined(_MSC_VER)
|
||||
#define F_OK 0
|
||||
using mode_t = int;
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <ctime>
|
||||
|
|
Loading…
Reference in New Issue