remove ENABLE_CLOUD_AND_LITE

This commit is contained in:
zhengyuanhua 2022-06-14 10:17:00 +08:00
parent 26405d4f4b
commit f09f6b1ee6
25 changed files with 47 additions and 209 deletions

View File

@ -110,15 +110,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
add_subdirectory(mindspore/ccsrc)
add_subdirectory(mindspore/core)
if(DEFINED ENV{ENABLE_CLOUD_AND_LITE})
set(ENABLE_CLOUD_AND_LITE $ENV{ENABLE_CLOUD_AND_LITE})
endif()
if(ENABLE_CLOUD_AND_LITE)
set(ENV{MSLITE_ENABLE_RUNTIME_CONVERT} "on")
set(ENV{MSLITE_ENABLE_ACL} "on")
add_subdirectory(mindspore/lite)
endif()
if(ENABLE_TESTCASES OR ENABLE_CPP_ST)
add_subdirectory(tests)
endif()

View File

@ -99,11 +99,7 @@ function(common_protobuf_generate path c_var h_var)
endfunction()
function(ms_protobuf_generate c_var h_var)
if(NOT ENABLE_CLOUD_AND_LITE)
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto ${c_var} ${h_var} ${ARGN})
else()
common_protobuf_generate(${CMAKE_BINARY_DIR}/proto/lite ${c_var} ${h_var} ${ARGN})
endif()
set(${c_var} ${${c_var}} PARENT_SCOPE)
set(${h_var} ${${h_var}} PARENT_SCOPE)
endfunction()

View File

