!32287 package lite so in cloud whl when build ascend 910 whl
Merge pull request !32287 from zhengyuanhua/br1
This commit is contained in:
commit
bafbba1a0b
|
@ -109,9 +109,11 @@ 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})
|
||||
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()
|
||||
|
||||
|
|
|
@ -98,7 +98,10 @@ endif()
|
|||
if(DEFINED ENV{MSLITE_ENABLE_CONVERTER})
|
||||
set(MSLITE_ENABLE_CONVERTER $ENV{MSLITE_ENABLE_CONVERTER})
|
||||
endif()
|
||||
if(DEFINED ENV{ENABLE_AKG})
|
||||
if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
|
||||
set(MSLITE_ENABLE_RUNTIME_CONVERT $ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
|
||||
endif()
|
||||
if(DEFINED ENV{ENABLE_AKG} AND NOT MSLITE_ENABLE_RUNTIME_CONVERT)
|
||||
set(MSLITE_ENABLE_GRAPH_KERNEL $ENV{ENABLE_AKG})
|
||||
endif()
|
||||
if(DEFINED ENV{MSLITE_ENABLE_TOOLS})
|
||||
|
@ -161,10 +164,6 @@ if(DEFINED ENV{MSLITE_ENABLE_MODEL_ENCRYPTION})
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
|
||||
set(MSLITE_ENABLE_RUNTIME_CONVERT $ENV{MSLITE_ENABLE_RUNTIME_CONVERT})
|
||||
endif()
|
||||
|
||||
if(DEFINED ENV{MSLITE_ENABLE_COVERAGE})
|
||||
set(MSLITE_ENABLE_COVERAGE $ENV{MSLITE_ENABLE_COVERAGE})
|
||||
endif()
|
||||
|
|
|
@ -488,12 +488,14 @@ if(MSLITE_ENABLE_RUNTIME_CONVERT)
|
|||
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
|
||||
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
|
||||
config_parser_mid mslite_converter_plugin mindspore_core coder_mid
|
||||
mindspore::protobuf ${SECUREC_LIBRARY})
|
||||
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj
|
||||
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
|
||||
target_link_libraries(mindspore-lite_static
|
||||
quantizer_mid fusion_mid proto_mid graph_pass_mid preprocess_mid
|
||||
cpu_kernel_mid ccsrc_src_mid converter_src_mid anf_exporter_mid
|
||||
config_parser_mid mslite_converter_plugin mindspore_core coder_mid
|
||||
mindspore::protobuf ${SECUREC_LIBRARY})
|
||||
ccsrc_debug_common_mid_ mindir_proto_mid _mindspore_transform_express_ir_obj
|
||||
mindir_serializer_mid mindspore::protobuf ${SECUREC_LIBRARY})
|
||||
if(MSLITE_ENABLE_ACL)
|
||||
target_link_libraries(mindspore-lite lite_acl_mid
|
||||
mindspore_shared_lib)
|
||||
|
|
|
@ -302,12 +302,14 @@ target_link_libraries(converter_lite PRIVATE
|
|||
preprocess_mid
|
||||
config_parser_mid
|
||||
coder_mid
|
||||
ccsrc_debug_common_mid_
|
||||
mindir_proto_mid
|
||||
_mindspore_transform_express_ir_obj
|
||||
mindir_serializer_mid
|
||||
)
|
||||
|
||||
if(NOT ENABLE_CLOUD_AND_LITE)
|
||||
target_link_libraries(converter_lite PRIVATE
|
||||
ccsrc_debug_common_mid_
|
||||
mindir_proto_mid
|
||||
_mindspore_transform_express_ir_obj)
|
||||
endif()
|
||||
if(MSLITE_ENABLE_ACL)
|
||||
target_link_libraries(converter_lite PRIVATE
|
||||
lite_acl_mid
|
||||
|
|
|
@ -14,8 +14,10 @@ add_library(mindir_proto_mid OBJECT ${PROTO_SRCS})
|
|||
add_compile_definitions(MINDIR_EXPORT_TENSOR_LAYOUT_CLIP)
|
||||
add_compile_definitions(COMMON_DLL)
|
||||
|
||||
set(MINDIR_EXPORT_DIR ${CCSRC_DIR}/transform/express_ir)
|
||||
add_subdirectory(${MINDIR_EXPORT_DIR} mindir_exporter)
|
||||
if(NOT ENABLE_CLOUD_AND_LITE)
|
||||
set(MINDIR_EXPORT_DIR ${CCSRC_DIR}/transform/express_ir)
|
||||
add_subdirectory(${MINDIR_EXPORT_DIR} mindir_exporter)
|
||||
endif()
|
||||
|
||||
add_library(mindir_serializer_mid OBJECT
|
||||
${MINDIR_EXPORTER_SRC_LIST}
|
||||
|
|
|
@ -30,6 +30,7 @@ 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());
|
||||
|
@ -400,16 +401,18 @@ int MindIRSerializer::SaveProtoToFile(mind_ir::ModelProto *model_proto, const st
|
|||
ChangeFileMode(realpath.value(), S_IRUSR);
|
||||
return RET_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph) {
|
||||
#ifndef ENABLE_CLOUD_AND_LITE
|
||||
if (!flag->export_mindir) {
|
||||
return RET_OK;
|
||||
}
|
||||
#if defined(SYSTEM_ENV_WINDOWS)
|
||||
MS_LOG(WARNING) << "mindir serialize not support windows now.";
|
||||
return RET_NOT_SUPPORT;
|
||||
#endif
|
||||
mindspore::lite::MindIRSerializer serializer;
|
||||
return serializer.Save(flag, func_graph);
|
||||
#else
|
||||
MS_LOG(INFO) << "No need to serialize mindir when load model online.";
|
||||
return RET_OK;
|
||||
#endif
|
||||
}
|
||||
} // namespace mindspore::lite
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "mindspore/core/utils/system/env.h"
|
||||
|
||||
namespace mindspore::lite {
|
||||
#ifndef ENABLE_CLOUD_AND_LITE
|
||||
class MindIRSerializer {
|
||||
public:
|
||||
MindIRSerializer() = default;
|
||||
|
@ -71,7 +72,7 @@ class MindIRSerializer {
|
|||
std::fstream *data_fs_ = nullptr;
|
||||
std::shared_ptr<system::FileSystem> fs_{};
|
||||
};
|
||||
|
||||
#endif
|
||||
// export func_graph
|
||||
int MindIRSerialize(const std::unique_ptr<converter::Flags> &flag, const FuncGraphPtr &func_graph);
|
||||
} // namespace mindspore::lite
|
||||
|
|
|
@ -56,6 +56,7 @@ 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
|
||||
|
|
Loading…
Reference in New Issue