Skip to content

Commit

Permalink
Perfect unitests (#20)
Browse files Browse the repository at this point in the history
* perfect unittest

* update license

* fix bug when run tcmpt_utils_test
  • Loading branch information
YuanRisheng authored Oct 18, 2021
1 parent 37791f7 commit 28a6374
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions paddle/fluid/framework/tcmpt_utils_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,17 @@ TEST(TcmptUtils, VarToPtTensor) {
auto* data =
value->mutable_data<int>(make_ddim({1, 1}), paddle::platform::CPUPlace());
data[0] = 123;
auto tensor_def = pt::TensorArgDef(pt::Backend::kCUDA, pt::DataLayout::kNCHW,
pt::Backend expect_backend = pt::Backend::kCPU;

#if defined(PADDLE_WITH_CUDA) || defined(PADDLE_WITH_HIP)
expect_backend = pt::Backend::kCUDA;
#endif
auto tensor_def = pt::TensorArgDef(expect_backend, pt::DataLayout::kNCHW,
pt::DataType::kINT32);
// 2. test API
auto tensor_x = InputVariableToPtTensor(v, tensor_def);
// 3. check result
ASSERT_EQ(tensor_x->backend(), pt::Backend::kCUDA);
ASSERT_EQ(tensor_x->backend(), expect_backend);
ASSERT_EQ(tensor_x->type(), pt::DataType::kINT32);
}

Expand Down

1 comment on commit 28a6374

@paddle-bot-old
Copy link

@paddle-bot-old paddle-bot-old bot commented on 28a6374 Oct 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🕵️ CI failures summary

🔍 PR: #20 Commit ID: 28a6374 contains failed CI.

🔹 Failed: PR-CI-APPROVAL

approve_failed
2021-10-18 20:25:20 正在保存至: “bk.txt”
2021-10-18 20:25:20 0K 100% 956K=0s
2021-10-18 20:25:20 2021-10-18 20:25:20 (956 KB/s) - 已保存 “bk.txt” [5/5])
2021-10-18 20:25:31 ****************
2021-10-18 20:25:32 0. You must have one RD (lanxianghit (Recommend), phlrain or luotao1) approval for changing the FLAGS, which manages the environment variables.
2021-10-18 20:25:32 1. You must have Dianhai approval for change 20+ files or add than 1000+ lines of content.
2021-10-18 20:25:32 2. You must have one RD (XiaoguangHu01,chenwhql,zhiqiu,Xreki,luotao1) approval for paddle/fluid/framework/operator.h, which manages the underlying code for fluid.
2021-10-18 20:25:32 3. You must have one RD (zhiqiu (Recommend) , phlrain) approval for the changes of paddle/fluid/pybind/op_function_generator.cc, which manages the logic of automatic generating op functions for dygraph.
2021-10-18 20:25:32 4. You must have one RD (XiaoguangHu01,chenwhql,zhiqiu,Xreki,luotao1) approval for the usage of const_cast.
2021-10-18 20:25:32 5. You must have one RD (Avin0323(Recommend) or zhouwei25 or wanghuancoder or luotao1) approval for modifying unity_build_rule.cmake which the rules of Unity Build.
2021-10-18 20:25:32 There are 6 approved errors.
2021-10-18 20:25:32 ****************
2021-10-18 20:25:32 + EXCODE=6
2021-10-18 20:25:32 + echo 'EXCODE: 6'
2021-10-18 20:25:32 EXCODE: 6
2021-10-18 20:25:32 + echo 'ipipe_log_param_EXCODE: 6'
2021-10-18 20:25:32 ipipe_log_param_EXCODE: 6
2021-10-18 20:25:32 + exit 6

🔹 Failed: PR-CI-Windows

test_failed
2021-10-18 21:19:44 The following tests FAILED:
2021-10-18 21:19:44 34 - lodtensor_printer_test (Timeout)
2021-10-18 21:19:44 51 - eigen_test (Timeout)
2021-10-18 21:19:44 53 - lod_tensor_test (Timeout)
2021-10-18 21:19:44 66 - op_proto_maker_test (Timeout)
2021-10-18 21:19:44 79 - cow_ptr_tests (Timeout)
2021-10-18 21:19:44 80 - tuple_test (Timeout)
2021-10-18 21:19:44 94 - test_graph_pattern_detector (Timeout)
2021-10-18 21:19:44 96 - test_fc_fuse_pass_cc (Timeout)
2021-10-18 21:19:44 105 - test_skip_layernorm_fuse_pass (Timeout)
2021-10-18 21:19:44 106 - test_multihead_matmul_fuse_pass (Timeout)
2021-10-18 21:19:44 116 - test_conv_activation_mkldnn_fuse_pass (Timeout)
2021-10-18 21:19:44 118 - test_conv_elementwise_add_mkldnn_fuse_pass (Timeout)
2021-10-18 21:19:44 126 - test_cpu_quantize_pass (Timeout)
2021-10-18 21:19:44 Errors while running CTest
2021-10-18 21:19:44 ************************************************************************
2021-10-18 21:19:44 These unittests run 4 job each time with 1 GPU**
2021-10-18 21:19:44 ************************************************************************
2021-10-18 21:19:44 Test project C:/Users/Administrator/Downloads/workspace/b72da18d-1771-4d10-8b95-9bb3c92c176d/Paddle/build
2021-10-18 21:19:44 Start 29: device_context_test
2021-10-18 21:19:54 Start 33: timer_test

🔹 Failed: PR-CI-Kunlun-Inference-Directed-cyclic-graph

Unknown Failed
2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::correlation<float>(baidu::xpu::api::Context*, float const*, float const*, float*, int, int, int, int, int, int, int, int, int, int)' 2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to xpu_wait'
2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::less_than<float>(baidu::xpu::api::Context*, float const*, float const*, bool*, int)' 2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::relu(baidu::xpu::api::Context*, float const*, float*, int)'
2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::copy<signed char>(baidu::xpu::api::Context*, signed char const*, signed char*, int)' 2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to baidu::xpu::api::search_aligned_mat_mul(baidu::xpu::api::Context*, bool, bool, int, int, int, int, float, float const*, int, float const*, int, float*, int)'
2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to baidu::xpu::api::search_noaligned_mat_mul(baidu::xpu::api::Context*, bool, bool, int, int const*, int, int, float, float const*, float const*, float*)' 2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::reduce_mean(baidu::xpu::api::Context*, float const*, float*, std::vector<int, std::allocator > const&, std::vector<int, std::allocator > const&)'
2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::cast_v2<int, long>(baidu::xpu::api::Context*, int const*, long*, int)' 2021-10-18 23:23:47 /opt/compiler/gcc-8.2/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: ../../../../third_party/lite/src/extern_lite-build/inference_lite_lib/cxx/lib/libpaddle_full_api_shared.so: undefined reference to int baidu::xpu::api::transformer_encoder<float16, short, short>(baidu::xpu::api::Context*, float16 const*, std::vector<short const*, std::allocator<short const*> > const&, float16*, std::vector<float const*, std::allocator<float const*> > const&, std::vector<float const*, std::allocator<float const*> > const&, std::vector<float const*, std::allocator<float const*> > const&, std::vector<float const*, std::allocator<float const*> > const&, std::vector<float const*, std::allocator<float const*> > const&, baidu::xpu::api::QKVAttnParam const&, float const*)'
2021-10-18 23:23:47 collect2: error: ld returned 1 exit status
2021-10-18 23:23:47 make64[2]: *** [paddle/fluid/inference/lite/test_lite_tensor_utils] Error 1
2021-10-18 23:23:47 make64[1]: *** [paddle/fluid/inference/lite/CMakeFiles/test_lite_tensor_utils.dir/all] Error 2
2021-10-18 23:23:47 make64[1]: *** Waiting for unfinished jobs....
2021-10-18 23:23:49 [ 45%] Linking CXX static library libconditional_block_op.a
2021-10-18 23:23:49 [ 45%] Built target conditional_block_op
2021-10-18 23:23:49 [ 45%] Linking CXX static library liblite_engine_op.a
2021-10-18 23:23:49 [ 45%] Built target lite_engine_op
2021-10-18 23:23:49 make64: *** [all] Error 2

Please sign in to comment.