Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
狗剩和翠花
Paddle
提交
d008260f
P
Paddle
项目概览
狗剩和翠花
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d008260f
编写于
6月 06, 2019
作者:
石
石晓伟
提交者:
GitHub
6月 06, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update the initialization of anakin subgraph (#17880)
test=develop
上级
ae576f3c
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
20 addition
and
10 deletion
+20
-10
paddle/fluid/inference/anakin/engine.cc
paddle/fluid/inference/anakin/engine.cc
+16
-8
paddle/fluid/inference/anakin/engine.h
paddle/fluid/inference/anakin/engine.h
+3
-2
paddle/fluid/inference/api/analysis_config.cc
paddle/fluid/inference/api/analysis_config.cc
+1
-0
未找到文件。
paddle/fluid/inference/anakin/engine.cc
浏览文件 @
d008260f
...
...
@@ -32,18 +32,26 @@ namespace paddle {
namespace
inference
{
namespace
anakin
{
template
<
typename
TargetT
,
Precision
PrecisionType
,
OpRunType
RunType
>
extern
std
::
once_flag
AnakinEngine
<
TargetT
,
PrecisionType
,
RunType
>::
init_anakin_
;
template
<
typename
TargetT
,
Precision
PrecisionType
,
OpRunType
RunType
>
AnakinEngine
<
TargetT
,
PrecisionType
,
RunType
>::
AnakinEngine
(
bool
need_summary
,
int
device
,
int
max_batch_size
,
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
max_input_shape
,
std
::
vector
<
std
::
string
>
program_inputs
,
bool
auto_config_layout
)
:
graph_
(
new
AnakinGraphT
<
TargetT
,
PrecisionType
>
()),
net_
(
new
AnakinNetT
<
TargetT
,
PrecisionType
,
RunType
>
(
need_summary
))
{
device_
=
device
;
max_batch_size_
=
max_batch_size
;
max_input_shape_
=
max_input_shape
;
program_inputs_
=
program_inputs
;
auto_config_layout_
=
auto_config_layout
;
:
device_
(
device
),
max_batch_size_
(
max_batch_size
),
max_input_shape_
(
max_input_shape
),
program_inputs_
(
program_inputs
),
auto_config_layout_
(
auto_config_layout
)
{
std
::
call_once
(
init_anakin_
,
[
this
]()
{
::
anakin
::
TargetWrapper
<
TargetT
>::
set_device
(
device_
);
::
anakin
::
Env
<
TargetT
>::
env_init
();
});
graph_
.
reset
(
new
AnakinGraphT
<
TargetT
,
PrecisionType
>
());
net_
.
reset
(
new
AnakinNetT
<
TargetT
,
PrecisionType
,
RunType
>
(
need_summary
));
}
template
<
typename
TargetT
,
Precision
PrecisionType
,
OpRunType
RunType
>
...
...
@@ -102,7 +110,7 @@ void AnakinEngine<TargetT, PrecisionType, RunType>::BindInput(
anakin_input
=
net_
->
get_in
(
input
.
first
);
}
anakin_input
->
reshape
(
fluid_input_shape
);
::
anakin
::
saber
::
Tensor
<
TargetT
>
tmp_anakin_tensor
(
data
,
TargetT
(),
0
,
::
anakin
::
saber
::
Tensor
<
TargetT
>
tmp_anakin_tensor
(
data
,
TargetT
(),
device_
,
fluid_input_shape
);
anakin_input
->
copy_from
(
tmp_anakin_tensor
);
}
...
...
paddle/fluid/inference/anakin/engine.h
浏览文件 @
d008260f
...
...
@@ -114,12 +114,13 @@ class AnakinEngine {
private:
bool
initialized_
{
false
};
int
device_
;
int
max_batch_size_
;
std
::
map
<
std
::
string
,
std
::
vector
<
int
>>
max_input_shape_
;
int
device
_
;
std
::
vector
<
std
::
string
>
program_inputs
_
;
std
::
unique_ptr
<
GraphT
>
graph_
;
std
::
unique_ptr
<
NetT
>
net_
;
st
d
::
vector
<
std
::
string
>
program_inputs
_
;
st
atic
std
::
once_flag
init_anakin
_
;
std
::
unordered_map
<
std
::
string
,
float
>
tensor_scales_
;
// Always be false in gpu mode but true in most cpu cases.
bool
auto_config_layout_
;
...
...
paddle/fluid/inference/api/analysis_config.cc
浏览文件 @
d008260f
...
...
@@ -371,6 +371,7 @@ float AnalysisConfig::fraction_of_gpu_memory_for_pool() const {
// Get the GPU memory details and calculate the fraction of memory for the
// GPU memory pool.
size_t
gpu_used
,
gpu_available
;
platform
::
SetDeviceId
(
device_id_
);
platform
::
GpuMemoryUsage
(
&
gpu_used
,
&
gpu_available
);
double
total_gpu_memory
=
(
gpu_used
+
gpu_available
)
/
1024.
/
1024.
;
float
fraction_of_gpu_memory
=
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录