From de951a946f50bf6e110075300348bc08c723ec63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Tue, 7 Apr 2020 18:27:41 +0800 Subject: [PATCH] change the cmake and apis of lite engine, test=release/1.7 (#22935) * change the cmake and apis of lite engine, test=develop * change the cmake of lite engine, test=develop --- cmake/external/lite.cmake | 7 ++++++- paddle/fluid/pybind/inference_api.cc | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cmake/external/lite.cmake b/cmake/external/lite.cmake index 2617bdd834..323a8ddc72 100644 --- a/cmake/external/lite.cmake +++ b/cmake/external/lite.cmake @@ -24,6 +24,10 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) set(LITE_SOURCES_DIR ${THIRD_PARTY_PATH}/lite) set(LITE_INSTALL_DIR ${THIRD_PARTY_PATH}/install/lite) + if(NOT LITE_GIT_TAG) + set(LITE_GIT_TAG 34c29406c27ee00cef033a98887403443eb2565f) + endif() + # No quotes, so cmake can resolve it as a command with arguments. set(LITE_BUILD_COMMAND $(MAKE) publish_inference -j) set(LITE_OPTIONAL_ARGS -DWITH_MKL=ON @@ -38,13 +42,14 @@ if (NOT LITE_SOURCE_DIR OR NOT LITE_BINARY_DIR) -DLITE_BUILD_EXTRA=ON -DCUDNN_ROOT=${CUDNN_ROOT} -DLITE_WITH_STATIC_CUDA=OFF + -DCUDA_ARCH_NAME=${CUDA_ARCH_NAME} -DLITE_WITH_ARM=OFF) ExternalProject_Add( ${LITE_PROJECT} ${EXTERNAL_PROJECT_LOG_ARGS} GIT_REPOSITORY "https://github.com/PaddlePaddle/Paddle-Lite.git" - GIT_TAG 0f875ef367bd2dbfa2e557eb2a2fc841bacdf6cf + GIT_TAG ${LITE_GIT_TAG} PREFIX ${LITE_SOURCES_DIR} UPDATE_COMMAND "" BUILD_COMMAND ${LITE_BUILD_COMMAND} diff --git a/paddle/fluid/pybind/inference_api.cc b/paddle/fluid/pybind/inference_api.cc index 46babdcc6e..ecf5cb39d5 100644 --- a/paddle/fluid/pybind/inference_api.cc +++ b/paddle/fluid/pybind/inference_api.cc @@ -423,6 +423,11 @@ void BindAnalysisConfig(py::module *m) { py::arg("precision_mode") = AnalysisConfig::Precision::kFloat32, py::arg("use_static") = false, py::arg("use_calib_mode") = true) .def("tensorrt_engine_enabled", &AnalysisConfig::tensorrt_engine_enabled) + .def("enable_lite_engine", &AnalysisConfig::EnableLiteEngine, + py::arg("precision_mode") = AnalysisConfig::Precision::kFloat32, + py::arg("passes_filter") = std::vector(), + py::arg("ops_filter") = std::vector()) + .def("lite_engine_enabled", &AnalysisConfig::lite_engine_enabled) .def("switch_ir_debug", &AnalysisConfig::SwitchIrDebug, py::arg("x") = true) .def("enable_mkldnn", &AnalysisConfig::EnableMKLDNN) -- GitLab