From 3fa9fff870241d86b351a3fab1b1aa4ce1051fb1 Mon Sep 17 00:00:00 2001 From: superjomn Date: Fri, 21 Jun 2019 20:59:03 +0800 Subject: [PATCH] update --- paddle/fluid/lite/api/CMakeLists.txt | 14 ++++++-------- paddle/fluid/lite/tools/build.sh | 18 +++++++++++++++++- paddle/fluid/lite/utils/io.h | 2 +- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/paddle/fluid/lite/api/CMakeLists.txt b/paddle/fluid/lite/api/CMakeLists.txt index 4440acd61..84da4757b 100644 --- a/paddle/fluid/lite/api/CMakeLists.txt +++ b/paddle/fluid/lite/api/CMakeLists.txt @@ -74,18 +74,16 @@ endif() # These tests needs CLI arguments, and is not supported in ARM CI. # TODO(Superjomn) support latter. -lite_cc_test(test_light_api SRCS light_api_test.cc +lite_cc_test(test_light_api_lite SRCS light_api_test.cc DEPS light_api_lite program_lite mir_passes ARGS --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL) -if(NOT LITE_ON_MOBILE) - lite_cc_test(test_apis_lite SRCS apis_test.cc - DEPS cxx_api_lite light_api_lite ${ops_lite} - X86_DEPS ${x86_kernels} operator - ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model - --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL) -endif() +lite_cc_test(test_apis_lite SRCS apis_test.cc + DEPS cxx_api_lite light_api_lite ${ops_lite} + X86_DEPS ${x86_kernels} operator + ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model + --optimized_model=${LITE_MODEL_DIR}/lite_naive_model_opt SERIAL) #lite_cc_binary(cxx_api_lite_bin SRCS cxx_api_bin.cc #X86_DEPS operator diff --git a/paddle/fluid/lite/tools/build.sh b/paddle/fluid/lite/tools/build.sh index 5094cee5b..2a6337988 100755 --- a/paddle/fluid/lite/tools/build.sh +++ b/paddle/fluid/lite/tools/build.sh @@ -99,7 +99,7 @@ function test_arm_android { echo "test name: ${test_name}" adb_work_dir="/data/local/tmp" - skip_list=("test_model_parser_lite" "test_mobilenetv1_lite" "test_mobilenetv2_lite" "test_resnet50_lite" "test_inceptionv4_lite" "test_light_api") + skip_list=("test_model_parser_lite" "test_mobilenetv1_lite" "test_mobilenetv2_lite" "test_resnet50_lite" "test_inceptionv4_lite" "test_light_api_lite" "test_apis_lite") for skip_name in ${skip_list[@]} ; do [[ $skip_name =~ (^|[[:space:]])$test_name($|[[:space:]]) ]] && echo "skip $test_name" && return done @@ -351,6 +351,22 @@ function build_test_arm_subtask_model { echo "Done" } + +# this test load a model, optimize it and check the prediction result of both cxx and light APIS. +function test_arm_predict_apis { + local port=$1 + local workspace=$2 + local naive_model_path=$3 + local api_test_path=$(find . -name "test_apis_lite") + # the model is pushed to ./lite_naive_model + adb -s emulator-${port} push ${naive_model_path} ${workspace} + adb -s emulator-${port} push $api_test_path ${workspace} + + # test cxx_api first to store the optimized model. + adb -s emulator-${port} shell ./test_apis_lite --model_dir ./lite_naive_model --optimized_model ./lite_naive_model_opt +} + + # Build the code and run lite arm tests. This is executed in the CI system. function build_test_arm { ######################################################################## diff --git a/paddle/fluid/lite/utils/io.h b/paddle/fluid/lite/utils/io.h index 29044d580..86161a4b1 100644 --- a/paddle/fluid/lite/utils/io.h +++ b/paddle/fluid/lite/utils/io.h @@ -38,7 +38,7 @@ static void MkDirRecur(const std::string& path) { CHECK_EQ(system(string_format("mkdir -p %s", path.c_str()).c_str()), 0) << "Cann't mkdir " << path; #else // On ARM - CHECK_NE(mkddir(path.c_str(), S_IRWXU), -1) << "Cann't mkdir " << path; + CHECK_NE(mkdir(path.c_str(), S_IRWXU), -1) << "Cann't mkdir " << path; #endif } -- GitLab