提交 e5a76c98 编写于 作者: Y Yan Chunwei 提交者: GitHub

leave tiny-publish out of third-party dependencies (#1853)

上级 6ba3869b
[submodule "third-party/gflags"]
path = third-party/gflags
url = https://github.com/gflags/gflags.git
[submodule "third-party/googletest"]
path = third-party/googletest
url = https://github.com/google/googletest.git
[submodule "third-party/protobuf-mobile"]
path = third-party/protobuf-mobile
url = https://github.com/tensor-tang/protobuf.git
[submodule "third-party/protobuf-host"]
path = third-party/protobuf-host
url = https://github.com/protocolbuffers/protobuf.git
......@@ -95,7 +95,7 @@ endif()
# check options
if (LITE_ON_TINY_PUBLISH)
if (NOT (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND NOT WITH_TESTING))#LITE_WITH_JAVA AND
if (NOT (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND NOT WITH_TESTING))#LITE_WITH_JAVA AND
message(FATAL_ERROR "LITE_ON_TINY_PUBLISH=ON must be used with WITH_LITE=ON LITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON LITE_WITH_JAVA=ON WITH_TESTING=OFF")
return()
endif()
......@@ -109,16 +109,15 @@ if (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
include(cross_compiling/postproject)
include(cross_compiling/npu) # check and prepare NPU DDK
# include the necessary thirdparty dependencies
include(external/gflags) # download, build, install gflags
# LITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON will disable glog
# TODO(sangoly): refine WITH_LITE and LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
#include(external/glog) # download, build, install glog
include(external/gtest) # download, build, install gtest
include(ccache) # set ccache for compilation
# We compile the mobile deployment library when LITE_ON_TINY_PUBLISH=ON
# So the following third party dependencies are not needed.
if (NOT LITE_ON_TINY_PUBLISH)
# include the necessary thirdparty dependencies
include(external/gflags) # download, build, install gflags
# LITE_WITH_LIGHT_WEIGHT_FRAMEWORK=ON will disable glog
# TODO(sangoly): refine WITH_LITE and LITE_WITH_LIGHT_WEIGHT_FRAMEWORK
include(external/gtest) # download, build, install gtest
include(ccache) # set ccache for compilation
include(external/protobuf) # download, build, install protobuf
endif()
......@@ -134,6 +133,7 @@ if (WITH_LITE AND LITE_WITH_LIGHT_WEIGHT_FRAMEWORK)
add_subdirectory(lite)
return()
endif()
################################# End of mobile compile ##############################
set(WITH_MKLML ${WITH_MKL})
if (NOT DEFINED WITH_MKLDNN)
......
......@@ -51,7 +51,6 @@ Paddle Lite 借鉴了以下开源项目:
- [ARM compute library]((https://github.com/ARM-software/ComputeLibrary))
- [Anakin](https://github.com/PaddlePaddle/Anakin) ,Anakin对应底层的一些优化实现已被集成到Paddle Lite。Anakin作为PaddlePaddle组织下的一个高性能预测项目,极具前瞻性,对Paddle Lite有重要贡献。Anakin已和本项目实现整合。之后,Anakin不再升级。
## 交流与反馈
* 欢迎您通过Github Issues来提交问题、报告与建议
* QQ群: 696965088
......
......@@ -5,8 +5,8 @@ SET(EIGEN_INCLUDE_DIR ${EIGEN_SOURCE_DIR}/src/extern_eigen3)
INCLUDE_DIRECTORIES(${EIGEN_INCLUDE_DIR})
if(NOT WITH_FAST_MATH)
# EIGEN_FAST_MATH: https://eigen.tuxfamily.org/dox/TopicPreprocessorDirectives.html
# enables some optimizations which might affect the accuracy of the result.
# This currently enables the SSE vectorization of sin() and cos(),
# enables some optimizations which might affect the accuracy of the result.
# This currently enables the SSE vectorization of sin() and cos(),
# and speedups sqrt() for single precision.
# Defined to 1 by default. Define it to 0 to disable.
add_definitions(-DEIGEN_FAST_MATH=0)
......
......@@ -14,7 +14,7 @@
INCLUDE(ExternalProject)
SET(GFLAGS_SOURCES_DIR ${THIRD_PARTY_PATH}/gflags)
SET(GFLAGS_SOURCES_DIR ${CMAKE_SOURCE_DIR}/third-party/gflags)
SET(GFLAGS_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gflags)
SET(GFLAGS_INCLUDE_DIR "${GFLAGS_INSTALL_DIR}/include" CACHE PATH "gflags include directory." FORCE)
IF(WIN32)
......@@ -37,9 +37,10 @@ SET(OPTIONAL_ARGS "-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
ExternalProject_Add(
extern_gflags
${EXTERNAL_PROJECT_LOG_ARGS}
GIT_REPOSITORY "https://github.com/gflags/gflags.git"
GIT_REPOSITORY ""
GIT_TAG 77592648e3f3be87d6c7123eb81cbad75f9aef5a
PREFIX ${GFLAGS_SOURCES_DIR}
SOURCE_DIR ${GFLAGS_SOURCES_DIR}
PREFIX ${GFLAGS_INCLUDE_DIR}
UPDATE_COMMAND ""
CMAKE_ARGS -DBUILD_STATIC_LIBS=ON
-DCMAKE_INSTALL_PREFIX=${GFLAGS_INSTALL_DIR}
......
......@@ -12,15 +12,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#FIXME:(gongwb) Move brpc's gtest dependency.
IF(WITH_TESTING OR (WITH_DISTRIBUTE AND NOT WITH_GRPC))
# the gtest is only used when WITH_TESTING=ON
IF(WITH_TESTING)
IF(WITH_TESTING)
ENABLE_TESTING()
ENDIF(WITH_TESTING)
INCLUDE(ExternalProject)
SET(GTEST_SOURCES_DIR ${THIRD_PARTY_PATH}/gtest)
SET(GTEST_SOURCES_DIR ${CMAKE_SOURCE_DIR}/third-party/googletest)
SET(GTEST_INSTALL_DIR ${THIRD_PARTY_PATH}/install/gtest)
SET(GTEST_INCLUDE_DIR "${GTEST_INSTALL_DIR}/include" CACHE PATH "gtest include directory." FORCE)
......@@ -56,9 +56,10 @@ IF(WITH_TESTING OR (WITH_DISTRIBUTE AND NOT WITH_GRPC))
extern_gtest
${EXTERNAL_PROJECT_LOG_ARGS}
DEPENDS ${GTEST_DEPENDS}
GIT_REPOSITORY "https://github.com/google/googletest.git"
GIT_REPOSITORY ""
SOURCE_DIR ${GTEST_SOURCES_DIR}
GIT_TAG "release-1.8.0"
PREFIX ${GTEST_SOURCES_DIR}
PREFIX ${GTEST_INSTALL_DIR}
UPDATE_COMMAND ""
CMAKE_ARGS ${CROSS_COMPILE_CMAKE_ARGS}
${OPTIONAL_ARGS}
......@@ -82,4 +83,4 @@ IF(WITH_TESTING OR (WITH_DISTRIBUTE AND NOT WITH_GRPC))
SET_PROPERTY(TARGET gtest_main PROPERTY IMPORTED_LOCATION ${GTEST_MAIN_LIBRARIES})
ADD_DEPENDENCIES(gtest_main extern_gtest)
ENDIF(WITH_TESTING OR (WITH_DISTRIBUTE AND NOT WITH_GRPC))
ENDIF()
......@@ -177,10 +177,12 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
"${PROTOBUF_INSTALL_DIR}/bin/protoc${CMAKE_EXECUTABLE_SUFFIX}"
PARENT_SCOPE)
SET(PROTOBUF_REPO "https://github.com/protocolbuffers/protobuf.git")
# https://github.com/protocolbuffers/protobuf.git
SET(PROTOBUF_REPO "")
SET(PROTOBUF_TAG "9f75c5aa851cd877fb0d93ccc31b8567a6706546")
SET(OPTIONAL_CACHE_ARGS "")
SET(OPTIONAL_ARGS "")
SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/protobuf-host")
IF(BUILD_FOR_HOST)
SET(OPTIONAL_ARGS
......@@ -191,8 +193,10 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
SET(OPTIONAL_CACHE_ARGS "-DZLIB_ROOT:STRING=${ZLIB_ROOT}")
ELSE()
# protobuf have compile issue when use android stl c++_static
SET(PROTOBUF_REPO "https://github.com/tensor-tang/protobuf.git")
# https://github.com/tensor-tang/protobuf.git
SET(PROTOBUF_REPO "")
SET(PROTOBUF_TAG "mobile")
SET(SOURCE_DIR "${CMAKE_SOURCE_DIR}/third-party/protobuf-mobile")
SET(OPTIONAL_ARGS "-Dprotobuf_WITH_ZLIB=OFF"
${CROSS_COMPILE_CMAKE_ARGS}
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
......@@ -215,8 +219,9 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
PREFIX ${PROTOBUF_SOURCES_DIR}
SOURCE_SUBDIR cmake
UPDATE_COMMAND ""
GIT_REPOSITORY ${PROTOBUF_REPO}
GIT_REPOSITORY ""
GIT_TAG ${PROTOBUF_TAG}
SOURCE_DIR ${SOURCE_DIR}
CMAKE_ARGS
${OPTIONAL_ARGS}
-Dprotobuf_BUILD_TESTS=OFF
......@@ -237,12 +242,12 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST)
ExternalProject_Add(
${TARGET_NAME}
${EXTERNAL_PROJECT_LOG_ARGS}
PREFIX ${PROTOBUF_SOURCES_DIR}
PREFIX ${SOURCE_DIR}
UPDATE_COMMAND ""
GIT_REPOSITORY ${PROTOBUF_REPO}
GIT_REPOSITORY ""
GIT_TAG ${PROTOBUF_TAG}
CONFIGURE_COMMAND
${CMAKE_COMMAND} ${PROTOBUF_SOURCES_DIR}/src/${TARGET_NAME}/cmake
SOURCE_DIR ${SOURCE_DIR}
CONFIGURE_COMMAND ${CMAKE_COMMAND} ${SOURCE_DIR}/cmake
${OPTIONAL_ARGS}
-Dprotobuf_BUILD_TESTS=OFF
-DCMAKE_SKIP_RPATH=ON
......
......@@ -368,7 +368,7 @@ function(bundle_static_library tgt_name bundled_tgt_name fake_target)
set(bundled_tgt_full_name
${CMAKE_BINARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}${bundled_tgt_name}${CMAKE_STATIC_LIBRARY_SUFFIX})
message(STATUS "+++++ bundled_tgt_full_name: ${bundled_tgt_full_name}")
#message(STATUS "bundled_tgt_full_name: ${bundled_tgt_full_name}")
if(NOT IOS)
file(WRITE ${CMAKE_BINARY_DIR}/${bundled_tgt_name}.ar.in
......
......@@ -10,7 +10,6 @@ message(STATUS "LITE_WITH_FPGA:\t${LITE_WITH_FPGA}")
message(STATUS "LITE_WITH_PROFILE:\t${LITE_WITH_PROFILE}")
set(LITE_MODEL_DIR "${THIRD_PARTY_PATH}/install")
set(LITE_ON_MOBILE ${LITE_WITH_LIGHT_WEIGHT_FRAMEWORK})
add_subdirectory(utils)
......
......@@ -128,7 +128,7 @@ if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND WITH_TESTING)
set_target_properties(test_mobilenetv2 PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
lite_cc_test(test_resnet50 SRCS resnet50_test.cc
DEPS ${lite_model_test_DEPS}
DEPS ${lite_model_test_DEPS} paddle_api_light
CL_DEPS ${opencl_kernels}
FPGA_DEPS ${fpga_kernels}
ARGS --cl_path=${CMAKE_SOURCE_DIR}/lite/opencl
......@@ -145,7 +145,7 @@ if(LITE_WITH_LIGHT_WEIGHT_FRAMEWORK AND WITH_TESTING)
CL_DEPS ${opencl_kernels}
ARGS --cl_path=${CMAKE_SOURCE_DIR}/lite/opencl
--model_dir=${LITE_MODEL_DIR}/inception_v4 SERIAL)
add_dependencies(test_inceptionv4 extern_lite_download_inception_v4_simple_tar_gz)
add_dependencies(test_inceptionv4 extern_lite_download_inception_v4_simple_tar_gz)
# lite_cc_test(test_ocr_attention SRCS ocr_attention_test.cc
# DEPS ${lite_model_test_DEPS})
......
......@@ -39,7 +39,7 @@ class LightPredictorImpl : public PaddlePredictor {
};
void LightPredictorImpl::Init(const MobileConfig& config) {
// LightPredictor Only support NaiveBuffer backend in publish lib
// LightPredictor Only support NaiveBuffer backend in publish lib
#ifdef LITE_WITH_ARM
lite::DeviceInfo::Init();
lite::DeviceInfo::Global().SetRunMode(config.power_mode(), config.threads());
......
......@@ -113,9 +113,14 @@ class LITE_API CxxConfig : public ConfigBase {
class LITE_API MobileConfig : public ConfigBase {
PowerMode mode_{LITE_POWER_HIGH};
int threads_{1};
public:
MobileConfig(Place preferred_place=Place(TARGET(kARM), PRECISION(kFloat), DATALAYOUT(kNCHW)),
PowerMode mode=LITE_POWER_HIGH, int threads=1) : mode_(mode), threads_(threads) {}
public:
MobileConfig(Place preferred_place = Place(TARGET(kARM),
PRECISION(kFloat),
DATALAYOUT(kNCHW)),
PowerMode mode = LITE_POWER_HIGH,
int threads = 1)
: mode_(mode), threads_(threads) {}
void set_power_mode(PowerMode mode) { mode_ = mode; }
void set_threads(int threads) { threads_ = threads; }
......
......@@ -70,13 +70,14 @@ enum class DataLayoutType : int {
kAny = 2, // any data layout
NUM = 4, // number of fields.
};
typedef enum {
LITE_POWER_HIGH = 0,
LITE_POWER_LOW = 1,
LITE_POWER_FULL = 2,
LITE_POWER_NO_BIND = 3,
LITE_POWER_RAND_HIGH = 4,
LITE_POWER_RAND_LOW = 5
LITE_POWER_HIGH = 0,
LITE_POWER_LOW = 1,
LITE_POWER_FULL = 2,
LITE_POWER_NO_BIND = 3,
LITE_POWER_RAND_HIGH = 4,
LITE_POWER_RAND_LOW = 5
} PowerMode;
enum class ActivationType : int {
......
......@@ -27,8 +27,6 @@ namespace lite {
#ifdef LITE_WITH_ARM
TEST(ResNet18, test) {
DeviceInfo::Init();
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH, FLAGS_threads);
lite::Predictor predictor;
std::vector<Place> valid_places({Place{TARGET(kHost), PRECISION(kFloat)},
Place{TARGET(kARM), PRECISION(kFloat)}});
......
......@@ -827,7 +827,7 @@ void DeviceInfo::RequestPowerHighMode(int thread_num) {
int little_core_size = little_core_ids_.size();
active_ids_.clear();
if (big_core_size > 0) {
mode_ =lite_api::PowerMode::LITE_POWER_HIGH;
mode_ = lite_api::PowerMode::LITE_POWER_HIGH;
if (thread_num > big_core_size) {
LOG(ERROR) << "Request thread num: " << thread_num
<< ", exceed the big cores size: " << big_core_size
......@@ -1031,7 +1031,8 @@ int DeviceInfo::Setup() {
}
LOG(INFO) << "Total memory: " << mem_size_ << "KB";
// set default run mode
SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND, 1); // use single thread by default
SetRunMode(lite_api::PowerMode::LITE_POWER_NO_BIND,
1); // use single thread by default
return 0;
}
......
......@@ -31,4 +31,4 @@ if(LITE_WITH_NPU)
endif()
set(subgraph_passes ${subgraph_passes} CACHE INTERNAL "subgraph_passes")
message(STATUS "+++++ subgraph_passes: ${subgraph_passes}")
message(STATUS "----> subgraph_passes: ${subgraph_passes}")
if (LITE_WITH_X86)
lite_cc_library(fluid_data_type SRCS data_type.cc DEPS framework_proto)
lite_cc_library(fluid_data_type SRCS data_type.cc DEPS framework_proto eigen3)
# lite_cc_library(selected_rows SRCS selected_rows.cc)
endif()
......@@ -43,10 +43,10 @@ add_kernel(squeeze_compute_arm ARM basic SRCS squeeze_compute.cc DEPS ${lite_ker
add_kernel(expand_compute_arm ARM basic SRCS expand_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(reduce_max_compute_arm ARM basic SRCS reduce_max_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(sequence_expand_compute_arm ARM basic SRCS sequence_expand_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(im2sequence_compute_arm ARM basic SRCS im2sequence_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(sequence_pool_compute_arm ARM basic SRCS sequence_pool_compute.cc DEPS ${lite_kernel_deps} math_arm)
# for OCR specific
add_kernel(im2sequence_compute_arm ARM extra SRCS im2sequence_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(sequence_pool_compute_arm ARM extra SRCS sequence_pool_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(gru_unit_compute_arm ARM extra SRCS gru_unit_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(gru_compute_arm ARM extra SRCS gru_compute.cc DEPS ${lite_kernel_deps} math_arm)
add_kernel(beam_search_decode_compute_arm ARM extra SRCS beam_search_decode_compute.cc DEPS ${lite_kernel_deps} math_arm)
......
......@@ -58,9 +58,9 @@ add_operator(norm_op basic SRCS norm_op.cc DEPS ${op_DEPS})
add_operator(shape_op_lite basic SRCS shape_op.cc DEPS ${op_DEPS})
add_operator(sequence_expand_op_lite basic SRCS sequence_expand_op.cc DEPS ${op_DEPS})
add_operator(squeeze_op_lite basic SRCS squeeze_op.cc DEPS ${op_DEPS})
add_operator(im2sequence_op basic SRCS im2sequence_op.cc DEPS ${op_DEPS})
# for OCR specific
add_operator(im2sequence_op extra SRCS im2sequence_op.cc DEPS ${op_DEPS})
add_operator(while_op extra SRCS while_op.cc DEPS ${op_DEPS})
add_operator(lookup_table_op extra SRCS lookup_table_op.cc DEPS ${op_DEPS})
add_operator(beam_search_decode_op extra SRCS beam_search_decode_op.cc DEPS ${op_DEPS})
......
......@@ -58,6 +58,8 @@ function make_full_publish_so {
local lang=$3
local android_stl=$4
git submodule update --init --recursive
cur_dir=$(pwd)
build_dir=$cur_dir/build.lite.${os}.${abi}.${lang}
if [ -d $build_dir ]
......@@ -85,6 +87,7 @@ function make_all_tests {
local abi=$2
local lang=$3
git submodule update --init --recursive
cur_dir=$(pwd)
build_dir=$cur_dir/build.lite.${os}.${abi}.${lang}
if [ -d $build_dir ]
......@@ -106,6 +109,7 @@ function make_all_tests {
function print_usage {
set +x
echo -e "\nUSAGE:"
echo
echo "----------------------------------------"
......
......@@ -22,6 +22,9 @@ function prepare_workspace {
DEBUG_TOOL_PATH_PREFIX=lite/tools/debug
mkdir -p ./${DEBUG_TOOL_PATH_PREFIX}
cp ../${DEBUG_TOOL_PATH_PREFIX}/analysis_tool.py ./${DEBUG_TOOL_PATH_PREFIX}/
# clone submodule
git submodule update --init --recursive
}
function check_need_ci {
......
......@@ -33,7 +33,8 @@ void Run(DebugConfig* conf) {
CHECK(conf);
#ifdef LITE_WITH_ARM
DeviceInfo::Init();
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH, conf->arm_thread_num);
DeviceInfo::Global().SetRunMode(lite_api::LITE_POWER_HIGH,
conf->arm_thread_num);
#endif
lite::Predictor predictor;
std::vector<Place> valid_places({
......
......@@ -18,13 +18,13 @@
*/
#pragma once
#include <assert.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <cstdlib>
#include <cstring>
#include <string>
#include <assert.h>
#include "lite/utils/replace_stl/stream.h"
// NOLINTFILE()
......
......@@ -16,7 +16,7 @@ function(math_library TARGET)
endif()
list(LENGTH cc_srcs cc_srcs_len)
lite_cc_library(${TARGET} SRCS ${cc_srcs} DEPS ${math_library_DEPS} ${math_common_deps})
lite_cc_library(${TARGET} SRCS ${cc_srcs} DEPS ${math_library_DEPS} ${math_common_deps} eigen3)
endfunction()
# please add new math_library in alphabetical order
......@@ -32,7 +32,7 @@ math_library(sampler)
math_library(gru_compute DEPS activation_functions math_function)
## math_library(lstm_compute DEPS activation_functions)
lite_cc_library(blas SRCS blas.cc DEPS cblas framework_proto)
lite_cc_library(blas SRCS blas.cc DEPS cblas framework_proto eigen3)
math_library(math_function DEPS blas)
math_library(maxouting)
math_library(pooling)
......
Subproject commit 77592648e3f3be87d6c7123eb81cbad75f9aef5a
Subproject commit ec44c6c1675c25b9827aacd08c02433cccde7780
Subproject commit 9f75c5aa851cd877fb0d93ccc31b8567a6706546
Subproject commit 0bccaabfc6fda5b04d7460110ae075b7eebe9d2a
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册