Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Crayon鑫
Paddle
提交
084cdd1f
P
Paddle
项目概览
Crayon鑫
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
084cdd1f
编写于
3月 28, 2018
作者:
Y
Yu Yang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename code
上级
9f4a98f3
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
15 addition
and
15 deletion
+15
-15
paddle/fluid/framework/details/computation_op_handle.cc
paddle/fluid/framework/details/computation_op_handle.cc
+2
-2
paddle/fluid/framework/details/fetch_op_handle.cc
paddle/fluid/framework/details/fetch_op_handle.cc
+2
-2
paddle/fluid/framework/details/multi_devices_graph_builder.cc
...le/fluid/framework/details/multi_devices_graph_builder.cc
+1
-1
paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc
paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc
+2
-2
paddle/fluid/framework/details/op_handle_base.cc
paddle/fluid/framework/details/op_handle_base.cc
+4
-4
paddle/fluid/framework/details/op_handle_base.h
paddle/fluid/framework/details/op_handle_base.h
+1
-1
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
+2
-2
paddle/fluid/framework/details/threaded_ssa_graph_executor.cc
...le/fluid/framework/details/threaded_ssa_graph_executor.cc
+1
-1
未找到文件。
paddle/fluid/framework/details/computation_op_handle.cc
浏览文件 @
084cdd1f
...
...
@@ -24,10 +24,10 @@ ComputationOpHandle::ComputationOpHandle(const OpDesc &op_desc, Scope *scope,
place_
(
place
)
{}
void
ComputationOpHandle
::
RunImpl
()
{
auto
*
cur_ctx
=
dev_ctx_
[
place_
];
auto
*
cur_ctx
=
dev_ctx
es
_
[
place_
];
for
(
auto
*
in
:
inputs_
)
{
bool
need_wait
=
in
->
generated_op_
&&
in
->
generated_op_
->
dev_ctx_
[
place_
]
!=
cur_ctx
;
in
->
generated_op_
&&
in
->
generated_op_
->
dev_ctx
es
_
[
place_
]
!=
cur_ctx
;
if
(
need_wait
)
{
in
->
generated_op_
->
Wait
(
cur_ctx
);
}
...
...
paddle/fluid/framework/details/fetch_op_handle.cc
浏览文件 @
084cdd1f
...
...
@@ -60,8 +60,8 @@ void FetchOpHandle::RunImpl() {
auto
&
t
=
scope
->
FindVar
(
var_name
)
->
Get
<
framework
::
LoDTensor
>
();
if
(
platform
::
is_gpu_place
(
var
->
place_
))
{
#ifdef PADDLE_WITH_CUDA
TensorCopy
(
t
,
cpu
,
*
dev_ctx_
[
t
.
place
()],
&
tensors_
[
i
]);
dev_ctx_
[
t
.
place
()]
->
Wait
();
TensorCopy
(
t
,
cpu
,
*
dev_ctx
es
_
[
t
.
place
()],
&
tensors_
[
i
]);
dev_ctx
es
_
[
t
.
place
()]
->
Wait
();
#endif
}
else
{
tensors_
[
i
].
ShareDataWith
(
t
);
...
...
paddle/fluid/framework/details/multi_devices_graph_builder.cc
浏览文件 @
084cdd1f
...
...
@@ -74,7 +74,7 @@ std::unique_ptr<SSAGraph> MultiDevSSAGraphBuilder::Build(
result
.
ops_
.
emplace_back
(
new
ComputationOpHandle
(
*
op
,
s
,
p
));
auto
*
op_handle
=
result
.
ops_
.
back
().
get
();
op_handle
->
dev_ctx_
[
p
]
=
const_cast
<
platform
::
DeviceContext
*>
(
op_handle
->
dev_ctx
es
_
[
p
]
=
const_cast
<
platform
::
DeviceContext
*>
(
platform
::
DeviceContextPool
::
Instance
().
Get
(
p
));
auto
var_names
=
op
->
InputArgumentNames
();
...
...
paddle/fluid/framework/details/nccl_all_reduce_op_handle.cc
浏览文件 @
084cdd1f
...
...
@@ -23,7 +23,7 @@ NCCLAllReduceOpHandle::NCCLAllReduceOpHandle(
const
platform
::
NCCLContextMap
&
ctxs
)
:
local_scopes_
(
local_scopes
),
places_
(
places
),
nccl_ctxs_
(
ctxs
)
{
for
(
auto
&
p
:
places_
)
{
this
->
dev_ctx_
[
p
]
=
nccl_ctxs_
.
DevCtx
(
p
);
this
->
dev_ctx
es
_
[
p
]
=
nccl_ctxs_
.
DevCtx
(
p
);
}
}
...
...
@@ -34,7 +34,7 @@ void NCCLAllReduceOpHandle::RunImpl() {
// Wait input done
for
(
auto
*
in
:
inputs_
)
{
auto
&
p
=
static_cast
<
VarHandle
*>
(
in
)
->
place_
;
in
->
generated_op_
->
Wait
(
dev_ctx_
[
p
]);
in
->
generated_op_
->
Wait
(
dev_ctx
es
_
[
p
]);
}
auto
&
var_name
=
static_cast
<
VarHandle
*>
(
this
->
inputs_
[
0
])
->
name_
;
...
...
paddle/fluid/framework/details/op_handle_base.cc
浏览文件 @
084cdd1f
...
...
@@ -42,7 +42,7 @@ OpHandleBase::~OpHandleBase() {
void
OpHandleBase
::
Run
(
bool
use_event
)
{
#ifdef PADDLE_WITH_CUDA
if
(
events_
.
empty
()
&&
use_event
)
{
for
(
auto
&
p
:
dev_ctx_
)
{
for
(
auto
&
p
:
dev_ctx
es
_
)
{
int
dev_id
=
boost
::
get
<
platform
::
CUDAPlace
>
(
p
.
first
).
device
;
PADDLE_ENFORCE
(
cudaSetDevice
(
dev_id
));
PADDLE_ENFORCE
(
...
...
@@ -57,7 +57,7 @@ void OpHandleBase::Run(bool use_event) {
#ifdef PADDLE_WITH_CUDA
if
(
use_event
)
{
for
(
auto
&
p
:
dev_ctx_
)
{
for
(
auto
&
p
:
dev_ctx
es
_
)
{
int
dev_id
=
boost
::
get
<
platform
::
CUDAPlace
>
(
p
.
first
).
device
;
auto
stream
=
static_cast
<
platform
::
CUDADeviceContext
*>
(
p
.
second
)
->
stream
();
...
...
@@ -70,7 +70,7 @@ void OpHandleBase::Run(bool use_event) {
void
OpHandleBase
::
Wait
(
platform
::
DeviceContext
*
waited_dev
)
{
#ifdef PADDLE_WITH_CUDA
if
(
platform
::
is_cpu_place
(
waited_dev
->
GetPlace
())
||
events_
.
empty
())
{
for
(
auto
&
dev_ctx
:
dev_ctx_
)
{
for
(
auto
&
dev_ctx
:
dev_ctx
es
_
)
{
dev_ctx
.
second
->
Wait
();
}
}
else
{
...
...
@@ -81,7 +81,7 @@ void OpHandleBase::Wait(platform::DeviceContext *waited_dev) {
}
}
#else
for
(
auto
&
dev_ctx
:
dev_ctx_
)
{
for
(
auto
&
dev_ctx
:
dev_ctx
es
_
)
{
dev_ctx
.
second
->
Wait
();
}
#endif
...
...
paddle/fluid/framework/details/op_handle_base.h
浏览文件 @
084cdd1f
...
...
@@ -31,7 +31,7 @@ class OpHandleBase {
std
::
vector
<
VarHandleBase
*>
outputs_
;
std
::
unordered_map
<
platform
::
Place
,
platform
::
DeviceContext
*
,
platform
::
PlaceHash
>
dev_ctx_
;
dev_ctx
es
_
;
#ifdef PADDLE_WITH_CUDA
std
::
unordered_map
<
int
,
cudaEvent_t
>
events_
;
...
...
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
浏览文件 @
084cdd1f
...
...
@@ -21,7 +21,7 @@ ScaleLossGradOpHandle::ScaleLossGradOpHandle(size_t num_dev, Scope *scope,
platform
::
Place
place
,
platform
::
DeviceContext
*
dev_ctx
)
:
coeff_
(
static_cast
<
float
>
(
1.0
/
num_dev
)),
scope_
(
scope
),
place_
(
place
)
{
dev_ctx_
[
place_
]
=
dev_ctx
;
dev_ctx
es
_
[
place_
]
=
dev_ctx
;
}
ScaleLossGradOpHandle
::~
ScaleLossGradOpHandle
()
{}
...
...
@@ -38,7 +38,7 @@ void ScaleLossGradOpHandle::RunImpl() {
}
else
{
#ifdef PADDLE_WITH_CUDA
auto
stream
=
static_cast
<
platform
::
CUDADeviceContext
*>
(
this
->
dev_ctx_
[
place_
])
static_cast
<
platform
::
CUDADeviceContext
*>
(
this
->
dev_ctx
es
_
[
place_
])
->
stream
();
memory
::
Copy
(
boost
::
get
<
platform
::
CUDAPlace
>
(
place_
),
tmp
,
platform
::
CPUPlace
(),
&
coeff_
,
sizeof
(
float
),
stream
);
...
...
paddle/fluid/framework/details/threaded_ssa_graph_executor.cc
浏览文件 @
084cdd1f
...
...
@@ -96,7 +96,7 @@ FeedFetchList ThreadedSSAGraphExecutor::Run(
// FIXME: Use new device context
for
(
auto
&
p
:
places_
)
{
op
->
dev_ctx_
[
p
]
=
fetch_ctxs_
.
Get
(
p
);
op
->
dev_ctx
es
_
[
p
]
=
fetch_ctxs_
.
Get
(
p
);
}
for
(
auto
*
var
:
vars
)
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录