Browse Source

!25867 [MSLITE] runtime convert off

Merge pull request !25867 from ling/conv
tags/v1.6.0
i-robot Gitee 4 years ago
parent
commit
d82f65dae5
37 changed files with 13 additions and 72 deletions
  1. +0
    -1
      mindspore/core/mindrt/include/actor/actor.h
  2. +0
    -2
      mindspore/core/mindrt/include/actor/actorapp.h
  3. +0
    -1
      mindspore/core/mindrt/include/actor/aid.h
  4. +0
    -1
      mindspore/core/mindrt/include/actor/msg.h
  5. +0
    -2
      mindspore/core/mindrt/include/actor/naught.h
  6. +0
    -1
      mindspore/core/mindrt/include/actor/op_actor.h
  7. +0
    -2
      mindspore/core/mindrt/include/actor/switch_actor.h
  8. +0
    -2
      mindspore/core/mindrt/include/async/apply.h
  9. +0
    -2
      mindspore/core/mindrt/include/async/async.h
  10. +0
    -2
      mindspore/core/mindrt/include/async/collect.h
  11. +0
    -2
      mindspore/core/mindrt/include/async/common.h
  12. +0
    -2
      mindspore/core/mindrt/include/async/future.h
  13. +0
    -5
      mindspore/core/mindrt/include/async/future_base.h
  14. +0
    -2
      mindspore/core/mindrt/include/async/option.h
  15. +0
    -2
      mindspore/core/mindrt/include/async/result.h
  16. +0
    -2
      mindspore/core/mindrt/include/async/spinlock.h
  17. +0
    -2
      mindspore/core/mindrt/include/async/status.h
  18. +0
    -2
      mindspore/core/mindrt/include/async/uuid_base.h
  19. +0
    -3
      mindspore/core/mindrt/include/async/uuid_generator.h
  20. +0
    -3
      mindspore/core/mindrt/src/actor/actormgr.h
  21. +0
    -2
      mindspore/core/mindrt/src/actor/iomgr.h
  22. +0
    -1
      mindspore/core/mindrt/src/actor/mailbox.h
  23. +0
    -1
      mindspore/core/mindrt/src/mindrt.cc
  24. +5
    -10
      mindspore/core/mindrt/src/thread/actor_threadpool.cc
  25. +0
    -1
      mindspore/core/mindrt/src/thread/actor_threadpool.h
  26. +2
    -1
      mindspore/core/mindrt/src/thread/core_affinity.cc
  27. +0
    -1
      mindspore/core/mindrt/src/thread/core_affinity.h
  28. +0
    -3
      mindspore/core/mindrt/src/thread/hqueue.h
  29. +2
    -2
      mindspore/core/mindrt/src/thread/threadpool.cc
  30. +0
    -1
      mindspore/core/mindrt/src/thread/threadpool.h
  31. +1
    -1
      mindspore/lite/CMakeLists.txt
  32. +0
    -1
      mindspore/lite/examples/train_lenet/prepare_and_run.sh
  33. +0
    -1
      mindspore/lite/examples/train_lenet_java/build.sh
  34. +0
    -1
      mindspore/lite/examples/unified_api/prepare_and_run.sh
  35. +1
    -1
      mindspore/lite/test/st/scripts/run_benchmark_asan.sh
  36. +2
    -2
      mindspore/lite/test/st/scripts/run_benchmark_x86.sh
  37. +0
    -1
      mindspore/lite/test/st/scripts/tensorrt/run_tensorrt.sh

+ 0
- 1
mindspore/core/mindrt/include/actor/actor.h View File

@@ -212,7 +212,6 @@ class ActorBase {

ActorThreadPool *pool_{nullptr};
};

using ActorReference = std::shared_ptr<ActorBase>;
}; // namespace mindspore
#endif

+ 0
- 2
mindspore/core/mindrt/include/actor/actorapp.h View File

@@ -25,7 +25,6 @@
#include "actor/actor.h"

