提交 10ce7d3c 编写于 作者: B baolei.an

[LITE][BM] realize bm device info,test=develop

上级 e7d31e1f
...@@ -1240,6 +1240,19 @@ void Device<TARGET(kMLU)>::CreateQueue() { ...@@ -1240,6 +1240,19 @@ void Device<TARGET(kMLU)>::CreateQueue() {
} }
#endif // LITE_WITH_MLU #endif // LITE_WITH_MLU
#ifdef LITE_WITH_BM
void Device<TARGET(kBM)>::SetId(int device_id) {
LOG(INFO) << "Set bm device " << device_id;
TargetWrapper<TARGET(kBM)>::SetDevice(device_id);
idx_ = device_id;
}
void Device<TARGET(kBM)>::Init() { SetId(idx_); }
int Device<TARGET(kBM)>::core_num() {
return TargetWrapper<TARGET(kBM)>::num_devices();
}
#endif // LITE_WITH_BM
#ifdef LITE_WITH_CUDA #ifdef LITE_WITH_CUDA
void Device<TARGET(kCUDA)>::Init() { void Device<TARGET(kCUDA)>::Init() {
......
...@@ -221,6 +221,49 @@ class Device<TARGET(kMLU)> { ...@@ -221,6 +221,49 @@ class Device<TARGET(kMLU)> {
template class Env<TARGET(kMLU)>; template class Env<TARGET(kMLU)>;
#endif // LITE_WITH_MLU #endif // LITE_WITH_MLU
#ifdef LITE_WITH_BM
template <>
class Device<TARGET(kBM)> {
public:
Device(int dev_id, int max_stream = 1)
: idx_(dev_id), max_stream_(max_stream) {}
void Init();
int id() { return idx_; }
int max_stream() { return 1; }
std::string name() { return "BM"; }
float max_memory() { return 16; }
int core_num();
void SetId(int idx);
int sm_version() { return 0; }
bool has_fp16() { return false; }
bool has_int8() { return false; }
bool has_hmma() { return false; }
bool has_imma() { return false; }
int runtime_version() { return 0; }
private:
void CreateQueue() {}
void GetInfo() {}
private:
int idx_{0};
int max_stream_{1};
std::string device_name_;
float max_memory_;
int sm_version_;
bool has_fp16_;
bool has_int8_;
bool has_hmma_;
bool has_imma_;
int runtime_version_;
};
template class Env<TARGET(kBM)>;
#endif
#ifdef LITE_WITH_CUDA #ifdef LITE_WITH_CUDA
template <> template <>
class Device<TARGET(kCUDA)> { class Device<TARGET(kCUDA)> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册