Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
199b5fcb
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看板
提交
199b5fcb
编写于
7月 10, 2017
作者:
L
liaogang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ENH: refine code comments
上级
1ce2fca4
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
16 addition
and
22 deletion
+16
-22
paddle/memory/detail/buddy_allocator.h
paddle/memory/detail/buddy_allocator.h
+2
-1
paddle/memory/detail/meta_cache.h
paddle/memory/detail/meta_cache.h
+9
-16
paddle/memory/detail/system_allocator.cc
paddle/memory/detail/system_allocator.cc
+2
-2
paddle/memory/detail/system_allocator.h
paddle/memory/detail/system_allocator.h
+3
-3
未找到文件。
paddle/memory/detail/buddy_allocator.h
浏览文件 @
199b5fcb
...
...
@@ -42,7 +42,7 @@ class BuddyAllocator {
void
Free
(
void
*
);
size_t
Used
();
p
rivate
:
p
ublic
:
// Disable copy and assignment.
BuddyAllocator
(
const
BuddyAllocator
&
)
=
delete
;
BuddyAllocator
&
operator
=
(
const
BuddyAllocator
&
)
=
delete
;
...
...
@@ -57,6 +57,7 @@ class BuddyAllocator {
/*! \brief If existing chunks are not suitable, refill pool */
PoolSet
::
iterator
RefillPool
();
/**
* \brief Find the suitable chunk from existing pool
*
...
...
paddle/memory/detail/meta_cache.h
浏览文件 @
199b5fcb
...
...
@@ -23,14 +23,14 @@ namespace paddle {
namespace
memory
{
namespace
detail
{
/*
! A cache for accessing memory block meta-data that may be expensive to access
directly.
Note: this class exists to unify the metadata format between GPU and CPU
allocations.
It should be removed when the CPU can access all GPU allocations directly
via UVM.
*/
/*
*
* \brief A cache for accessing memory block meta-data that may be expensive
* to access directly.
*
* \note This class exists to unify the metadata format between GPU and CPU
* allocations. It should be removed when the CPU can access all GPU
* allocations directly
via UVM.
*/
class
MetadataCache
{
public:
MetadataCache
(
bool
uses_gpu
);
...
...
@@ -42,14 +42,7 @@ class MetadataCache {
/*! \brief Store the associated metadata for the specified memory block. */
void
store
(
MemoryBlock
*
,
const
Metadata
&
);
public:
/*! \brief Acquire any external metadata updates. */
void
acquire
(
MemoryBlock
*
);
/*! \brief Publish any local updates externally. */
void
release
(
MemoryBlock
*
);
/*! \brief Indicate that the specified metadata will no longer be used */
/*! \brief Indicate that the specified metadata will no longer be used. */
void
invalidate
(
MemoryBlock
*
);
public:
...
...
paddle/memory/detail/system_allocator.cc
浏览文件 @
199b5fcb
...
...
@@ -60,7 +60,7 @@ void CPUAllocator::Free(void* p, size_t size, size_t index) {
free
(
p
);
}
bool
CPUAllocator
::
UseGpu
()
{
return
false
;
}
bool
CPUAllocator
::
UseGpu
()
const
{
return
false
;
}
#ifndef PADDLE_ONLY_CPU
...
...
@@ -133,7 +133,7 @@ void GPUAllocator::Free(void* p, size_t size, size_t index) {
}
}
bool
GPUAllocator
::
UseGpu
()
{
return
true
;
}
bool
GPUAllocator
::
UseGpu
()
const
{
return
true
;
}
#endif // PADDLE_ONLY_CPU
...
...
paddle/memory/detail/system_allocator.h
浏览文件 @
199b5fcb
...
...
@@ -32,14 +32,14 @@ class SystemAllocator {
virtual
~
SystemAllocator
()
{}
virtual
void
*
Alloc
(
size_t
&
index
,
size_t
size
)
=
0
;
virtual
void
Free
(
void
*
p
,
size_t
size
,
size_t
index
)
=
0
;
virtual
bool
UseGpu
()
=
0
;
virtual
bool
UseGpu
()
const
=
0
;
};
class
CPUAllocator
:
public
SystemAllocator
{
public:
virtual
void
*
Alloc
(
size_t
&
index
,
size_t
size
);
virtual
void
Free
(
void
*
p
,
size_t
size
,
size_t
index
);
virtual
bool
UseGpu
();
virtual
bool
UseGpu
()
const
;
};
#ifndef PADDLE_ONLY_CPU
...
...
@@ -47,7 +47,7 @@ class GPUAllocator : public SystemAllocator {
public:
virtual
void
*
Alloc
(
size_t
&
index
,
size_t
size
);
virtual
void
Free
(
void
*
p
,
size_t
size
,
size_t
index
);
virtual
bool
UseGpu
();
virtual
bool
UseGpu
()
const
;
private:
size_t
gpu_alloc_size_
=
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录