namespace mindspore {

class MessageLocal : public MessageBase {
public:
MessageLocal(const AID &from, const AID &to, const std::string &name, void *aPtr)
@@ -91,7 +90,6 @@ class AppActor : public ActorBase {
private:
std::map<std::string, APPBehavior> appBehaviors;
};

} // namespace mindspore

#endif

+ 0
- 1
mindspore/core/mindrt/include/actor/aid.h View File

@@ -22,7 +22,6 @@
#include "actor/log.h"

namespace mindspore {

constexpr auto MINDRT_TCP = "tcp";
constexpr auto MINDRT_UDP = "udp";



+ 0
- 1
mindspore/core/mindrt/include/actor/msg.h View File

@@ -80,7 +80,6 @@ class MessageBase {
std::string body;
Type type;
};

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/actor/naught.h View File

@@ -21,7 +21,6 @@
#include <string>

namespace mindspore {

class Naught;
class ActorBase;

@@ -34,7 +33,6 @@ class Naught {
public:
virtual ~Naught() {}
};

}; // namespace mindspore

#endif

+ 0
- 1
mindspore/core/mindrt/include/actor/op_actor.h View File

@@ -152,7 +152,6 @@ int MindrtRun(const std::vector<OpDataPtr<T>> &input_data, std::vector<OpDataPtr

return 0;
}

} // namespace mindspore

#endif // MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_OP_ACTOR_H

+ 0
- 2
mindspore/core/mindrt/include/actor/switch_actor.h View File

@@ -24,7 +24,6 @@
#include "actor/op_actor.h"

namespace mindspore {

template <typename T>
class SwitchActorBase : public OpActor<T> {
public:
@@ -38,7 +37,6 @@ class SwitchActorBase : public OpActor<T> {
// Different output branches according to the input.
std::vector<std::vector<DataArrowPtr>> output_branch_arrows_;
};

} // namespace mindspore

#endif // MINDSPORE_CORE_MINDRT_INCLUDE_ACTOR_SWITCH_ACTOR_H

+ 0
- 2
mindspore/core/mindrt/include/async/apply.h View File

@@ -20,7 +20,6 @@
#include <utility>

namespace mindspore {

template <typename T, T... Ints>
struct IntegerSequenceBase {
static constexpr std::size_t Size() noexcept { return sizeof...(Ints); }
@@ -77,7 +76,6 @@ auto Apply(T *ptr, Func &&func, Tuple &&tuple)
return ApplyHelper(ptr, std::forward<Func>(func), std::forward<Tuple>(tuple),
make_index_sequence<std::tuple_size<typename std::decay<Tuple>::type>::value>{});
}

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/async.h View File

@@ -28,7 +28,6 @@
#include "async/future.h"

namespace mindspore {

using MessageHandler = std::function<void(ActorBase *)>;

class MessageAsync : public MessageBase {
@@ -275,7 +274,6 @@ template <typename F, typename R = typename std::result_of<F()>::type>
auto Async(const AID &aid, F &&f) -> decltype(internal::AsyncHelper<R>()(aid, std::forward<F>(f))) {
return internal::AsyncHelper<R>()(aid, std::forward<F>(f));
}

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/collect.h View File

@@ -30,7 +30,6 @@
#include "mindrt/include/mindrt.hpp"

namespace mindspore {

template <typename T>
class Future;

@@ -112,7 +111,6 @@ Future<std::tuple<Ts...>> Collect(const Future<Ts> &... futures) {

return Collect(wrappers).Then(std::bind(f, futures...));
}

}; // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/common.h View File

@@ -18,9 +18,7 @@
#define MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_COMMON_H

namespace mindspore {

struct Nothing {};

} // namespace mindspore

#endif /* COMMON_HPP__ */

+ 0
- 2
mindspore/core/mindrt/include/async/future.h View File

@@ -31,7 +31,6 @@
#include "mindrt/include/mindrt.hpp"

namespace mindspore {

template <typename T>
class Promise;

@@ -447,7 +446,6 @@ class Promise<void>;

template <typename T>
class Promise<T &>;

}; // namespace mindspore

#endif

+ 0
- 5
mindspore/core/mindrt/include/async/future_base.h View File

@@ -30,13 +30,11 @@
#include "async/status.h"

namespace mindspore {

template <typename T>
class Future;

template <typename T>
class Promise;

class LessFuture {
public:
LessFuture() {}
@@ -104,7 +102,6 @@ struct FutureData {
};

namespace internal {

template <typename T>
class DeferredHelper;

@@ -179,9 +176,7 @@ static void Afterf(const std::function<Future<T>(const Future<T> &)> &f, const s
}

void Waitf(const AID &aid);

} // namespace internal

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/option.h View File

@@ -23,7 +23,6 @@
#include "actor/log.h"

namespace mindspore {

template <typename T>
struct InnerSome {
explicit InnerSome(const T &t) : _t(std::move(t)) {}
@@ -105,7 +104,6 @@ class Option {
T data;
State state;
};

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/result.h View File

@@ -23,7 +23,6 @@
#include "async/status.h"

namespace mindspore {

template <typename... Types>
class Result {
public:
@@ -66,7 +65,6 @@ class Result {
std::tuple<Option<Types>...> tuple;
Status status;
};

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/spinlock.h View File

@@ -20,7 +20,6 @@
#include <atomic>

namespace mindspore {

class SpinLock {
public:
void Lock() {
@@ -33,7 +32,6 @@ class SpinLock {
private:
std::atomic_flag locked = ATOMIC_FLAG_INIT;
};

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/status.h View File

@@ -18,7 +18,6 @@
#define MINDSPORE_CORE_MINDRT_INCLUDE_ASYNC_STATUS_H

namespace mindspore {

class MindrtStatus {
public:
typedef int32_t Code;
@@ -63,7 +62,6 @@ class MindrtStatus {
private:
Code code;
};

} // namespace mindspore

#endif

+ 0
- 2
mindspore/core/mindrt/include/async/uuid_base.h View File

@@ -27,7 +27,6 @@

namespace mindspore {
namespace uuids {

const std::size_t UUID_SIZE = 16;

struct uuid {
@@ -98,7 +97,6 @@ std::basic_ostream<T, F> &operator<<(std::basic_ostream<T, F> &s, const struct u
s << std::setfill(static_cast<T>(' ')) << std::dec;
return s;
}

} // namespace uuids
} // namespace mindspore



+ 0
- 3
mindspore/core/mindrt/include/async/uuid_generator.h View File

@@ -21,7 +21,6 @@
#include "async/uuid_base.h"

namespace mindspore {

namespace uuid_generator {
struct UUID : public mindspore::uuids::uuid {
public:
@@ -38,8 +37,6 @@ int GenLocalActorId();
int GenHttpClientConnId();
int GenHttpServerConnId();
#endif

} // namespace localid_generator

} // namespace mindspore
#endif

+ 0
- 3
mindspore/core/mindrt/src/actor/actormgr.h View File

@@ -31,10 +31,8 @@
#include "thread/hqueue.h"

namespace mindspore {

class ActorBase;
class IOMgr;

class ActorMgr {
public:
static inline ActorMgr *GetActorMgrRef() { return &actorMgr; }
@@ -101,6 +99,5 @@ class ActorMgr {
static ActorMgr actorMgr;
static std::map<std::string, std::shared_ptr<IOMgr> > ioMgrs;
}; // end of class ActorMgr

}; // end of namespace mindspore
#endif

+ 0
- 2
mindspore/core/mindrt/src/actor/iomgr.h View File

@@ -23,7 +23,6 @@
#include "actor/msg.h"

namespace mindspore {

class AID;
class MessageBase;

@@ -85,7 +84,6 @@ class IOMgr {
IOMgr() {}
virtual ~IOMgr() {}
};

}; // namespace mindspore

#endif

+ 0
- 1
mindspore/core/mindrt/src/actor/mailbox.h View File

@@ -99,7 +99,6 @@ class HQueMailBox : public MailBox {
HQueue<MessageBase> mailbox;
static const int32_t MAX_MSG_QUE_SIZE = 4096;
};

} // namespace mindspore

#endif // MINDSPORE_MAILBOX_H

+ 0
- 1
mindspore/core/mindrt/src/mindrt.cc View File

@@ -134,5 +134,4 @@ void SetHttpKmsgFlag(int flag) {
}

int GetHttpKmsgFlag() { return g_httpKmsgEnable; }

} // namespace mindspore

+ 5
- 10
mindspore/core/mindrt/src/thread/actor_threadpool.cc View File

@@ -183,16 +183,14 @@ ActorThreadPool *ActorThreadPool::CreateThreadPool(size_t actor_thread_num, size
if (pool == nullptr) {
return nullptr;
}
int ret;
std::vector<int> core_list;
#ifdef BIND_CORE
ret = pool->InitAffinityInfo();

auto ret = pool->InitAffinityInfo();
if (ret != THREAD_OK) {
delete pool;
return nullptr;
}
core_list = pool->affinity_->GetCoreId(all_thread_num, bind_mode);
#endif // BIND_CORE
auto core_list = pool->affinity_->GetCoreId(all_thread_num, bind_mode);
ret = pool->CreateThreads(actor_thread_num, all_thread_num, core_list);
if (ret != THREAD_OK) {
delete pool;
@@ -208,14 +206,11 @@ ActorThreadPool *ActorThreadPool::CreateThreadPool(size_t actor_thread_num, size
if (pool == nullptr) {
return nullptr;
}
int ret;
#ifdef BIND_CORE
ret = pool->InitAffinityInfo();
int ret = pool->InitAffinityInfo();
if (ret != THREAD_OK) {
delete pool;
return nullptr;
}
#endif // BIND_CORE
ret = pool->CreateThreads(actor_thread_num, all_thread_num, core_list);
if (ret != THREAD_OK) {
delete pool;


+ 0
- 1
mindspore/core/mindrt/src/thread/actor_threadpool.h View File

@@ -29,7 +29,6 @@
#define USE_HQUEUE
namespace mindspore {
class ActorThreadPool;

class ActorWorker : public Worker {
public:
void CreateThread(ActorThreadPool *pool);


+ 2
- 1
mindspore/core/mindrt/src/thread/core_affinity.cc View File

@@ -27,7 +27,6 @@
#include "thread/threadpool.h"

namespace mindspore {

enum Arch {
UnKnown_Arch = 0,
Cortex_A5,
@@ -249,6 +248,7 @@ int CoreAffinity::InitHardwareCoreInfo() {

std::vector<int> CoreAffinity::GetCoreId(size_t thread_num, BindMode bind_mode) {
std::vector<int> bind_id;
#ifdef BIND_CORE
if (core_num_ != sorted_id_.size()) {
THREAD_ERROR("init sorted core id failed");
return bind_id;
@@ -264,6 +264,7 @@ std::vector<int> CoreAffinity::GetCoreId(size_t thread_num, BindMode bind_mode)
} else {
return bind_id;
}
#endif
return bind_id;
}
void CoreAffinity::SetCoreId(const std::vector<int> &core_list) { bind_id_ = core_list; }


+ 0
- 1
mindspore/core/mindrt/src/thread/core_affinity.h View File

@@ -68,7 +68,6 @@ class CoreAffinity {
size_t core_num_{0};
size_t higher_num_{0};
};

} // namespace mindspore

#endif // MINDSPORE_CORE_MINDRT_RUNTIME_CORE_AFFINITY_H_

+ 0
- 3
mindspore/core/mindrt/src/thread/hqueue.h View File

@@ -22,10 +22,8 @@
namespace mindspore {
// implement a lock-free queue
// refer to https://www.cs.rochester.edu/u/scott/papers/1996_PODC_queues.pdf

template <typename T>
class HQueue;

struct Pointer {
int32_t index = -1;
uint32_t version = 0;
@@ -169,7 +167,6 @@ class HQueue {
std::atomic<Pointer> qtail;
std::vector<HQNode<T> *> nodes;
};

} // namespace mindspore

#endif // MINDSPORE_CORE_MINDRT_RUNTIME_HQUEUE_H_

+ 2
- 2
mindspore/core/mindrt/src/thread/threadpool.cc View File

@@ -291,6 +291,7 @@ Worker *ThreadPool::CurrentWorker() const {
}

int ThreadPool::InitAffinityInfo() {
#ifdef BIND_CORE
affinity_ = new (std::nothrow) CoreAffinity();
THREAD_ERROR_IF_NULL(affinity_);
int ret = affinity_->InitHardwareCoreInfo();
@@ -299,6 +300,7 @@ int ThreadPool::InitAffinityInfo() {
affinity_ = nullptr;
return THREAD_ERROR;
}
#endif
return THREAD_OK;
}

@@ -375,13 +377,11 @@ ThreadPool *ThreadPool::CreateThreadPool(size_t thread_num, const std::vector<in
delete pool;
return nullptr;
}
#ifdef BIND_CORE
ret = pool->InitAffinityInfo();
if (ret != THREAD_OK) {
delete pool;
return nullptr;
}
#endif // BIND_CORE
return pool;
}
} // namespace mindspore

+ 0
- 1
mindspore/core/mindrt/src/thread/threadpool.h View File

@@ -156,6 +156,5 @@ class ThreadPool {
int max_spin_count_{kDefaultSpinCount};
int min_spin_count_{kMinSpinCount};
};

} // namespace mindspore
#endif // MINDSPORE_CORE_MINDRT_RUNTIME_THREADPOOL_H_

+ 1
- 1
mindspore/lite/CMakeLists.txt View File

@@ -30,7 +30,7 @@ option(MSLITE_ENABLE_FP16 "Whether to compile Fp16 operator" off)
option(MSLITE_ENABLE_ACL "enable ACL" off)
option(MSLITE_ENABLE_MODEL_ENCRYPTION "enable model encryption, only converter support" on)
option(MSLITE_ENABLE_SPARSE_COMPUTE "enable sparse kernel" off)
option(MSLITE_ENABLE_RUNTIME_CONVERT "enable runtime convert" on)
option(MSLITE_ENABLE_RUNTIME_CONVERT "enable runtime convert" off)
option(MSLITE_ENABLE_RUNTIME_GLOG "enable runtime glog" off)
option(MSLITE_ENABLE_COVERAGE "enable code coverage" off)



+ 0
- 1
mindspore/lite/examples/train_lenet/prepare_and_run.sh View File

@@ -125,7 +125,6 @@ cp scripts/*.sh ${PACKAGE}/
# Copy the shared MindSpore ToD library
tar -xzf ${TARBALL}
mv mindspore-*/runtime/lib ${PACKAGE}/
mv mindspore-*/runtime/third_party/glog/* ${PACKAGE}/lib/
mv mindspore-*/runtime/third_party/libjpeg-turbo/lib/* ${PACKAGE}/lib/
cd mindspore-*
if [[ "${TARGET}" == "arm64" ]] && [[ -d "runtime/third_party/hiai_ddk/lib" ]]; then


+ 0
- 1
mindspore/lite/examples/train_lenet_java/build.sh View File

@@ -64,7 +64,6 @@ fi
tar xzvf ${BASEPATH}/build/${MINDSPORE_FILE} -C ${BASEPATH}/build/${MINDSPORE_FILE_NAME} --strip-components=1

cp -r ${BASEPATH}/build/${MINDSPORE_FILE_NAME}/runtime/lib/* ${BASEPATH}/lib
cp -r ${BASEPATH}/build/${MINDSPORE_FILE_NAME}/runtime/third_party/glog/* ${BASEPATH}/lib
cp ${BASEPATH}/build/${MINDSPORE_FILE_NAME}/runtime/third_party/libjpeg-turbo/lib/libjpeg.so.62 ${BASEPATH}/lib
cd ${BASEPATH}/ || exit



+ 0
- 1
mindspore/lite/examples/unified_api/prepare_and_run.sh View File

@@ -114,7 +114,6 @@ cp scripts/*.sh ${PACKAGE}/
# Copy the shared MindSpore ToD library
tar -xzf ${TARBALL}
mv mindspore-*/runtime/lib ${PACKAGE}/
mv mindspore-*/runtime/third_party/glog/* ${PACKAGE}/lib/
mv mindspore-*/runtime/third_party/libjpeg-turbo/lib/* ${PACKAGE}/lib/
cd mindspore-*
if [[ "${TARGET}" == "arm64" ]] && [[ -d "runtime/third_party/hiai_ddk/lib" ]]; then


+ 1
- 1
mindspore/lite/test/st/scripts/run_benchmark_asan.sh View File

@@ -24,7 +24,7 @@ function Run_Converter() {
function Run_x86_asan() {
echo 'cd '${x86_path}'/mindspore-lite-'${version}'-linux-x64' >> "${run_x86_asan_log_file}"
cd ${x86_path}/mindspore-lite-${version}-linux-x64 || return 1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./runtime/lib:./runtime/third_party/glog
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./runtime/lib
cp tools/benchmark/benchmark ./ || exit 1
# Prepare the config file list
local asan_cfg_file_list=("$models_asan_config")


+ 2
- 2
mindspore/lite/test/st/scripts/run_benchmark_x86.sh View File

@@ -67,7 +67,7 @@ function Run_x86() {
# $1:framework;
echo 'cd '${x86_path}'/mindspore-lite-'${version}'-linux-x64' >> "${run_x86_log_file}"
cd ${x86_path}/mindspore-lite-${version}-linux-x64 || exit 1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./runtime/lib:./runtime/third_party/glog
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./runtime/lib
cp tools/benchmark/benchmark ./ || exit 1
# Run converted models:
# $1:cfgFileList; $2:modelPath; $3:dataPath; $4:logFile; $5:resultFile; $6:platform; $7:processor; $8:phoneId;
@@ -144,7 +144,7 @@ function Run_x86_parallel_split() {
rm -rf parallel_split
mkdir parallel_split
cd parallel_split || exit 1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../runtime/lib::../runtime/third_party/glog
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:../runtime/lib
cp ../tools/benchmark/benchmark ./ || exit 1

# Run tflite parallel split converted models:


+ 0
- 1
mindspore/lite/test/st/scripts/tensorrt/run_tensorrt.sh View File

@@ -40,7 +40,6 @@ function Run_Tensorrt() {
# copy related files to benchmark_test
cp -a ./tools/benchmark/benchmark ${benchmark_test_path}/benchmark || exit 1
cp -a ./runtime/lib/lib*.so* ${benchmark_test_path}/ || exit 1
cp -a ./runtime/third_party/glog/lib*.so* ${benchmark_test_path}/ || exit 1

echo "start push files to nvidia device ${device_ip} : ${cuda_device_id}"
ssh tensorrt@${device_ip} "cd ${device_benchmark_test_path}; rm -rf ./*"


Loading…
Cancel
Save