commit
3036f392be
|
@ -2,9 +2,11 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
|||
include_directories(${CMAKE_BINARY_DIR})
|
||||
include_directories(${CMAKE_SOURCE_DIR}/mindspore/core)
|
||||
add_subdirectory(gvar)
|
||||
if(NOT(CMAKE_SYSTEM_NAME MATCHES "Windows"))
|
||||
|
||||
if(NOT(COMPILE_LITE))
|
||||
add_subdirectory(mindrt)
|
||||
endif()
|
||||
|
||||
message("************ build core ***************")
|
||||
|
||||
file(GLOB_RECURSE CORE_SRC_LIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
|
|
|
@ -10,7 +10,6 @@ file(GLOB MINDRT_SRC
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/src/timer/*.cc
|
||||
)
|
||||
|
||||
|
||||
add_library(mindrt_mid OBJECT ${MINDRT_SRC})
|
||||
|
||||
|
||||
|
|
|
@ -13,9 +13,11 @@
|
|||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "async/uuid_base.h"
|
||||
#include <memory.h>
|
||||
#include <atomic>
|
||||
#include <random>
|
||||
#include "async/uuid_base.h"
|
||||
|
||||
namespace mindspore {
|
||||
namespace uuids {
|
||||
|
|
|
@ -73,7 +73,6 @@ class LiteBusExit {
|
|||
int InitializeImp(const std::string &tcpUrl, const std::string &tcpUrlAdv, const std::string &udpUrl,
|
||||
const std::string &udpUrlAdv, int threadCount) {
|
||||
ICTSBASE_LOG0(ICTSBASE_LOG_COMMON_CODE, HLOG_LEVEL_INFO, PID_LITEBUS_LOG, "litebus starts ......");
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
|
||||
// start actor's thread
|
||||
SetThreadCount(threadCount);
|
||||
|
|
|
@ -9,6 +9,7 @@ option(MS_VERSION_MAJOR "major version" 0)
|
|||
option(MS_VERSION_MINOR "minor version" 7)
|
||||
option(MS_VERSION_REVISION "revision version" 0)
|
||||
option(CMAKE_BUILD_TYPE "build type" Release)
|
||||
option(COMPILE_LITE "compile for lite" on)
|
||||
option(SUPPORT_TRAIN "if build for on-device train" off)
|
||||
option(PLATFORM_ARM64 "if build device for arm64" off)
|
||||
option(PLATFORM_ARM32 "if build device for arm32" off)
|
||||
|
@ -26,7 +27,7 @@ option(BUILD_MINDDATA_EXAMPLE "" on)
|
|||
option(ENABLE_VERBOSE "" off)
|
||||
option(ENABLE_SSE "if x86_64 support SSE instruction set" off)
|
||||
option(ENABLE_AVX "if x86_64 support SSE instruction set" off)
|
||||
#option(ENABLE_MINDRT "if support mindrt" on)
|
||||
option(ENABLE_MINDRT "if support mindrt" on)
|
||||
|
||||
set(DIR_PREFIX mindspore-lite)
|
||||
set(MS_VERSION ${MS_VERSION_MAJOR}.${MS_VERSION_MINOR}.${MS_VERSION_REVISION})
|
||||
|
@ -137,9 +138,8 @@ if(ENABLE_CONVERTER OR BUILD_MINDDATA STREQUAL "full" OR BUILD_MINDDATA STREQUAL
|
|||
include(${TOP_DIR}/cmake/external_libs/json.cmake)
|
||||
endif()
|
||||
|
||||
set(ENABLE_MINDRT "off")
|
||||
if(PLATFORM_ARM AND NOT SUPPORT_TRAIN)
|
||||
set(ENABLE_MINDRT "on")
|
||||
if(SUPPORT_TRAIN OR WIN32)
|
||||
set(ENABLE_MINDRT "off")
|
||||
endif()
|
||||
|
||||
file(GLOB FBS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/schema/*.fbs)
|
||||
|
@ -207,12 +207,7 @@ if(WIN32)
|
|||
add_compile_definitions(LITE_EXPORTS)
|
||||
add_compile_definitions(BUILDING_DLL)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MINDRT)
|
||||
include_directories(${CORE_DIR}/mindrt/include)
|
||||
add_compile_definitions(ENABLE_MINDRT)
|
||||
add_subdirectory(${CORE_DIR}/mindrt mindspore_mindrt)
|
||||
endif()
|
||||
add_subdirectory(${CORE_DIR}/mindrt mindspore_mindrt)
|
||||
|
||||
if(ENABLE_CONVERTER)
|
||||
if(PLATFORM_ARM)
|
||||
|
@ -225,6 +220,11 @@ if(ENABLE_CONVERTER)
|
|||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/micro/coder)
|
||||
endif()
|
||||
|
||||
if(ENABLE_MINDRT)
|
||||
include_directories(${CORE_DIR}/mindrt/include)
|
||||
add_compile_definitions(ENABLE_MINDRT)
|
||||
endif()
|
||||
|
||||
if(PLATFORM_ARM32 OR PLATFORM_ARM64)
|
||||
if(NOT DEFINED ENV{ANDROID_NDK})
|
||||
message(FATAL_ERROR "env ANDROID_NDK should be set for ARM compile")
|
||||
|
|
|
@ -410,6 +410,22 @@ int LiteSession::CompileGraph(Model *model) {
|
|||
}
|
||||
#endif
|
||||
InitGraphInOutTensors(model);
|
||||
|
||||
#ifdef ENABLE_MINDRT
|
||||
if (context_->IsCpuEnabled() && !context_->IsGpuEnabled() && !context_->IsNpuEnabled() && kernels_.size() == 1) {
|
||||
executor_ = new (std::nothrow) MindrtExecutor();
|
||||
} else {
|
||||
executor_ = new (std::nothrow) Executor();
|
||||
}
|
||||
#else
|
||||
executor_ = new (std::nothrow) Executor();
|
||||
#endif
|
||||
if (nullptr == executor_) {
|
||||
MS_LOG(ERROR) << "New Executor failed";
|
||||
is_running_.store(false);
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
ret = executor_->Prepare(this->kernels_);
|
||||
if (ret != RET_OK) {
|
||||
MS_LOG(ERROR) << "Prepare executor failed: " << ret;
|
||||
|
@ -515,20 +531,7 @@ int LiteSession::Init(const Context *context) {
|
|||
is_running_.store(false);
|
||||
return ret;
|
||||
}
|
||||
#ifdef ENABLE_MINDRT
|
||||
if (context_->IsCpuEnabled() && !context_->IsGpuEnabled() && !context_->IsNpuEnabled() && kernels_.size() == 1) {
|
||||
executor_ = new (std::nothrow) MindrtExecutor();
|
||||
} else {
|
||||
executor_ = new (std::nothrow) Executor();
|
||||
}
|
||||
#else
|
||||
executor_ = new (std::nothrow) Executor();
|
||||
#endif
|
||||
if (nullptr == executor_) {
|
||||
MS_LOG(ERROR) << "New Executor failed";
|
||||
is_running_.store(false);
|
||||
return RET_ERROR;
|
||||
}
|
||||
|
||||
is_running_.store(false);
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ add_subdirectory(parser/onnx)
|
|||
add_subdirectory(parser/tf)
|
||||
add_subdirectory(legacy_optimizer)
|
||||
add_subdirectory(quantizer)
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../core mindspore_core)
|
||||
add_subdirectory(${CORE_DIR} mindspore_core)
|
||||
|
||||
set(SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src)
|
||||
set(LITE_SRC
|
||||
|
@ -101,6 +101,13 @@ set(LITE_SRC
|
|||
${SRC_DIR}/dequant.cc
|
||||
${SRC_DIR}/huffman_decode.cc
|
||||
)
|
||||
|
||||
set(ENABLE_MINDRT "off")
|
||||
if(ENABLE_MINDRT)
|
||||
set(LITE_SRC ${LITE_SRC} ${SRC_DIR}/lite_mindrt.cc ${SRC_DIR}/mindrt_executor.cc)
|
||||
include_directories(${CORE_DIR}/mindrt/include)
|
||||
endif()
|
||||
|
||||
set(ARM_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../src/runtime/kernel/arm)
|
||||
file(GLOB KERNEL_SRC
|
||||
${ARM_DIR}/base/*.cc
|
||||
|
@ -150,6 +157,10 @@ add_executable(converter_lite
|
|||
add_dependencies(converter_lite fbs_src)
|
||||
add_dependencies(converter_lite fbs_inner_src)
|
||||
|
||||
if(ENABLE_MINDRT)
|
||||
target_link_libraries(converter_lite PRIVATE mindrt_mid)
|
||||
endif()
|
||||
|
||||
target_link_libraries(converter_lite PRIVATE
|
||||
tflite_parser_mid
|
||||
tf_parser_mid
|
||||
|
|
Loading…
Reference in New Issue