未验证 提交 f856fc8d 编写于 作者: W Wangzheee 提交者: GitHub

test=infer-coverage (#46983)

上级 46f8e882
...@@ -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;
......
...@@ -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.
先完成此消息的编辑!
想要评论请 注册