From e43081ff2f2981df8b5606c993189a84a05f6434 Mon Sep 17 00:00:00 2001 From: huzhiqiang <912790387@qq.com> Date: Tue, 23 Jun 2020 15:20:14 +0800 Subject: [PATCH] [CI][Opt]Check the usability of opt in CI project (#3820) --- lite/tests/math/conv_compute_test.cc | 34 ++++++++++++++-------------- lite/tools/ci_build.sh | 10 ++++++++ 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/lite/tests/math/conv_compute_test.cc b/lite/tests/math/conv_compute_test.cc index 8265f9db2f..9ad98ce6f4 100644 --- a/lite/tests/math/conv_compute_test.cc +++ b/lite/tests/math/conv_compute_test.cc @@ -236,19 +236,19 @@ void test_conv_fp32(const std::vector& input_dims, double gops = 2.0 * dim_out.production() * dim_in[1] * weight_dim[2] * weight_dim[3] / param.groups; - LOG(INFO) << "conv fp32: input shape: " << dim_in << ", output shape" - << dim_out << ",running time, avg: " << t0.LapTimes().Avg() - << ", min time: " << t0.LapTimes().Min() - << ", total GOPS: " << 1e-9 * gops - << " GOPS, avg GOPs: " << 1e-6 * gops / t0.LapTimes().Avg() - << " GOPs, max GOPs: " << 1e-6 * gops / t0.LapTimes().Min(); + VLOG(4) << "conv fp32: input shape: " << dim_in << ", output shape" + << dim_out << ",running time, avg: " << t0.LapTimes().Avg() + << ", min time: " << t0.LapTimes().Min() + << ", total GOPS: " << 1e-9 * gops + << " GOPS, avg GOPs: " << 1e-6 * gops / t0.LapTimes().Avg() + << " GOPs, max GOPs: " << 1e-6 * gops / t0.LapTimes().Min(); if (FLAGS_check_result) { double max_ratio = 0; double max_diff = 0; tensor_cmp_host(tout_basic, *param.output, max_ratio, max_diff); - LOG(INFO) << "compare result, max diff: " << max_diff - << ", max ratio: " << max_ratio; + VLOG(4) << "compare result, max diff: " << max_diff + << ", max ratio: " << max_ratio; if (std::abs(max_ratio) > 1e-3f) { if (max_diff > 5e-4f) { LOG(WARNING) << "basic result"; @@ -274,15 +274,15 @@ void test_conv_fp32(const std::vector& input_dims, } } } - LOG(INFO) << "test fp32 conv: input: " << dim_in - << ", output: " << dim_out << ", weight dim: " << weight_dim - << ", pad: " << pads[0] << ", " << pads[1] << ", " << pads[2] - << ", " << pads[3] << ", stride: " << strides[0] << ", " - << strides[1] << ", dila_: " << dilas[0] << ", " << dilas[1] - << ", group: " << group - << ", bias: " << (flag_bias ? "true" : "false") - << ", act: " << flag_act << ", threads: " << th - << ", power_mode: " << cls << " successed!!\n"; + VLOG(4) << "test fp32 conv: input: " << dim_in + << ", output: " << dim_out << ", weight dim: " << weight_dim + << ", pad: " << pads[0] << ", " << pads[1] << ", " << pads[2] + << ", " << pads[3] << ", stride: " << strides[0] << ", " + << strides[1] << ", dila_: " << dilas[0] << ", " << dilas[1] + << ", group: " << group + << ", bias: " << (flag_bias ? "true" : "false") + << ", act: " << flag_act << ", threads: " << th + << ", power_mode: " << cls << " successed!!\n"; } } } diff --git a/lite/tools/ci_build.sh b/lite/tools/ci_build.sh index fde4ea6faa..c61ecbf2a8 100755 --- a/lite/tools/ci_build.sh +++ b/lite/tools/ci_build.sh @@ -564,8 +564,18 @@ function test_arm_model { function test_model_optimize_tool_compile { cd $workspace cd build + # Compile opt tool cmake .. -DWITH_LITE=ON -DLITE_ON_MODEL_OPTIMIZE_TOOL=ON -DWITH_TESTING=OFF -DLITE_BUILD_EXTRA=ON make opt -j$NUM_CORES_FOR_COMPILE + # Check whether opt can transform quantized mobilenetv1 successfully. + cd lite/api && chmod +x ./opt + wget --no-check-certificate https://paddlelite-data.bj.bcebos.com/doc_models/MobileNetV1_quant.tar.gz + tar zxf MobileNetV1_quant.tar.gz + ./opt --model_dir=./MobileNetV1_quant --valid_targets=arm --optimize_out=quant_mobilenetv1 + if [ ! -f quant_mobilenetv1.nb ]; then + echo -e "Error! Resulted opt can not tramsform MobileNetV1_quant successfully!" + exit 1 + fi } function _test_paddle_code_generator { -- GitLab