@ -272,14 +272,6 @@ if(CMAKE_SYSTEM_NAME MATCHES "Windows")
)
endif()
if(ENABLE_CLOUD_AND_LITE)
install(
TARGETS mindspore-lite mslite_converter_plugin
DESTINATION ${INSTALL_LIB_DIR}
COMPONENT mindspore
)
endif()
# set python files
file(GLOB MS_PY_LIST ${CMAKE_SOURCE_DIR}/mindspore/python/mindspore/*.py)
install(

View File

@ -13,7 +13,7 @@ if(NOT(BUILD_LITE))
add_subdirectory(mindrt)
endif()
if(NOT ENABLE_COVERAGE AND (CMAKE_SIZEOF_VOID_P EQUAL 4 OR NOT BUILD_LITE OR DEFINED ENV{ENABLE_CLOUD_AND_LITE}))
if(NOT ENABLE_COVERAGE AND (CMAKE_SIZEOF_VOID_P EQUAL 4 OR NOT BUILD_LITE))
file(GLOB_RECURSE CORE_OPS_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ops/*.cc")
if(ENABLE_SECURITY)
file(GLOB_RECURSE _INFER_SUMMARY_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "ops/*_summary.cc")

View File

@ -14,16 +14,8 @@ 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")
if(NOT ENABLE_CLOUD_AND_LITE)
set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full")
else()
remove_definitions(-DUSE_GLOG)
add_compile_definitions(ENABLE_CLOUD_AND_LITE)
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(PLATFORM_ARM64 "on")
set(MACHINE_LINUX_ARM64 "on")
endif()
endif()
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)
@ -561,10 +553,9 @@ include_directories(${CCSRC_DIR}/minddata/dataset)
include(${TOP_DIR}/cmake/utils.cmake)
include(${TOP_DIR}/cmake/dependency_utils.cmake)
include(${TOP_DIR}/cmake/dependency_securec.cmake)
if(NOT ENABLE_CLOUD_AND_LITE)
# include(${TOP_DIR}/cmake/external_libs/flatbuffers.cmake)
set(MSLITE_DEPS_FLATBUFFERS on)
endif()
if(MSLITE_GPU_BACKEND STREQUAL opencl)
# include(${TOP_DIR}/cmake/external_libs/opencl.cmake)
@ -573,11 +564,9 @@ endif()
if(MSLITE_ENABLE_CONVERTER OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "full" OR MSLITE_MINDDATA_IMPLEMENT STREQUAL "wrapper"
OR MSLITE_ENABLE_TOOLS OR MSLITE_ENABLE_KERNEL_EXECUTOR)
if(NOT ENABLE_CLOUD_AND_LITE)
# include(${TOP_DIR}/cmake/external_libs/json.cmake)
set(MSLITE_DEPS_JSON on)
endif()
endif()
if(DEFINED ARCHS)
add_definitions(-DMS_COMPILE_IOS)
@ -645,7 +634,7 @@ if(ENABLE_MODEL_OBF)
set(OBF_LIBS libmsdeobfuscator-lite.so)
endif()
if((MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_RUNTIME_GLOG) AND NOT ENABLE_CLOUD_AND_LITE)
if((MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_RUNTIME_GLOG))
# include(${TOP_DIR}/cmake/external_libs/glog.cmake)
set(MSLITE_DEPS_GLOG on)
endif()
@ -660,37 +649,29 @@ endfunction()
if(MSLITE_ENABLE_CONVERTER OR MSLITE_ENABLE_KERNEL_EXECUTOR)
find_required_package(Patch)
if(NOT ENABLE_CLOUD_AND_LITE)
# include(${TOP_DIR}/cmake/external_libs/protobuf.cmake)
set(MSLITE_DEPS_PROTOBUF on)
endif()
endif()
if(NOT APPLE AND NOT ENABLE_CLOUD_AND_LITE)
if(NOT APPLE)
if(PLATFORM_X86_64 OR MACHINE_LINUX_ARM64)
if(NOT ENABLE_CLOUD_AND_LITE)
set(MSLITE_DEPS_PYBIND11 on)
endif()
endif()
endif()
if(MSLITE_ENABLE_CONVERTER)
if(NOT ENABLE_CLOUD_AND_LITE)
set(MSLITE_DEPS_OPENCV on)
set(MSLITE_DEPS_EIGEN on)
endif()
endif()
if(MSLITE_ENABLE_CLOUD_FUSION_INFERENCE)
if(NOT ENABLE_CLOUD_AND_LITE)
set(MSLITE_DEPS_MKLDNN on)
set(MSLITE_DEPS_LIBEVENT on)
set(MSLITE_DEPS_PYBIND11 on)
set(MSLITE_DEPS_OPENSSL on)
endif()
endif()
if(MSLITE_ENABLE_MODEL_ENCRYPTION AND NOT ENABLE_CLOUD_AND_LITE)
if(MSLITE_ENABLE_MODEL_ENCRYPTION)
set(MSLITE_DEPS_OPENSSL on)
endif()
@ -804,11 +785,9 @@ if(ANDROID_NDK_TOOLCHAIN_INCLUDED)
endif()
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/src)
if(NOT ENABLE_CLOUD_AND_LITE)
add_subdirectory(${CCSRC_DIR}/plugin/device/cpu/kernel/nnacl build)
endif()
if(MSLITE_ENABLE_TOOLS AND NOT ENABLE_CLOUD_AND_LITE)
if(MSLITE_ENABLE_TOOLS)
if(NOT MSLITE_COMPILE_TWICE)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tools/benchmark)
endif()
@ -827,7 +806,7 @@ if(NOT WIN32 AND MSLITE_ENABLE_TESTCASES)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/test)
endif()
if(NOT APPLE AND NOT ENABLE_CLOUD_AND_LITE)
if(NOT APPLE)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/file_list.cmake)
include(${TOP_DIR}/cmake/package_lite.cmake)

View File

@ -1,10 +1,5 @@
add_compile_definitions(BUILD_LITE)
if(ENABLE_CLOUD_AND_LITE)
remove_definitions(-DUSE_GLOG)
add_compile_definitions(ENABLE_CLOUD_AND_LITE)
endif()
add_definitions(-DVERSION_STR=\"${VERSION_STR}\")
if(MACHINE_LINUX_ARM64)

View File

@ -10,14 +10,8 @@ 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")
if(NOT ENABLE_CLOUD_AND_LITE)
set(MSLITE_MINDDATA_IMPLEMENT "lite_cv" CACHE STRING "off, lite_cv, cloud, or full")
else()
if(${CMAKE_HOST_SYSTEM_PROCESSOR} MATCHES "aarch64")
set(PLATFORM_ARM64 "on")
set(MACHINE_LINUX_ARM64 "on")
endif()
endif()
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)

View File

@ -1,4 +1,4 @@
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" AND NOT ENABLE_CLOUD_AND_LITE)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_SKIP_RPATH TRUE)
set(CMAKE_SKIP_BUILD_RPATH TRUE)
set(CMAKE_SKIP_INSTALL_RPATH TRUE)

View File

@ -388,9 +388,7 @@ set(TRAIN_SRC
)
if(MSLITE_ENABLE_MINDRT)
if(NOT ENABLE_CLOUD_AND_LITE)
add_subdirectory(${CORE_DIR}/mindrt mindspore_mindrt)
endif()
set(LITE_SRC ${LITE_SRC}
${CMAKE_CURRENT_SOURCE_DIR}/runtime/lite_mindrt.cc
${CMAKE_CURRENT_SOURCE_DIR}/runtime/mindrt_executor.cc
@ -581,12 +579,10 @@ if(MSLITE_ENABLE_RUNTIME_CONVERT)
cpu_kernel_mid ccsrc_src_mid converter_src_mid lite_exporter_mid
config_parser_mid mslite_converter_plugin mindspore_core coder_mid
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
if(NOT ENABLE_CLOUD_AND_LITE)
target_link_libraries(mindspore-lite
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj)
target_link_libraries(mindspore-lite_static
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj)
endif()
if(MSLITE_ENABLE_ACL)
target_link_libraries(mindspore-lite lite_acl_mid
mindspore_shared_lib)
@ -648,7 +644,3 @@ if(MSLITE_ENABLE_ACL)
target_link_libraries(mindspore-lite ascend_kernel_mid)
target_link_libraries(mindspore-lite_static ascend_kernel_mid)
endif()
if(ENABLE_CLOUD_AND_LITE)
set_target_properties(mindspore-lite PROPERTIES INSTALL_RPATH $ORIGIN)
endif()

View File

@ -20,11 +20,7 @@
#include <string>
#include <vector>
#include "google/protobuf/message.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/caffe.pb.h"
#else
#include "proto/caffe.pb.h"
#endif
#include "include/errorcode.h"
#include "schema/inner/model_generated.h"

View File

@ -91,16 +91,13 @@ add_subdirectory(registry)
add_subdirectory(preprocess)
add_subdirectory(config_parser)
add_subdirectory(micro/coder)
if(NOT ENABLE_CLOUD_AND_LITE)
add_subdirectory(${CORE_DIR} mindspore_core)
endif()
if(MSLITE_ENABLE_ACL)
set(MODE_ASCEND_ACL ON)
include_directories(${TOP_DIR}/graphengine/inc/external)
if(NOT ENABLE_CLOUD_AND_LITE)
include(${TOP_DIR}/cmake/dependency_graphengine.cmake)
endif()
add_subdirectory(adapter/acl)
link_directories(${ASCEND_CANN_RUNTIME_PATH} ${ASCEND_TOOLKIT_RUNTIME_PATH})
endif()
@ -303,9 +300,8 @@ add_dependencies(ccsrc_src_mid fbs_src fbs_inner_src)
target_compile_definitions(ccsrc_src_mid PRIVATE BACKEND_DLL)
target_compile_definitions(converter_src_mid PRIVATE BACKEND_DLL)
if(NOT ENABLE_CLOUD_AND_LITE)
add_dependencies(mindspore_converter nnacl_mid)
endif()
if((NOT WIN32) AND MSLITE_ENABLE_DPICO_ATC_ADAPTER)
add_dependencies(mindspore_converter dpico_atc_adapter)
endif()
@ -357,12 +353,11 @@ if(ENABLE_CONVERT_PYTORCH_MODEL)
target_link_libraries(mindspore_converter pytorch_parser_mid)
endif()
if(NOT ENABLE_CLOUD_AND_LITE)
target_link_libraries(mindspore_converter
ccsrc_debug_common_mid_
mindir_proto_mid
_mindspore_transform_express_ir_obj)
endif()
if(MSLITE_ENABLE_ACL)
target_link_libraries(mindspore_converter
lite_acl_mid

View File

@ -18,53 +18,12 @@ file(GLOB ACL_SRC
set(ENABLE_ACL on)
set(MODE_ASCEND_ACL off)
if(NOT ENABLE_CLOUD_AND_LITE)
add_subdirectory(${TOP_DIR}/mindspore/ccsrc/transform/graph_ir _mindspore_transform_graph_ir_obj)
add_subdirectory(${TOP_DIR}/mindspore/ccsrc/cxx_api mindspore_shared_lib)
endif()
set_property(SOURCE ${ACL_SRC} PROPERTY COMPILE_DEFINITIONS SUBMODULE_ID=mindspore::SubModuleId::SM_LITE)
add_library(lite_acl_mid OBJECT ${ACL_SRC})
target_link_libraries(lite_acl_mid mindspore_shared_lib)
add_dependencies(lite_acl_mid mindspore_shared_lib)
add_dependencies(lite_acl_mid fbs_inner_src)
if(MSLITE_MINDDATA_IMPLEMENT STREQUAL "cloud")
set(MSLITE_ENABLE_CLOUD_MIND_DATA ON)
# find python
include(${TOP_DIR}/mindspore/lite/cmake/python.cmake)
if(Python3_FOUND)
set(PYTHON_INCLUDE_DIRS "${Python3_INCLUDE_DIRS}")
set(PYTHON_LIBRARIES "${Python3_LIBRARIES}")
else()
find_python_package(py_inc py_lib)
set(PYTHON_INCLUDE_DIRS "${py_inc}")
set(PYTHON_LIBRARIES "${py_lib}")
endif()
message("Python version: ${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}")
message("PYTHON_INCLUDE_DIRS = ${PYTHON_INCLUDE_DIRS}")
message("PYTHON_LIBRARIES = ${PYTHON_LIBRARIES}")
include_directories(${PYTHON_INCLUDE_DIRS})
# MindData
add_compile_definitions(ENABLE_LITE_TENSOR)
add_compile_definitions(ENABLE_PYTHON)
set(ENABLE_PYTHON ON)
include(${TOP_DIR}/cmake/external_libs/sentencepiece.cmake)
include(${TOP_DIR}/cmake/external_libs/jpeg_turbo.cmake)
include(${TOP_DIR}/cmake/external_libs/tinyxml2.cmake)
include(${TOP_DIR}/cmake/external_libs/icu4c.cmake)
include(${TOP_DIR}/cmake/external_libs/sqlite.cmake)
include(${TOP_DIR}/cmake/external_libs/pybind11.cmake)
include(${TOP_DIR}/cmake/external_libs/cppjieba.cmake)
include(${TOP_DIR}/cmake/external_libs/re2.cmake)
include(${TOP_DIR}/cmake/external_libs/c-ares.cmake)
include(${TOP_DIR}/cmake/external_libs/absl.cmake)
include(${TOP_DIR}/cmake/external_libs/grpc.cmake)
set(MINDDATA_DIR ${CCSRC_DIR}/minddata/dataset)
include_directories("${MINDDATA_DIR}/kernels/image")
add_subdirectory(${CCSRC_DIR}/minddata/mindrecord _c_mindrecord)
add_subdirectory(${CCSRC_DIR}/minddata/dataset _c_dataengine)
endif()

View File

@ -22,11 +22,7 @@
#include <unordered_map>
#include <memory>
#include <vector>
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/caffe.pb.h"
#else
#include "proto/caffe.pb.h"
#endif
#include "include/errorcode.h"
namespace mindspore {

View File

@ -23,11 +23,7 @@
#include <unordered_map>
#include "include/registry/model_parser.h"
#include "include/registry/model_parser_registry.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/caffe.pb.h"
#else
#include "proto/caffe.pb.h"
#endif
#include "ops/primitive_c.h"
using STATUS = int;

View File

@ -21,11 +21,7 @@
#include <vector>
#include "google/protobuf/message.h"
#include "schema/inner/model_generated.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/caffe.pb.h"
#else
#include "proto/caffe.pb.h"
#endif
#include "tools/converter/parser/caffe/caffe_node_parser.h"
#include "include/errorcode.h"
#include "src/common/log_adapter.h"

View File

@ -20,11 +20,7 @@
#include <string>
#include <unordered_map>
#include "tools/converter/parser/caffe/caffe_node_parser.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/caffe.pb.h"
#else
#include "proto/caffe.pb.h"
#endif
namespace mindspore::lite {
class CaffeNodeParserRegistry {

View File

@ -30,11 +30,7 @@
#include "include/registry/model_parser.h"
#include "include/registry/model_parser_registry.h"
#include "tools/converter/parser/onnx/onnx_node_parser_registry.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/onnx.pb.h"
#else
#include "proto/onnx.pb.h"
#endif
#include "schema/inner/model_generated.h"
namespace mindspore {

View File

@ -21,11 +21,7 @@
#include <utility>
#include <vector>
#include "google/protobuf/message.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/onnx.pb.h"
#else
#include "proto/onnx.pb.h"
#endif
#include "include/errorcode.h"
#include "src/common/log_adapter.h"
#include "schema/inner/model_generated.h"

View File

@ -24,13 +24,8 @@
#include <vector>
#include <set>
#include <utility>
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/graph.pb.h"
#include "proto/lite/node_def.pb.h"
#else
#include "proto/graph.pb.h"
#include "proto/node_def.pb.h"
#endif
#include "schema/inner/model_generated.h"
#include "securec/include/securec.h"
#include "tools/common/tensor_util.h"

View File

@ -22,11 +22,7 @@
#include <map>
#include <memory>
#include "tools/converter/parser/tf/tf_util.h"
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/graph.pb.h"
#else
#include "proto/graph.pb.h"
#endif
#include "ops/primitive_c.h"
#include "mindspore/core/utils/check_convert_utils.h"
#include "nnacl/op_base.h"

View File

@ -19,11 +19,7 @@
#include <string>
#include <string_view>
#ifdef ENABLE_CLOUD_AND_LITE
#include "proto/lite/node_def.pb.h"
#else
#include "proto/node_def.pb.h"
#endif
#include "ir/dtype/type_id.h"
#include "include/errorcode.h"
#include "schema/inner/model_generated.h"

View File

@ -14,13 +14,9 @@ add_library(mindir_proto_mid OBJECT ${PROTO_SRCS})
add_compile_definitions(MINDIR_EXPORT_TENSOR_LAYOUT_CLIP)
add_compile_definitions(COMMON_DLL)
if(NOT ENABLE_CLOUD_AND_LITE)
# if(NOT MSLITE_ENABLE_CLOUD_FUSION_INFERENCE)
set(MINDIR_EXPORT_DIR ${CCSRC_DIR}/transform/express_ir)
add_subdirectory(${MINDIR_EXPORT_DIR} mindir_exporter)
add_dependencies(_mindspore_transform_express_ir_obj mindir_proto_mid)
# endif()
endif()
add_library(mindir_serializer_mid OBJECT
${MINDIR_EXPORTER_SRC_LIST}

View File

@ -31,7 +31,6 @@ namespace mindspore::lite {
constexpr const size_t TOTAL_SAVE = 1024 * 1024 * 1024;
constexpr const int64_t OFFSET = 64;
#ifndef ENABLE_CLOUD_AND_LITE
namespace {
bool DeleteDirRecursively(const std::string &dir_name) {
DIR *dir = opendir(dir_name.c_str());
@ -402,18 +401,12 @@ int MindIRSerializer::SaveProtoToFile(mind_ir::ModelProto *model_proto, const st
ChangeFileMode(realpath.value(), S_IRUSR);
return RET_OK;
}
#endif
int MindIRSerialize(const std::shared_ptr<ConverterPara> &param, const FuncGraphPtr &func_graph) {
#ifndef ENABLE_CLOUD_AND_LITE
if (!param->export_mindir) {
return RET_OK;
}
mindspore::lite::MindIRSerializer serializer;
return serializer.Save(param, func_graph);
#else
MS_LOG(INFO) << "No need to serialize mindir when load model online.";
return RET_OK;
#endif
}
} // namespace mindspore::lite

View File

@ -29,7 +29,6 @@
#include "tools/converter/cxx_api/converter_para.h"
namespace mindspore::lite {
#ifndef ENABLE_CLOUD_AND_LITE
class MindIRSerializer {
public:
MindIRSerializer() = default;
@ -72,7 +71,6 @@ class MindIRSerializer {
std::fstream *data_fs_ = nullptr;
std::shared_ptr<system::FileSystem> fs_{};
};
#endif
// export func_graph
int MindIRSerialize(const std::shared_ptr<ConverterPara> &param, const FuncGraphPtr &func_graph);
} // namespace mindspore::lite

View File

@ -56,7 +56,6 @@ parse_device()
ENABLE_CPU="on"
export ENABLE_MPI="on"
export ENABLE_AKG="on"
export ENABLE_CLOUD_AND_LITE="on"
else
echo "Invalid value ${DEVICE_VERSION} for option -V"
usage