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

test=infer-coverage (#46983)

上级 46f8e882
......@@ -40,7 +40,12 @@ T GetValueFromStream(std::stringstream &ss);
template <>
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
TEST(Analyzer_bert, profile_mkldnn) {
......@@ -57,6 +62,9 @@ TEST(Analyzer_bert, profile_mkldnn_bf16) {
// Check the fuse status
TEST(Analyzer_bert, fuse_statis) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
auto cfg(SetConfig());
int num_ops;
auto predictor = CreatePaddlePredictor<AnalysisConfig>(cfg);
......@@ -65,7 +73,12 @@ TEST(Analyzer_bert, fuse_statis) {
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
TEST(Analyzer_bert, compare_mkldnn) {
auto use_mkldnn = true;
......@@ -75,6 +88,9 @@ TEST(Analyzer_bert, compare_mkldnn) {
// Compare Deterministic result
TEST(Analyzer_bert, compare_determine) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
auto cfg(SetConfig());
auto inputs = LoadInputData();
......@@ -83,6 +99,9 @@ TEST(Analyzer_bert, compare_determine) {
}
TEST(Analyzer_bert, transfer_scope_cache) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
auto config(SetConfig());
std::vector<PaddleTensor> input, output;
......
......@@ -39,18 +39,31 @@ void profile(bool use_mkldnn = false, bool use_gpu = false) {
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
TEST(Analyzer_ernie, profile_mkldnn) { profile(true, false); }
#endif
// Check the model by gpu
#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
// Check the fuse status
TEST(Analyzer_Ernie, fuse_statis) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
AnalysisConfig cfg;
SetConfig(&cfg);
......@@ -85,13 +98,21 @@ void compare(bool use_mkldnn = false) {
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
TEST(Analyzer_ernie, compare_mkldnn) { compare(true /* use_mkldnn */); }
#endif
// Compare Deterministic result
TEST(Analyzer_Ernie, compare_determine) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
AnalysisConfig cfg;
SetConfig(&cfg);
auto pass_builder = cfg.pass_builder();
......@@ -104,6 +125,9 @@ TEST(Analyzer_Ernie, compare_determine) {
// Compare results
TEST(Analyzer_Ernie, compare_results) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
AnalysisConfig cfg;
SetConfig(&cfg);
auto pass_builder = cfg.pass_builder();
......@@ -150,6 +174,9 @@ TEST(Analyzer_Ernie_ipu, ipu_compare_determine) {
// IPU: Compare results
TEST(Analyzer_Ernie_ipu, ipu_compare_results) {
#if !defined(_WIN32)
setenv("NVIDIA_TF32_OVERRIDE", "0", 1);
#endif
AnalysisConfig cfg;
SetIpuConfig(&cfg);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册