Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
2a5edec0
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
12 个月 前同步成功
通知
692
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2a5edec0
编写于
10月 27, 2017
作者:
Y
Yu Yang
提交者:
QI JUN
10月 27, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add debug logs in scope, meta_cache and memory (#5170)
* Add debug logs in scope, meta_cache and memory * Add missing deps
上级
b0676396
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
17 addition
and
5 deletion
+17
-5
paddle/framework/CMakeLists.txt
paddle/framework/CMakeLists.txt
+1
-1
paddle/framework/scope.cc
paddle/framework/scope.cc
+6
-1
paddle/memory/CMakeLists.txt
paddle/memory/CMakeLists.txt
+1
-1
paddle/memory/detail/meta_cache.cc
paddle/memory/detail/meta_cache.cc
+4
-1
paddle/memory/memory.cc
paddle/memory/memory.cc
+5
-1
未找到文件。
paddle/framework/CMakeLists.txt
浏览文件 @
2a5edec0
...
@@ -15,7 +15,7 @@ nv_test(lod_tensor_gpu_test SRCS lod_tensor_test.cu DEPS lod_tensor)
...
@@ -15,7 +15,7 @@ nv_test(lod_tensor_gpu_test SRCS lod_tensor_test.cu DEPS lod_tensor)
cc_test
(
variable_test SRCS variable_test.cc
)
cc_test
(
variable_test SRCS variable_test.cc
)
cc_library
(
scope SRCS scope.cc
)
cc_library
(
scope SRCS scope.cc
DEPS glog
)
cc_test
(
scope_test SRCS scope_test.cc DEPS scope
)
cc_test
(
scope_test SRCS scope_test.cc DEPS scope
)
...
...
paddle/framework/scope.cc
浏览文件 @
2a5edec0
...
@@ -16,6 +16,7 @@ limitations under the License. */
...
@@ -16,6 +16,7 @@ limitations under the License. */
#include <memory> // for unique_ptr
#include <memory> // for unique_ptr
#include <mutex> // for call_once
#include <mutex> // for call_once
#include "glog/logging.h"
#include "paddle/string/printf.h"
#include "paddle/string/printf.h"
namespace
paddle
{
namespace
paddle
{
...
@@ -23,7 +24,10 @@ namespace framework {
...
@@ -23,7 +24,10 @@ namespace framework {
Scope
::~
Scope
()
{
Scope
::~
Scope
()
{
DropKids
();
DropKids
();
for
(
auto
&
kv
:
vars_
)
delete
kv
.
second
;
for
(
auto
&
kv
:
vars_
)
{
VLOG
(
3
)
<<
"Destroy variable "
<<
kv
.
first
;
delete
kv
.
second
;
}
}
}
Scope
&
Scope
::
NewScope
()
const
{
Scope
&
Scope
::
NewScope
()
const
{
...
@@ -38,6 +42,7 @@ Variable* Scope::Var(const std::string& name) {
...
@@ -38,6 +42,7 @@ Variable* Scope::Var(const std::string& name) {
}
}
Variable
*
v
=
new
Variable
();
Variable
*
v
=
new
Variable
();
vars_
[
name
]
=
v
;
vars_
[
name
]
=
v
;
VLOG
(
3
)
<<
"Create variable "
<<
name
<<
" on scope"
;
v
->
name_
=
&
(
vars_
.
find
(
name
)
->
first
);
v
->
name_
=
&
(
vars_
.
find
(
name
)
->
first
);
return
v
;
return
v
;
}
}
...
...
paddle/memory/CMakeLists.txt
浏览文件 @
2a5edec0
add_subdirectory
(
detail
)
add_subdirectory
(
detail
)
cc_library
(
memory SRCS memory.cc
)
cc_library
(
memory SRCS memory.cc
DEPS place
)
cc_library
(
memcpy SRCS memcpy.cc
)
cc_library
(
memcpy SRCS memcpy.cc
)
cc_library
(
paddle_memory
cc_library
(
paddle_memory
...
...
paddle/memory/detail/meta_cache.cc
浏览文件 @
2a5edec0
...
@@ -13,6 +13,7 @@
...
@@ -13,6 +13,7 @@
limitations under the License. */
limitations under the License. */
#include "paddle/memory/detail/meta_cache.h"
#include "paddle/memory/detail/meta_cache.h"
#include "glog/logging.h"
#include "paddle/memory/detail/memory_block.h"
#include "paddle/memory/detail/memory_block.h"
#include "paddle/platform/assert.h"
#include "paddle/platform/assert.h"
...
@@ -28,7 +29,9 @@ Metadata MetadataCache::load(const MemoryBlock* block) {
...
@@ -28,7 +29,9 @@ Metadata MetadataCache::load(const MemoryBlock* block) {
PADDLE_ASSERT
(
existing_metadata
->
second
.
check_guards
());
PADDLE_ASSERT
(
existing_metadata
->
second
.
check_guards
());
return
existing_metadata
->
second
;
return
existing_metadata
->
second
;
}
else
{
}
else
{
PADDLE_ASSERT
(
reinterpret_cast
<
const
Metadata
*>
(
block
)
->
check_guards
());
auto
*
meta
=
reinterpret_cast
<
const
Metadata
*>
(
block
);
VLOG
(
3
)
<<
"Load MetaData type="
<<
meta
->
type
;
PADDLE_ASSERT
(
meta
->
check_guards
());
return
*
reinterpret_cast
<
const
Metadata
*>
(
block
);
return
*
reinterpret_cast
<
const
Metadata
*>
(
block
);
}
}
}
}
...
...
paddle/memory/memory.cc
浏览文件 @
2a5edec0
...
@@ -39,11 +39,15 @@ BuddyAllocator* GetCPUBuddyAllocator() {
...
@@ -39,11 +39,15 @@ BuddyAllocator* GetCPUBuddyAllocator() {
template
<
>
template
<
>
void
*
Alloc
<
platform
::
CPUPlace
>
(
platform
::
CPUPlace
place
,
size_t
size
)
{
void
*
Alloc
<
platform
::
CPUPlace
>
(
platform
::
CPUPlace
place
,
size_t
size
)
{
return
GetCPUBuddyAllocator
()
->
Alloc
(
size
);
VLOG
(
3
)
<<
"Allocate "
<<
size
<<
" bytes on "
<<
platform
::
Place
(
place
);
void
*
p
=
GetCPUBuddyAllocator
()
->
Alloc
(
size
);
VLOG
(
3
)
<<
" pointer="
<<
p
;
return
p
;
}
}
template
<
>
template
<
>
void
Free
<
platform
::
CPUPlace
>
(
platform
::
CPUPlace
place
,
void
*
p
)
{
void
Free
<
platform
::
CPUPlace
>
(
platform
::
CPUPlace
place
,
void
*
p
)
{
VLOG
(
3
)
<<
"Free pointer="
<<
p
<<
" on "
<<
platform
::
Place
(
place
);
GetCPUBuddyAllocator
()
->
Free
(
p
);
GetCPUBuddyAllocator
()
->
Free
(
p
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录