Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
da39d84a
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
da39d84a
编写于
8月 14, 2018
作者:
C
chenweihang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refine by reviewer's advice
上级
b1dd4149
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
19 deletion
+20
-19
paddle/fluid/platform/enforce.h
paddle/fluid/platform/enforce.h
+2
-2
paddle/fluid/platform/enforce_test.cc
paddle/fluid/platform/enforce_test.cc
+7
-7
paddle/fluid/platform/gpu_info.cc
paddle/fluid/platform/gpu_info.cc
+11
-10
未找到文件。
paddle/fluid/platform/enforce.h
浏览文件 @
da39d84a
...
...
@@ -263,7 +263,7 @@ inline void throw_on_error(T e) {
* PADDLE_ENFORCE_EQ(a, b);
*
* will raise an expression described as follows:
* "
Data check
failed. Expected input a == b, but received a(1) != b(2)."
* "
Enforce
failed. Expected input a == b, but received a(1) != b(2)."
* with detailed stack information.
*
* extra messages is also supported, for example:
...
...
@@ -293,7 +293,7 @@ inline void throw_on_error(T e) {
#define __PADDLE_BINARY_COMPARE(__VAL0, __VAL1, __CMP, __INV_CMP, ...) \
do { \
if (UNLIKELY(!((__VAL0)__CMP(__VAL1)))) { \
PADDLE_THROW("
Data check failed. Expected %s " #__CMP
\
PADDLE_THROW("
Enforce failed. Expected %s " #__CMP
\
" %s, but received %s:%s " #__INV_CMP " %s:%s.\n%s", \
#__VAL0, #__VAL1, #__VAL0, \
paddle::string::to_string(__VAL0), #__VAL1, \
...
...
paddle/fluid/platform/enforce_test.cc
浏览文件 @
da39d84a
...
...
@@ -56,7 +56,7 @@ TEST(ENFORCE_EQ, NO_EXTRA_MSG_FAIL) {
caught_exception
=
true
;
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected a == 1 + 3, but received a:2 != 1 + 3:4."
);
"
Enforce
failed. Expected a == 1 + 3, but received a:2 != 1 + 3:4."
);
}
EXPECT_TRUE
(
caught_exception
);
}
...
...
@@ -69,7 +69,7 @@ TEST(ENFORCE_EQ, EXTRA_MSG_FAIL) {
}
catch
(
paddle
::
platform
::
EnforceNotMet
error
)
{
caught_exception
=
true
;
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected a == 1 + 3, but received a:2 != 1 + "
"
Enforce
failed. Expected a == 1 + 3, but received a:2 != 1 + "
"3:4.
\n
their size not match"
);
}
EXPECT_TRUE
(
caught_exception
);
...
...
@@ -89,7 +89,7 @@ TEST(ENFORCE_NE, FAIL) {
caught_exception
=
true
;
EXPECT_TRUE
(
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected 1.0 != 1UL, but received 1.0:1 == 1UL:1."
))
"
Enforce
failed. Expected 1.0 != 1UL, but received 1.0:1 == 1UL:1."
))
<<
error
.
what
()
<<
" does not have expected prefix"
;
}
EXPECT_TRUE
(
caught_exception
);
...
...
@@ -104,7 +104,7 @@ TEST(ENFORCE_GT, FAIL) {
caught_exception
=
true
;
EXPECT_TRUE
(
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected 1 > 2UL, but received 1:1 <= 2UL:2."
));
"
Enforce
failed. Expected 1 > 2UL, but received 1:1 <= 2UL:2."
));
}
EXPECT_TRUE
(
caught_exception
);
}
...
...
@@ -123,7 +123,7 @@ TEST(ENFORCE_GE, FAIL) {
caught_exception
=
true
;
EXPECT_TRUE
(
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected 1 >= 2UL, but received 1:1 < 2UL:2."
));
"
Enforce
failed. Expected 1 >= 2UL, but received 1:1 < 2UL:2."
));
}
EXPECT_TRUE
(
caught_exception
);
}
...
...
@@ -143,7 +143,7 @@ TEST(ENFORCE_LE, FAIL) {
caught_exception
=
true
;
EXPECT_TRUE
(
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected 1 > 2UL, but received 1:1 <= 2UL:2."
));
"
Enforce
failed. Expected 1 > 2UL, but received 1:1 <= 2UL:2."
));
}
EXPECT_TRUE
(
caught_exception
);
}
...
...
@@ -160,7 +160,7 @@ TEST(ENFORCE_LT, FAIL) {
}
catch
(
paddle
::
platform
::
EnforceNotMet
error
)
{
caught_exception
=
true
;
EXPECT_TRUE
(
HasPrefix
(
StringPiece
(
error
.
what
()),
"
Data check
failed. Expected 1UL < 0.12, but "
"
Enforce
failed. Expected 1UL < 0.12, but "
"received 1UL:1 >= 0.12:0.12."
));
}
EXPECT_TRUE
(
caught_exception
);
...
...
paddle/fluid/platform/gpu_info.cc
浏览文件 @
da39d84a
...
...
@@ -100,25 +100,26 @@ size_t GpuMinChunkSize() {
size_t
GpuMaxChunkSize
()
{
size_t
total
=
0
;
size_t
available
_memory
=
0
;
size_t
available
=
0
;
GpuMemoryUsage
(
&
available
_memory
,
&
total
);
VLOG
(
10
)
<<
"GPU Usage "
<<
available
_memory
/
1024
/
1024
<<
"M/"
GpuMemoryUsage
(
&
available
,
&
total
);
VLOG
(
10
)
<<
"GPU Usage "
<<
available
/
1024
/
1024
<<
"M/"
<<
total
/
1024
/
1024
<<
"M"
;
size_t
reserving
=
static_cast
<
size_t
>
(
0.05
*
total
);
// If available less than minimum chunk size, no usable memory exists.
available
_memory
=
std
::
min
(
std
::
m
ax
(
available_memory
,
GpuMinChunkSize
())
-
GpuMinChunkSize
(),
total
-
reserving
);
available
=
std
::
m
in
(
std
::
max
(
available
,
GpuMinChunkSize
())
-
GpuMinChunkSize
(),
total
-
reserving
);
// Reserving the rest memory for page tables, etc.
size_t
allocating
_memory
=
static_cast
<
size_t
>
(
FLAGS_fraction_of_gpu_memory_to_use
*
(
total
-
reserving
));
size_t
allocating
=
static_cast
<
size_t
>
(
FLAGS_fraction_of_gpu_memory_to_use
*
(
total
-
reserving
));
PADDLE_ENFORCE_LE
(
allocating_memory
,
available_memory
);
PADDLE_ENFORCE_LE
(
allocating
,
available
,
"Insufficient GPU memory to allocation."
);
return
allocating
_memory
;
return
allocating
;
}
void
GpuMemcpyAsync
(
void
*
dst
,
const
void
*
src
,
size_t
count
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录