diff --git a/paddle/fluid/lite/api/CMakeLists.txt b/paddle/fluid/lite/api/CMakeLists.txt index 044bb902df1555dd3e08ec9880b16a2d70c2d40e..ea74ed317e4d548091cbdae96736e9160482df71 100644 --- a/paddle/fluid/lite/api/CMakeLists.txt +++ b/paddle/fluid/lite/api/CMakeLists.txt @@ -108,9 +108,12 @@ lite_cc_library(paddle_api_light SRCS paddle_api.cc DEPS light_api_impl_lite) lite_cc_test(test_paddle_api_lite SRCS paddle_api_test.cc DEPS cxx_api_lite light_api_lite paddle_api_full + ${ops_lite} + ARM_DEPS ${arm_kernels} + X86_DEPS ${x86_kernels} ARGS --model_dir=${LITE_MODEL_DIR}/lite_naive_model SERIAL) if (WITH_TESTING) - add_dependencies(test_paddle_api_lite test_apis_lite) + add_dependencies(test_paddle_api_lite extern_lite_download_lite_naive_model_tar_gz) endif() #lite_cc_binary(cxx_api_lite_bin SRCS cxx_api_bin.cc diff --git a/paddle/fluid/lite/api/paddle_api_test.cc b/paddle/fluid/lite/api/paddle_api_test.cc index eafdb67d6e893c9aae697b9e199535f014b381ad..87e930b3e8a874e44ce54a211e94f687896d4c33 100644 --- a/paddle/fluid/lite/api/paddle_api_test.cc +++ b/paddle/fluid/lite/api/paddle_api_test.cc @@ -29,7 +29,10 @@ TEST(CxxApi, run) { lite_api::CxxConfig config; config.set_model_dir(FLAGS_model_dir); config.set_preferred_place(Place{TARGET(kX86), PRECISION(kFloat)}); - config.set_valid_places({Place{TARGET(kX86), PRECISION(kFloat)}}); + config.set_valid_places({ + Place{TARGET(kX86), PRECISION(kFloat)}, + Place{TARGET(kARM), PRECISION(kFloat)}, + }); auto predictor = lite_api::CreatePaddlePredictor(config); diff --git a/paddle/fluid/lite/tools/build.sh b/paddle/fluid/lite/tools/build.sh index 7a2ad12555c7415aa146d28ea1bc2992bd0ff96f..3630f9da7d443b66ad763c00ebb9cc536ce09fe9 100755 --- a/paddle/fluid/lite/tools/build.sh +++ b/paddle/fluid/lite/tools/build.sh @@ -134,14 +134,26 @@ function test_arm_android { local testpath=$(find ./paddle/fluid -name ${test_name}) - # if [[ "$test_name" == "test_light_api" ]]; then - # local model_path=$(find . -name "lite_naive_model") - # arm_push_necessary_file $port $model_path $adb_work_dir - # fi + adb -s emulator-${port} push ${testpath} ${adb_work_dir} + adb -s emulator-${port} shell "${adb_work_dir}/${test_name}" +} + +# test the inference high level api +function test_arm_api { + local port=$1 + local test_name="test_paddle_api_lite" + + make $test_name -j$NUM_CORES_FOR_COMPILE + + local model_path=$(find . -name "lite_naive_model") + local remote_model=${adb_work_dir}/paddle_api + local testpath=$(find ./paddle/fluid -name ${test_name}) + arm_push_necessary_file $port $model_path $remote_model + adb -s emulator-${port} shell mkdir -p $remote_model adb -s emulator-${port} push ${testpath} ${adb_work_dir} adb -s emulator-${port} shell chmod +x "${adb_work_dir}/${test_name}" - adb -s emulator-${port} shell "./${adb_work_dir}/${test_name}" + adb -s emulator-${port} shell "${adb_work_dir}/${test_name} --model_dir $remote_model" } function test_arm_model { @@ -253,11 +265,14 @@ function test_arm { echo "android do not need armv7hf" return 0 fi - + echo "test file: ${TESTS_FILE}" for _test in $(cat $TESTS_FILE); do test_arm_android $_test $port done + + # test finally + test_arm_api $port } function prepare_emulator {