Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
f856fc8d
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看板
未验证
提交
f856fc8d
编写于
10月 13, 2022
作者:
W
Wangzheee
提交者:
GitHub
10月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test=infer-coverage (#46983)
上级
46f8e882
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
51 addition
and
5 deletion
+51
-5
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
+21
-2
paddle/fluid/inference/tests/api/analyzer_ernie_tester.cc
paddle/fluid/inference/tests/api/analyzer_ernie_tester.cc
+30
-3
未找到文件。
paddle/fluid/inference/tests/api/analyzer_bert_tester.cc
浏览文件 @
f856fc8d
...
@@ -40,7 +40,12 @@ T GetValueFromStream(std::stringstream &ss);
...
@@ -40,7 +40,12 @@ T GetValueFromStream(std::stringstream &ss);
template
<
>
template
<
>
std
::
string
GetValueFromStream
<
std
::
string
>
(
std
::
stringstream
&
ss
);
std
::
string
GetValueFromStream
<
std
::
string
>
(
std
::
stringstream
&
ss
);
TEST
(
Analyzer_bert
,
profile
)
{
profile
();
}
TEST
(
Analyzer_bert
,
profile
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
profile
();
}
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_bert
,
profile_mkldnn
)
{
TEST
(
Analyzer_bert
,
profile_mkldnn
)
{
...
@@ -57,6 +62,9 @@ TEST(Analyzer_bert, profile_mkldnn_bf16) {
...
@@ -57,6 +62,9 @@ TEST(Analyzer_bert, profile_mkldnn_bf16) {
// Check the fuse status
// Check the fuse status
TEST
(
Analyzer_bert
,
fuse_statis
)
{
TEST
(
Analyzer_bert
,
fuse_statis
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
auto
cfg
(
SetConfig
());
auto
cfg
(
SetConfig
());
int
num_ops
;
int
num_ops
;
auto
predictor
=
CreatePaddlePredictor
<
AnalysisConfig
>
(
cfg
);
auto
predictor
=
CreatePaddlePredictor
<
AnalysisConfig
>
(
cfg
);
...
@@ -65,7 +73,12 @@ TEST(Analyzer_bert, fuse_statis) {
...
@@ -65,7 +73,12 @@ TEST(Analyzer_bert, fuse_statis) {
LOG
(
INFO
)
<<
"num_ops: "
<<
num_ops
;
LOG
(
INFO
)
<<
"num_ops: "
<<
num_ops
;
}
}
TEST
(
Analyzer_bert
,
compare
)
{
CompareNativeAndAnalysisWrapper
();
}
TEST
(
Analyzer_bert
,
compare
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
CompareNativeAndAnalysisWrapper
();
}
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_bert
,
compare_mkldnn
)
{
TEST
(
Analyzer_bert
,
compare_mkldnn
)
{
auto
use_mkldnn
=
true
;
auto
use_mkldnn
=
true
;
...
@@ -75,6 +88,9 @@ TEST(Analyzer_bert, compare_mkldnn) {
...
@@ -75,6 +88,9 @@ TEST(Analyzer_bert, compare_mkldnn) {
// Compare Deterministic result
// Compare Deterministic result
TEST
(
Analyzer_bert
,
compare_determine
)
{
TEST
(
Analyzer_bert
,
compare_determine
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
auto
cfg
(
SetConfig
());
auto
cfg
(
SetConfig
());
auto
inputs
=
LoadInputData
();
auto
inputs
=
LoadInputData
();
...
@@ -83,6 +99,9 @@ TEST(Analyzer_bert, compare_determine) {
...
@@ -83,6 +99,9 @@ TEST(Analyzer_bert, compare_determine) {
}
}
TEST
(
Analyzer_bert
,
transfer_scope_cache
)
{
TEST
(
Analyzer_bert
,
transfer_scope_cache
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
auto
config
(
SetConfig
());
auto
config
(
SetConfig
());
std
::
vector
<
PaddleTensor
>
input
,
output
;
std
::
vector
<
PaddleTensor
>
input
,
output
;
...
...
paddle/fluid/inference/tests/api/analyzer_ernie_tester.cc
浏览文件 @
f856fc8d
...
@@ -39,18 +39,31 @@ void profile(bool use_mkldnn = false, bool use_gpu = false) {
...
@@ -39,18 +39,31 @@ void profile(bool use_mkldnn = false, bool use_gpu = false) {
FLAGS_num_threads
);
FLAGS_num_threads
);
}
}
TEST
(
Analyzer_ernie
,
profile
)
{
profile
();
}
TEST
(
Analyzer_ernie
,
profile
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
profile
();
}
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_ernie
,
profile_mkldnn
)
{
profile
(
true
,
false
);
}
TEST
(
Analyzer_ernie
,
profile_mkldnn
)
{
profile
(
true
,
false
);
}
#endif
#endif
// Check the model by gpu
// Check the model by gpu
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
TEST
(
Analyzer_ernie
,
profile_gpu
)
{
profile
(
false
,
true
);
}
TEST
(
Analyzer_ernie
,
profile_gpu
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
profile
(
false
,
true
);
}
#endif
#endif
// Check the fuse status
// Check the fuse status
TEST
(
Analyzer_Ernie
,
fuse_statis
)
{
TEST
(
Analyzer_Ernie
,
fuse_statis
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
SetConfig
(
&
cfg
);
...
@@ -85,13 +98,21 @@ void compare(bool use_mkldnn = false) {
...
@@ -85,13 +98,21 @@ void compare(bool use_mkldnn = false) {
reinterpret_cast
<
const
PaddlePredictor
::
Config
*>
(
&
cfg
),
inputs
);
reinterpret_cast
<
const
PaddlePredictor
::
Config
*>
(
&
cfg
),
inputs
);
}
}
TEST
(
Analyzer_ernie
,
compare
)
{
compare
();
}
TEST
(
Analyzer_ernie
,
compare
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
compare
();
}
#ifdef PADDLE_WITH_MKLDNN
#ifdef PADDLE_WITH_MKLDNN
TEST
(
Analyzer_ernie
,
compare_mkldnn
)
{
compare
(
true
/* use_mkldnn */
);
}
TEST
(
Analyzer_ernie
,
compare_mkldnn
)
{
compare
(
true
/* use_mkldnn */
);
}
#endif
#endif
// Compare Deterministic result
// Compare Deterministic result
TEST
(
Analyzer_Ernie
,
compare_determine
)
{
TEST
(
Analyzer_Ernie
,
compare_determine
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
SetConfig
(
&
cfg
);
auto
pass_builder
=
cfg
.
pass_builder
();
auto
pass_builder
=
cfg
.
pass_builder
();
...
@@ -104,6 +125,9 @@ TEST(Analyzer_Ernie, compare_determine) {
...
@@ -104,6 +125,9 @@ TEST(Analyzer_Ernie, compare_determine) {
// Compare results
// Compare results
TEST
(
Analyzer_Ernie
,
compare_results
)
{
TEST
(
Analyzer_Ernie
,
compare_results
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
SetConfig
(
&
cfg
);
SetConfig
(
&
cfg
);
auto
pass_builder
=
cfg
.
pass_builder
();
auto
pass_builder
=
cfg
.
pass_builder
();
...
@@ -150,6 +174,9 @@ TEST(Analyzer_Ernie_ipu, ipu_compare_determine) {
...
@@ -150,6 +174,9 @@ TEST(Analyzer_Ernie_ipu, ipu_compare_determine) {
// IPU: Compare results
// IPU: Compare results
TEST
(
Analyzer_Ernie_ipu
,
ipu_compare_results
)
{
TEST
(
Analyzer_Ernie_ipu
,
ipu_compare_results
)
{
#if !defined(_WIN32)
setenv
(
"NVIDIA_TF32_OVERRIDE"
,
"0"
,
1
);
#endif
AnalysisConfig
cfg
;
AnalysisConfig
cfg
;
SetIpuConfig
(
&
cfg
);
SetIpuConfig
(
&
cfg
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录