Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
756f4639
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2297
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
756f4639
编写于
4月 26, 2021
作者:
L
Leo Chen
提交者:
GitHub
4月 26, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine error msg when out of memory (#32527)
上级
6c03ea5a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
8 addition
and
5 deletion
+8
-5
paddle/fluid/memory/allocation/cuda_allocator.cc
paddle/fluid/memory/allocation/cuda_allocator.cc
+4
-2
paddle/fluid/memory/detail/system_allocator.cc
paddle/fluid/memory/detail/system_allocator.cc
+4
-3
未找到文件。
paddle/fluid/memory/allocation/cuda_allocator.cc
浏览文件 @
756f4639
...
...
@@ -54,6 +54,7 @@ Allocation* CUDAAllocator::AllocateImpl(size_t size) {
size_t
avail
,
total
,
actual_avail
,
actual_total
;
bool
is_limited
=
platform
::
RecordedCudaMemGetInfo
(
&
avail
,
&
total
,
&
actual_avail
,
&
actual_total
,
place_
.
device
);
size_t
allocated
=
total
-
avail
;
std
::
string
err_msg
;
if
(
is_limited
)
{
...
...
@@ -68,13 +69,14 @@ Allocation* CUDAAllocator::AllocateImpl(size_t size) {
PADDLE_THROW_BAD_ALLOC
(
platform
::
errors
::
ResourceExhausted
(
"
\n\n
Out of memory error on GPU %d. "
"Cannot allocate %s memory on GPU %d, "
"Cannot allocate %s memory on GPU %d,
%s memory has been allocated and
"
"available memory is only %s.
\n\n
"
"Please check whether there is any other process using GPU %d.
\n
"
"1. If yes, please stop them, or start PaddlePaddle on another GPU.
\n
"
"2. If no, please decrease the batch size of your model. %s
\n\n
"
,
place_
.
device
,
string
::
HumanReadableSize
(
size
),
place_
.
device
,
string
::
HumanReadableSize
(
avail
),
place_
.
device
,
err_msg
));
string
::
HumanReadableSize
(
allocated
),
string
::
HumanReadableSize
(
avail
),
place_
.
device
,
err_msg
));
}
}
// namespace allocation
...
...
paddle/fluid/memory/detail/system_allocator.cc
浏览文件 @
756f4639
...
...
@@ -125,6 +125,7 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) {
size_t
avail
,
total
,
actual_avail
,
actual_total
;
bool
is_limited
=
platform
::
RecordedCudaMemGetInfo
(
&
avail
,
&
total
,
&
actual_avail
,
&
actual_total
,
gpu_id_
);
size_t
allocated
=
total
-
avail
;
std
::
string
err_msg
;
if
(
is_limited
)
{
...
...
@@ -139,7 +140,7 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) {
PADDLE_THROW_BAD_ALLOC
(
platform
::
errors
::
ResourceExhausted
(
"
\n\n
Out of memory error on GPU %d. "
"Cannot allocate %s memory on GPU %d, "
"Cannot allocate %s memory on GPU %d,
%s memory has been allocated and
"
"available memory is only %s.
\n\n
"
"Please check whether there is any other process using GPU %d.
\n
"
"1. If yes, please stop them, or start PaddlePaddle on another GPU.
\n
"
...
...
@@ -150,8 +151,8 @@ void* GPUAllocator::Alloc(size_t* index, size_t size) {
" The command is "
"`export FLAGS_fraction_of_gpu_memory_to_use=xxx`.%s
\n\n
"
,
gpu_id_
,
string
::
HumanReadableSize
(
size
),
gpu_id_
,
string
::
HumanReadableSize
(
a
vail
),
gpu_id_
,
FLAGS_fraction_of_gpu_memory_to_use
,
err_msg
));
string
::
HumanReadableSize
(
a
llocated
),
string
::
HumanReadableSize
(
avail
)
,
gpu_id_
,
FLAGS_fraction_of_gpu_memory_to_use
,
err_msg
));
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录