From 72be50ca68c595c684efafccb87b1b4b6d909e9d Mon Sep 17 00:00:00 2001 From: chenzhiyu Date: Thu, 17 Sep 2020 16:16:23 +0800 Subject: [PATCH] add with_musl option --- CMakeLists.txt | 1 + cmake/configure.cmake | 13 +++++++++++++ cmake/external/protobuf.cmake | 6 ++++-- python/paddle/fluid/core.py | 5 +++-- python/paddle/vision/transforms/transforms.py | 2 +- python/requirements.txt | 4 ++-- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fb796103350..7d1e7e41559 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,7 @@ option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF) option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON) option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON) option(WITH_ARM "Compile PaddlePaddle with arm support" OFF) +option(WITH_MUSL "Compile with musl libc instead of gblic" OFF) # PY_VERSION if(NOT PY_VERSION) diff --git a/cmake/configure.cmake b/cmake/configure.cmake index cf458d97706..630c7df5f05 100644 --- a/cmake/configure.cmake +++ b/cmake/configure.cmake @@ -51,6 +51,19 @@ if(WIN32) endif(NOT MSVC) endif(WIN32) +if(WITH_MUSL) + add_definitions(-DPADDLE_WITH_MUSL) + + message(STATUS, "WITH_CRYPTO=OFF, when WITH_MUSL=ON") + SET(WITH_CRYPTO OFF) + + message(STATUS, "WITH_MKL=OFF, when WITH_MUSL=ON") + SET(WITH_MKL OFF) + + message(STATUS, "WITH_GPU=OFF, when WITH_MUSL=ON") + SET(WITH_GPU OFF) +endif() + if(WITH_PSLIB) add_definitions(-DPADDLE_WITH_PSLIB) endif() diff --git a/cmake/external/protobuf.cmake b/cmake/external/protobuf.cmake index 82dd4fa2e8e..f1a22fb8f6b 100644 --- a/cmake/external/protobuf.cmake +++ b/cmake/external/protobuf.cmake @@ -199,7 +199,8 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST) ENDIF() SET(PROTOBUF_REPOSITORY https://github.com/protocolbuffers/protobuf.git) - SET(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546) + #SET(PROTOBUF_TAG 9f75c5aa851cd877fb0d93ccc31b8567a6706546) + SET(PROTOBUF_TAG 2761122b810fe8861004ae785cc3ab39f384d342) cache_third_party(${TARGET_NAME} REPOSITORY ${PROTOBUF_REPOSITORY} @@ -234,7 +235,8 @@ FUNCTION(build_protobuf TARGET_NAME BUILD_FOR_HOST) ) ENDFUNCTION() -SET(PROTOBUF_VERSION 3.1.0) +#SET(PROTOBUF_VERSION 3.1.0) +SET(PROTOBUF_VERSION 3.5.0) IF(NOT PROTOBUF_FOUND) build_protobuf(extern_protobuf FALSE) diff --git a/python/paddle/fluid/core.py b/python/paddle/fluid/core.py index a05aa3b0a84..5abfe1ed85d 100644 --- a/python/paddle/fluid/core.py +++ b/python/paddle/fluid/core.py @@ -201,7 +201,8 @@ def pre_load(dso_name): def get_glibc_ver(): - return run_shell_command("ldd --version | awk '/ldd/{print $NF}'") + return "musl_" + run_shell_command("ldd 2>&1 | awk '/Version/{print $NF}'") + #return run_shell_command("ldd --version | awk '/ldd/{print $NF}'") def less_than_ver(a, b): @@ -226,7 +227,7 @@ def less_than_ver(a, b): # For paddle, the problem is that 'libgomp' is a DSO with static TLS, and it is loaded after 14 DSOs. # So, here is a tricky way to solve the problem by pre load 'libgomp' before 'core_avx.so'. # The final solution is to upgrade glibc to > 2.22 on the target system. -if platform.system().lower() == 'linux' and less_than_ver(get_glibc_ver(), +if platform.system().lower() == 'linux' and False and less_than_ver(get_glibc_ver(), '2.23'): try: pre_load('libgomp') diff --git a/python/paddle/vision/transforms/transforms.py b/python/paddle/vision/transforms/transforms.py index 14809e0c1ac..2fa160ef25d 100644 --- a/python/paddle/vision/transforms/transforms.py +++ b/python/paddle/vision/transforms/transforms.py @@ -122,7 +122,7 @@ class BatchCompose(object): Args: transforms (list): List of transforms to compose. these transforms perform on batch data. - + Examples: .. code-block:: python diff --git a/python/requirements.txt b/python/requirements.txt index c8d3b2af179..a83261d5963 100644 --- a/python/requirements.txt +++ b/python/requirements.txt @@ -4,10 +4,10 @@ numpy>=1.13, <=1.16.4 ; python_version<"3.5" numpy>=1.13 ; python_version>="3.5" protobuf>=3.1.0 gast==0.3.3 -matplotlib<=2.2.4 ; python_version<"3.6" +#matplotlib<=2.2.4 ; python_version<"3.6" scipy>=0.19.0, <=1.2.1 ; python_version<"3.5" nltk>=3.2.2, <=3.4 ; python_version<"3.5" -matplotlib<=3.2.1 ; python_version>="3.6" +#matplotlib<=3.2.1 ; python_version>="3.6" scipy<=1.3.1 ; python_version=="3.5" scipy ; python_version>"3.5" nltk ; python_version>="3.5" -- GitLab