Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
5a6ab380
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
5a6ab380
编写于
5月 17, 2019
作者:
C
chengduo
提交者:
Tao Luo
5月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add record event And remove CSP (#17447)
* add record_event test=develop * remove csp test=develop
上级
05df39ac
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
7 addition
and
114 deletion
+7
-114
paddle/fluid/framework/details/eager_deletion_op_handle.cc
paddle/fluid/framework/details/eager_deletion_op_handle.cc
+2
-0
paddle/fluid/framework/details/rpc_op_handle.cc
paddle/fluid/framework/details/rpc_op_handle.cc
+3
-0
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
+2
-1
paddle/fluid/operators/CMakeLists.txt
paddle/fluid/operators/CMakeLists.txt
+0
-1
paddle/fluid/operators/csp/CMakeLists.txt
paddle/fluid/operators/csp/CMakeLists.txt
+0
-2
paddle/fluid/operators/csp/go_op.cc
paddle/fluid/operators/csp/go_op.cc
+0
-110
未找到文件。
paddle/fluid/framework/details/eager_deletion_op_handle.cc
浏览文件 @
5a6ab380
...
...
@@ -20,6 +20,7 @@
#include "paddle/fluid/framework/lod_tensor_array.h"
#include "paddle/fluid/framework/scope.h"
#include "paddle/fluid/framework/selected_rows.h"
#include "paddle/fluid/platform/profiler.h"
#ifdef PADDLE_WITH_CUDA
#include "paddle/fluid/platform/cuda_device_guard.h"
#endif
...
...
@@ -65,6 +66,7 @@ EagerDeletionOpHandle::~EagerDeletionOpHandle() {
std
::
string
EagerDeletionOpHandle
::
Name
()
const
{
return
"eager_deletion"
;
}
void
EagerDeletionOpHandle
::
RunImpl
()
{
platform
::
RecordEvent
record_event
(
Name
());
Scope
*
exec_scope
=
nullptr
;
std
::
deque
<
std
::
shared_ptr
<
memory
::
Allocation
>>
garbages
;
for
(
auto
&
name
:
var_names_
)
{
...
...
paddle/fluid/framework/details/rpc_op_handle.cc
浏览文件 @
5a6ab380
...
...
@@ -14,6 +14,7 @@
#include "paddle/fluid/framework/details/rpc_op_handle.h"
#include "paddle/fluid/framework/ir/graph.h"
#include "paddle/fluid/platform/profiler.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -29,6 +30,8 @@ RPCOpHandle::RPCOpHandle(ir::Node *node, const framework::OpDesc &op_desc,
place_
(
place
)
{}
void
RPCOpHandle
::
RunImpl
()
{
platform
::
RecordEvent
record_event
(
Name
());
for
(
auto
*
in
:
inputs_
)
{
auto
&
p
=
static_cast
<
VarHandle
*>
(
in
)
->
place
();
if
(
ir
::
IsControlDepVar
(
*
in
->
Node
()))
{
...
...
paddle/fluid/framework/details/scale_loss_grad_op_handle.cc
浏览文件 @
5a6ab380
...
...
@@ -13,8 +13,8 @@
// limitations under the License.
#include "paddle/fluid/framework/details/scale_loss_grad_op_handle.h"
#include <string>
#include "paddle/fluid/platform/profiler.h"
namespace
paddle
{
namespace
framework
{
...
...
@@ -67,6 +67,7 @@ struct ScaleLossGradFunctor {
};
void
ScaleLossGradOpHandle
::
RunImpl
()
{
platform
::
RecordEvent
record_event
(
Name
());
// Doesn't wait any event
std
::
string
var_name
=
static_cast
<
VarHandle
*>
(
this
->
outputs_
[
0
])
->
name
();
auto
&
local_scope
=
*
scope_
->
FindVar
(
kLocalExecScopeName
)
->
Get
<
Scope
*>
();
...
...
paddle/fluid/operators/CMakeLists.txt
浏览文件 @
5a6ab380
...
...
@@ -8,7 +8,6 @@ file(WRITE ${pybind_file} "// Generated by the paddle/fluid/operator/CMakeLists.
add_subdirectory
(
math
)
add_subdirectory
(
controlflow
)
add_subdirectory
(
csp
)
add_subdirectory
(
detection
)
add_subdirectory
(
elementwise
)
add_subdirectory
(
fused
)
...
...
paddle/fluid/operators/csp/CMakeLists.txt
已删除
100644 → 0
浏览文件 @
05df39ac
include
(
operators
)
register_operators
()
paddle/fluid/operators/csp/go_op.cc
已删除
100644 → 0
浏览文件 @
05df39ac
/* Copyright (c) 2016 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. */
#include <thread> // NOLINT
#include <vector>
#include "paddle/fluid/framework/executor.h"
#include "paddle/fluid/framework/lod_tensor.h"
#include "paddle/fluid/framework/op_registry.h"
namespace
paddle
{
namespace
operators
{
using
StepScopeVar
=
std
::
vector
<
framework
::
Scope
*>
;
static
constexpr
char
kBlock
[]
=
"sub_block"
;
static
constexpr
char
kX
[]
=
"X"
;
class
GoOp
:
public
framework
::
OperatorBase
{
public:
GoOp
(
const
std
::
string
&
type
,
const
framework
::
VariableNameMap
&
inputs
,
const
framework
::
VariableNameMap
&
outputs
,
const
framework
::
AttributeMap
&
attrs
)
:
framework
::
OperatorBase
(
type
,
inputs
,
outputs
,
attrs
)
{}
private:
void
ExecuteOnThread
(
framework
::
Executor
*
executor
,
framework
::
BlockDesc
*
block
,
framework
::
Scope
*
scope
)
const
{
framework
::
ProgramDesc
*
program
=
block
->
Program
();
executor
->
Run
(
*
program
,
scope
,
block
->
ID
(),
false
/*create_local_scope*/
);
}
void
RunImpl
(
const
framework
::
Scope
&
scope
,
const
platform
::
Place
&
dev_place
)
const
override
{
/*
* Determine the global scope. Create a new child scope.
* Within the child scope, add all the local variables relevant
* to that scope.
*
* Now go through all the inputs to the op to ensure that
* all of them are in the newly created scope. This is important
* to ensure that they don't get destroyed when the parent scope
* is deleted.
* */
// TODO(varunarora): Consider moving this root scope lookup to scope.h.
const
framework
::
Scope
*
root_scope
=
&
scope
;
const
framework
::
Scope
*
parent_scope
=
root_scope
->
parent
();
while
(
parent_scope
!=
nullptr
)
{
root_scope
=
parent_scope
;
parent_scope
=
parent_scope
->
parent
();
}
framework
::
BlockDesc
*
block
=
Attr
<
framework
::
BlockDesc
*>
(
kBlock
);
framework
::
Executor
executor
(
dev_place
);
framework
::
Scope
&
new_scope
=
root_scope
->
NewScope
();
for
(
auto
&
var
:
block
->
AllVars
())
{
new_scope
.
Var
(
var
->
Name
());
}
auto
&
inputs
=
Inputs
(
kX
);
for
(
size_t
i
=
0
;
i
<
inputs
.
size
();
i
++
)
{
PADDLE_ENFORCE_NOT_NULL
(
new_scope
.
FindVar
(
inputs
.
at
(
i
)),
"All variables used in the go block "
"should be created in the global scope"
);
}
// Now execute the go op with the newly created scope.
std
::
thread
go_thread
([
dev_place
,
block
,
&
new_scope
,
this
]()
{
framework
::
Executor
executor
(
dev_place
);
ExecuteOnThread
(
&
executor
,
block
,
&
new_scope
);
});
go_thread
.
detach
();
}
};
class
GoOpMaker
:
public
framework
::
OpProtoAndCheckerMaker
{
public:
void
Make
()
override
{
AddInput
(
kX
,
"A set of variables, which are required by operators inside the "
"block of Go Op."
)
.
AsDuplicable
();
AddAttr
<
framework
::
BlockDesc
*>
(
kBlock
,
"The block inside GoOp"
);
AddComment
(
R"DOC(
)DOC"
);
}
};
// TODO(thuan): Look into Gradient Operator for GO_OP
}
// namespace operators
}
// namespace paddle
REGISTER_OPERATOR
(
go
,
paddle
::
operators
::
GoOp
,
paddle
::
framework
::
EmptyGradOpMaker
,
paddle
::
operators
::
GoOpMaker
);
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录