Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
225f1af2
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看板
未验证
提交
225f1af2
编写于
3月 29, 2023
作者:
G
Galaxy1458
提交者:
GitHub
3月 29, 2023
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix_Linux_[-Wterminate]warning (#52186)
上级
5208e2d6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
18 deletion
+33
-18
paddle/fluid/memory/allocation/cuda_device_context_allocator.h
...e/fluid/memory/allocation/cuda_device_context_allocator.h
+15
-8
paddle/fluid/memory/allocation/mmap_allocator.cc
paddle/fluid/memory/allocation/mmap_allocator.cc
+17
-10
paddle/fluid/memory/allocation/mmap_allocator_test.cc
paddle/fluid/memory/allocation/mmap_allocator_test.cc
+1
-0
未找到文件。
paddle/fluid/memory/allocation/cuda_device_context_allocator.h
浏览文件 @
225f1af2
...
...
@@ -44,10 +44,13 @@ class GPUContextAllocation : public Allocation {
underlying_allocation_
(
std
::
move
(
allocation
))
{}
~
GPUContextAllocation
()
{
PADDLE_ENFORCE_NOT_NULL
(
dev_ctx_
,
platform
::
errors
::
PreconditionNotMet
(
"Device context is not set for GPUContextAllocation"
));
try
{
PADDLE_ENFORCE_NOT_NULL
(
dev_ctx_
,
platform
::
errors
::
PreconditionNotMet
(
"Device context is not set for GPUContextAllocation"
));
}
catch
(
std
::
exception
&
e
)
{
}
auto
*
p_allocation
=
underlying_allocation_
.
release
();
VLOG
(
4
)
<<
"Adding callback to delete GPUContextAllocation at "
<<
p_allocation
;
...
...
@@ -86,13 +89,17 @@ class GPUContextAllocator : public Allocator {
}
~
GPUContextAllocator
()
{
if
(
event_
)
{
platform
::
CUDADeviceGuard
guard
(
place_
.
device
);
try
{
if
(
event_
)
{
platform
::
CUDADeviceGuard
guard
(
place_
.
device
);
#ifdef PADDLE_WITH_HIP
PADDLE_ENFORCE_GPU_SUCCESS
(
hipEventDestroy
(
event_
));
PADDLE_ENFORCE_GPU_SUCCESS
(
hipEventDestroy
(
event_
));
#else
PADDLE_ENFORCE_GPU_SUCCESS
(
cudaEventDestroy
(
event_
));
PADDLE_ENFORCE_GPU_SUCCESS
(
cudaEventDestroy
(
event_
));
#endif
}
}
catch
(
std
::
exception
&
e
)
{
}
}
...
...
paddle/fluid/memory/allocation/mmap_allocator.cc
浏览文件 @
225f1af2
...
...
@@ -216,19 +216,26 @@ void RefcountedMemoryMapAllocation::close() {
}
MemoryMapWriterAllocation
::~
MemoryMapWriterAllocation
()
{
PADDLE_ENFORCE_NE
(
munmap
(
this
->
ptr
(),
this
->
size
()),
-
1
,
platform
::
errors
::
Unavailable
(
"could not unmap the shared memory file %s"
,
this
->
ipc_name
()));
try
{
PADDLE_ENFORCE_NE
(
munmap
(
this
->
ptr
(),
this
->
size
()),
-
1
,
platform
::
errors
::
Unavailable
(
"could not unmap the shared memory file %s"
,
this
->
ipc_name
()));
}
catch
(
std
::
exception
&
e
)
{
}
}
MemoryMapReaderAllocation
::~
MemoryMapReaderAllocation
()
{
PADDLE_ENFORCE_NE
(
munmap
(
this
->
ptr
(),
this
->
size
()),
-
1
,
platform
::
errors
::
Unavailable
(
"could not unmap the shared memory file %s"
,
this
->
ipc_name
()));
try
{
PADDLE_ENFORCE_NE
(
munmap
(
this
->
ptr
(),
this
->
size
()),
-
1
,
platform
::
errors
::
Unavailable
(
"could not unmap the shared memory file %s"
,
this
->
ipc_name
()));
}
catch
(
std
::
exception
&
e
)
{
}
/* Here we do not pay attention to the result of shm_unlink,
because the memory mapped file may have been cleared due to the
MemoryMapFdSet::Clear() */
...
...
paddle/fluid/memory/allocation/mmap_allocator_test.cc
浏览文件 @
225f1af2
...
...
@@ -24,6 +24,7 @@ namespace allocation {
TEST
(
MemoryMapAllocation
,
test_allocation_base
)
{
size_t
data_size
=
4UL
*
1024
;
// 1. allocate writer holader
auto
mmap_writer_holder
=
AllocateMemoryMapWriterAllocation
(
data_size
);
std
::
string
ipc_name
=
mmap_writer_holder
->
ipc_name
();
...
...
saxon_zh
@saxon_zh
mentioned in commit
0ebf739f
·
3月 30, 2023
mentioned in commit
0ebf739f
mentioned in commit 0ebf739fe5ddc163dde47c8fea3af89c3acc086b
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录