Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
4c93c4c3
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
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看板
未验证
提交
4c93c4c3
编写于
11月 01, 2021
作者:
L
Leo Chen
提交者:
GitHub
11月 01, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[new-exec] refine vlog of interpretercore (#36865)
* refine vlog of interpretercore * fix ut
上级
fe81306c
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
38 addition
and
20 deletion
+38
-20
paddle/fluid/framework/new_executor/interpretercore.cc
paddle/fluid/framework/new_executor/interpretercore.cc
+24
-7
paddle/fluid/framework/new_executor/interpretercore_util.cc
paddle/fluid/framework/new_executor/interpretercore_util.cc
+2
-2
paddle/fluid/framework/operator.cc
paddle/fluid/framework/operator.cc
+7
-7
paddle/fluid/framework/operator.h
paddle/fluid/framework/operator.h
+1
-1
paddle/fluid/memory/allocation/allocator_facade.cc
paddle/fluid/memory/allocation/allocator_facade.cc
+1
-1
paddle/fluid/platform/device_context.cc
paddle/fluid/platform/device_context.cc
+1
-1
paddle/fluid/pybind/global_value_getter_setter.cc
paddle/fluid/pybind/global_value_getter_setter.cc
+1
-0
python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py
...d/tests/unittests/interpreter/test_standalone_executor.py
+1
-1
未找到文件。
paddle/fluid/framework/new_executor/interpretercore.cc
浏览文件 @
4c93c4c3
...
...
@@ -13,18 +13,18 @@
// limitations under the License.
#include "paddle/fluid/framework/new_executor/interpretercore.h"
#include "paddle/fluid/framework/new_executor/interpretercore_util.h"
#include <unordered_set>
#include "paddle/fluid/framework/details/nan_inf_utils.h"
#include "paddle/fluid/framework/details/share_tensor_buffer_functor.h"
#include "paddle/fluid/framework/new_executor/interpretercore_util.h"
#include "paddle/fluid/framework/operator.h"
#include "paddle/fluid/platform/profiler.h"
PADDLE_DEFINE_EXPORTED_bool
(
new_executor_use_inplace
,
true
,
"Use inplace in new executor"
);
DECLARE_bool
(
check_nan_inf
);
DECLARE_bool
(
benchmark
);
constexpr
const
char
*
kExceptionCaught
=
"ExceptionCaught"
;
...
...
@@ -311,7 +311,9 @@ void InterpreterCore::BuildSkipShareLoDInfo() {
}
void
InterpreterCore
::
RunInstruction
(
const
Instruction
&
instr_node
)
{
VLOG
(
3
)
<<
"RunInstruction: "
<<
instr_node
.
OpBase
()
->
Type
();
auto
*
op
=
instr_node
.
OpBase
();
auto
place
=
instr_node
.
DeviceContext
().
GetPlace
();
VLOG
(
4
)
<<
place
<<
" "
<<
op
->
DebugStringEx
(
global_scope_
);
{
platform
::
RecordEvent
infershape_event
(
"InferShape"
);
...
...
@@ -334,12 +336,27 @@ void InterpreterCore::RunInstruction(const Instruction& instr_node) {
instr_node
.
KernelFunc
()(
*
instr_node
.
InnerExecutionContext
().
get
());
}
VLOG
(
3
)
<<
place
<<
" "
<<
op
->
DebugStringEx
(
global_scope_
);
/*For profiling/benchmark only*/
if
(
FLAGS_benchmark
)
{
instr_node
.
DeviceContext
().
Wait
();
#if defined(PADDLE_WITH_CUDA)
PADDLE_ENFORCE_CUDA_SUCCESS
(
cudaGetLastError
());
VLOG
(
4
)
<<
"Operator("
<<
op
->
Type
()
<<
"): context wait and get last error"
;
#endif
#if defined(PADDLE_WITH_HIP)
PADDLE_ENFORCE_CUDA_SUCCESS
(
hipGetLastError
());
VLOG
(
4
)
<<
"Operator("
<<
op
->
Type
()
<<
"): context wait and get last error"
;
#endif
}
// for debug nan/inf
if
(
FLAGS_check_nan_inf
)
{
VLOG
(
4
)
<<
"Check nan/inf"
;
framework
::
details
::
CheckOpHasNanOrInf
(
*
instr_node
.
OpBase
(),
*
global_scope_
,
instr_node
.
DeviceContext
().
GetPlace
());
framework
::
details
::
CheckOpHasNanOrInf
(
*
op
,
*
global_scope_
,
place
);
}
}
...
...
paddle/fluid/framework/new_executor/interpretercore_util.cc
浏览文件 @
4c93c4c3
...
...
@@ -229,7 +229,7 @@ void build_op_func_list(const platform::Place& place,
size_t
ops_index
=
0
;
for
(
auto
&
op
:
global_block
.
AllOps
())
{
VLOG
(
3
)
<<
"Build OpFuncNode from : "
<<
op
->
Type
();
VLOG
(
6
)
<<
"Build OpFuncNode from : "
<<
op
->
Type
();
auto
op_base
=
ops
[
ops_index
++
];
auto
inputs_names
=
op
->
Inputs
();
...
...
@@ -435,7 +435,7 @@ void build_op_func_list(const platform::Place& place,
continue
;
}
VLOG
(
2
)
<<
"Erase variable "
<<
var_name
;
VLOG
(
6
)
<<
"Erase variable "
<<
var_name
;
if
(
var
->
IsType
<
LoDTensor
>
())
{
garbages
->
emplace_back
(
var
->
GetMutable
<
LoDTensor
>
()
->
MoveMemoryHolder
());
...
...
paddle/fluid/framework/operator.cc
浏览文件 @
4c93c4c3
...
...
@@ -62,7 +62,7 @@ std::vector<std::tuple<platform::Place, LibraryType>> kKernelPriority = {
std
::
make_tuple
(
platform
::
CPUPlace
(),
LibraryType
::
kPlain
),
};
static
DDim
GetDimsDebug
(
const
Scope
&
scope
,
const
std
::
string
&
name
,
static
DDim
GetDimsDebug
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
,
bool
get_actual_dim
=
false
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
{
...
...
@@ -85,13 +85,13 @@ static DDim GetDimsDebug(const Scope& scope, const std::string& name,
}
}
static
bool
VarInited
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
static
bool
VarInited
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
return
false
;
return
var
->
IsInitialized
();
}
static
std
::
string
GetDtype
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
static
std
::
string
GetDtype
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
{
return
""
;
...
...
@@ -117,7 +117,7 @@ static std::string GetDtype(const Scope& scope, const std::string& name) {
}
}
static
std
::
string
GetPlace
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
static
std
::
string
GetPlace
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
{
return
""
;
...
...
@@ -146,7 +146,7 @@ static std::string GetPlace(const Scope& scope, const std::string& name) {
}
}
static
int
GetRowSize
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
static
int
GetRowSize
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
if
(
var
==
nullptr
)
{
return
-
1
;
...
...
@@ -159,7 +159,7 @@ static int GetRowSize(const Scope& scope, const std::string& name) {
return
-
1
;
}
static
LoD
GetLoDDebug
(
const
Scope
&
scope
,
const
std
::
string
&
name
)
{
static
LoD
GetLoDDebug
(
const
Scope
Base
&
scope
,
const
std
::
string
&
name
)
{
Variable
*
var
=
scope
.
FindVar
(
name
);
auto
default_lod
=
LoD
({{}});
...
...
@@ -308,7 +308,7 @@ const std::vector<std::string>& OperatorBase::Outputs(
return
it
->
second
;
}
std
::
string
OperatorBase
::
DebugStringEx
(
const
Scope
*
scope
)
const
{
std
::
string
OperatorBase
::
DebugStringEx
(
const
Scope
Base
*
scope
)
const
{
std
::
stringstream
ss
;
ss
<<
"Op("
<<
type_
<<
"), inputs:{"
;
...
...
paddle/fluid/framework/operator.h
浏览文件 @
4c93c4c3
...
...
@@ -154,7 +154,7 @@ class OperatorBase {
virtual
void
Stop
()
{}
/// if scope is not null, also show dimensions of arguments
virtual
std
::
string
DebugStringEx
(
const
Scope
*
scope
)
const
;
virtual
std
::
string
DebugStringEx
(
const
Scope
Base
*
scope
)
const
;
std
::
string
DebugString
()
const
{
return
DebugStringEx
(
nullptr
);
}
virtual
bool
SupportGPU
()
const
{
return
false
;
}
...
...
paddle/fluid/memory/allocation/allocator_facade.cc
浏览文件 @
4c93c4c3
...
...
@@ -202,7 +202,7 @@ class AllocatorFacadePrivate {
inline
const
std
::
shared_ptr
<
Allocator
>&
GetAllocator
(
const
platform
::
Place
&
place
,
size_t
size
)
{
VLOG
(
4
)
<<
"GetAllocator"
VLOG
(
6
)
<<
"GetAllocator"
<<
" "
<<
place
<<
" "
<<
size
;
const
auto
&
allocators
=
(
size
>
0
?
(
UNLIKELY
(
FLAGS_use_system_allocator
)
?
system_allocators_
...
...
paddle/fluid/platform/device_context.cc
浏览文件 @
4c93c4c3
...
...
@@ -91,7 +91,7 @@ DeviceType Place2DeviceType(const platform::Place& place) {
DeviceContextPool
*
DeviceContextPool
::
pool
=
nullptr
;
platform
::
DeviceContext
*
DeviceContextPool
::
Get
(
const
platform
::
Place
&
place
)
{
VLOG
(
4
)
<<
"DeviceContextPool Get: "
<<
place
;
VLOG
(
6
)
<<
"DeviceContextPool Get: "
<<
place
;
auto
it
=
device_contexts_
.
find
(
place
);
if
(
it
==
device_contexts_
.
end
())
{
PADDLE_THROW
(
platform
::
errors
::
Unimplemented
(
...
...
paddle/fluid/pybind/global_value_getter_setter.cc
浏览文件 @
4c93c4c3
...
...
@@ -145,6 +145,7 @@ class PYBIND11_HIDDEN GlobalVarGetterSetterRegistry {
}
void
Set
(
const
std
::
string
&
name
,
const
py
::
object
&
value
)
const
{
VLOG
(
4
)
<<
"set "
<<
name
<<
" to "
<<
value
;
SetterMethod
(
name
)(
value
);
}
...
...
python/paddle/fluid/tests/unittests/interpreter/test_standalone_executor.py
浏览文件 @
4c93c4c3
...
...
@@ -295,7 +295,7 @@ class TestException(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
self
.
run_new_executor
,
feed
)
def
test_nan
(
self
):
flags
=
{
'FLAGS_check_nan_inf'
:
True
}
flags
=
{
'FLAGS_check_nan_inf'
:
True
,
'FLAGS_benchmark'
:
True
}
paddle
.
fluid
.
set_flags
(
flags
)
feed
=
[{
'id'
:
np
.
array
([
1
,
2
,
3
,
4
,
5
]).
astype
(
np
.
int64
),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录