Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle-Lite
提交
46fff4dd
P
Paddle-Lite
项目概览
PaddlePaddle
/
Paddle-Lite
通知
331
Star
4
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
271
列表
看板
标记
里程碑
合并请求
78
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle-Lite
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
271
Issue
271
列表
看板
标记
里程碑
合并请求
78
合并请求
78
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
46fff4dd
编写于
5月 06, 2020
作者:
B
baolei.an
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[LITE][BM] modify device info location,test=develop
上级
3a60b583
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
127 addition
and
57 deletion
+127
-57
lite/backends/bm/CMakeLists.txt
lite/backends/bm/CMakeLists.txt
+1
-0
lite/backends/bm/device_info.cc
lite/backends/bm/device_info.cc
+55
-0
lite/backends/bm/device_info.h
lite/backends/bm/device_info.h
+70
-0
lite/core/device_info.cc
lite/core/device_info.cc
+0
-13
lite/core/device_info.h
lite/core/device_info.h
+0
-43
lite/kernels/bm/CMakeLists.txt
lite/kernels/bm/CMakeLists.txt
+1
-1
未找到文件。
lite/backends/bm/CMakeLists.txt
浏览文件 @
46fff4dd
...
...
@@ -3,3 +3,4 @@ if (NOT LITE_WITH_BM)
endif
()
lite_cc_library
(
target_wrapper_bm SRCS target_wrapper.cc DEPS
${
bm_runtime_libs
}
)
lite_cc_library
(
device_info_bm SRCS device_info.cc
)
lite/backends/bm/device_info.cc
0 → 100644
浏览文件 @
46fff4dd
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Parts of the following code in this file refs to
// https://github.com/Tencent/ncnn/blob/master/src/cpu.cpp
// Tencent is pleased to support the open source community by making ncnn
// available.
//
// Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License"); you may not use this
// file except in compliance with the License. You may obtain a copy of the
// License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
#include "lite/backends/bm/device_info.h"
#include <algorithm>
#include <limits>
namespace
paddle
{
namespace
lite
{
#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
}
// namespace lite
}
// namespace paddle
lite/backends/bm/device_info.h
0 → 100644
浏览文件 @
46fff4dd
// Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <cstdarg>
#include <string>
#include <vector>
#include "lite/core/device_info.h"
#include "lite/core/tensor.h"
#include "lite/utils/cp_logging.h"
namespace
paddle
{
namespace
lite
{
#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
}
// namespace lite
}
// namespace paddle
lite/core/device_info.cc
浏览文件 @
46fff4dd
...
...
@@ -1240,19 +1240,6 @@ void Device<TARGET(kMLU)>::CreateQueue() {
}
#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
void
Device
<
TARGET
(
kCUDA
)
>::
Init
()
{
...
...
lite/core/device_info.h
浏览文件 @
46fff4dd
...
...
@@ -221,49 +221,6 @@ class Device<TARGET(kMLU)> {
template
class
Env
<
TARGET
(
kMLU
)>;
#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
template
<
>
class
Device
<
TARGET
(
kCUDA
)
>
{
...
...
lite/kernels/bm/CMakeLists.txt
浏览文件 @
46fff4dd
...
...
@@ -3,4 +3,4 @@ if(NOT LITE_WITH_BM)
endif
()
add_subdirectory
(
bridges
)
add_kernel
(
subgraph_compute_bm BM basic SRCS subgraph_compute.cc DEPS
${
lite_kernel_deps
}
${
bm_subgraph_bridges
}
)
add_kernel
(
subgraph_compute_bm BM basic SRCS subgraph_compute.cc DEPS
${
lite_kernel_deps
}
${
bm_subgraph_bridges
}
device_info_bm
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录