Skip to content

Commit e674a5d

Browse files
authored
Merge pull request #6 from PaddlePaddle/develop
update Paddle USERNAME repo
2 parents a1d92b7 + 1adc09b commit e674a5d

File tree

610 files changed

+21508
-5312
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

610 files changed

+21508
-5312
lines changed

.pre-commit-config.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,3 @@ repos:
5050
language: system
5151
files: \.(c|cc|cxx|cpp|cu|h|hpp|hxx|proto|py|sh)$
5252
exclude: (?!.*third_party)^.*$ | (?!.*book)^.*$
53-
- repo: local
54-
hooks:
55-
- id: shellcheck
56-
name: shellcheck
57-
entry: shellcheck
58-
language: system
59-
files: .sh$
60-
exclude: (paddle_build.sh|fast_install.sh|check_file_diff_approvals.sh)

CMakeLists.txt

Lines changed: 30 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ else(WIN32)
9898
endif(WIN32)
9999

100100
find_package(Git REQUIRED)
101+
102+
# config GIT_URL with github mirrors to speed up dependent repos clone
103+
option(GIT_URL "Git URL to clone dependent repos" ${GIT_URL})
104+
if(NOT GIT_URL)
105+
set(GIT_URL "https://github.com")
106+
endif()
107+
101108
find_package(Threads REQUIRED)
102109

103110
include(simd)
@@ -131,6 +138,7 @@ option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF)
131138
option(WITH_NCCL "Compile PaddlePaddle with NCCL support" ON)
132139
option(WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON)
133140
option(WITH_ARM "Compile PaddlePaddle with arm support" OFF)
141+
option(WITH_SW "Compile PaddlePaddle with sw support" OFF)
134142
option(WITH_MUSL "Compile with musl libc instead of gblic" OFF)
135143

136144
# PY_VERSION
@@ -193,10 +201,19 @@ if(WITH_BRPC_RDMA)
193201
endif()
194202
endif()
195203

196-
# lite subgraph compilation depends on CUDNN_ROOT,
197-
# so include(cudnn) needs to be in front of include(third_party/lite)
198-
include(cudnn) # set cudnn libraries, must before configure
199-
include(third_party) # download, build, install third_party
204+
if(WITH_GPU)
205+
include(cuda)
206+
# lite subgraph compilation depends on CUDNN_ROOT,
207+
# so include(cudnn) needs to be in front of include(third_party/lite)
208+
include(cudnn) # set cudnn libraries, must before configure
209+
include(tensorrt)
210+
# there is no official support of nccl, cupti in windows
211+
if(NOT WIN32)
212+
include(cupti)
213+
endif()
214+
endif()
215+
216+
include(third_party) # download, build, install third_party, Contains about 20+ dependencies
200217

201218
if(WITH_DISTRIBUTE)
202219
if(WITH_GRPC)
@@ -209,18 +226,8 @@ if(WITH_DISTRIBUTE)
209226
endif()
210227
endif()
211228

212-
# there is no official support of nccl, cupti in windows
213-
if(NOT WIN32)
214-
include(cupti)
215-
endif()
216-
217229
include(flags) # set paddle compile flags
218230

219-
if(WITH_GPU)
220-
include(cuda)
221-
include(tensorrt)
222-
endif()
223-
224231
if(WITH_PROFILER)
225232
find_package(Gperftools REQUIRED)
226233
include_directories(${GPERFTOOLS_INCLUDE_DIR})
@@ -251,10 +258,18 @@ if(WITH_ARM)
251258
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
252259
set(WITH_XBYAK OFF CACHE STRING "Disable XBYAK when compiling WITH_ARM=ON" FORCE)
253260
set(WITH_MKL OFF CACHE STRING "Disable MKL when compiling WITH_ARM=ON." FORCE)
254-
set(WITH_GPU OFF CACHE STRING "Disable GPU when compiling WITH_ARM=ON." FORCE)
255261
add_definitions(-DPADDLE_WITH_ARM)
256262
endif()
257263

264+
if (WITH_SW)
265+
# mieee flag solves floating-point exceptions under sw and ALPHA architectures
266+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -mieee")
267+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -mieee")
268+
set(WITH_XBYAK OFF CACHE STRING "Disable XBYAK when compiling WITH_SW=ON" FORCE)
269+
set(WITH_MKL OFF CACHE STRING "Disable MKL when compiling WITH_SW=ON." FORCE)
270+
add_definitions(-DPADDLE_WITH_SW)
271+
endif()
272+
258273
set(PADDLE_PYTHON_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/python/build")
259274

260275
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG")

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,12 @@ RUN pip3 --no-cache-dir install -U wheel py-cpuinfo==5.0.0 && \
156156

157157
RUN pip3 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
158158
pip3 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
159-
pip3 --no-cache-dir install opencv-python && \
160159
pip3.6 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
161160
pip3.6 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
162-
pip3.6 --no-cache-dir install opencv-python && \
163161
pip3.7 --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
164162
pip3.7 --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
165-
pip3.7 --no-cache-dir install opencv-python && \
166163
pip --no-cache-dir install 'pre-commit==1.10.4' 'ipython==5.3.0' && \
167-
pip --no-cache-dir install 'ipykernel==4.6.0' 'jupyter==1.0.0' && \
168-
pip --no-cache-dir install opencv-python
164+
pip --no-cache-dir install 'ipykernel==4.6.0'
169165

170166
#For docstring checker
171167
RUN pip3 --no-cache-dir install pylint pytest astroid isort
@@ -207,7 +203,6 @@ RUN wget --no-check-certificate https://pslib.bj.bcebos.com/openmpi-1.4.5.tar.gz
207203
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH && export PATH=/usr/local/bin:$PATH && cd .. && \
208204
rm -rf openmpi-1.4.5.tar.gz && pip --no-cache-dir install mpi4py && ln -fs /bin/bash /bin/sh && \
209205
apt-get install libprotobuf-dev -y
210-
RUN pip --no-cache-dir install -U netifaces==0.10.9
211206

212207
# Older versions of patchelf limited the size of the files being processed and were fixed in this pr.
213208
# https://github.com/NixOS/patchelf/commit/ba2695a8110abbc8cc6baf0eea819922ee5007fa

cmake/cblas.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ if(NOT DEFINED CBLAS_PROVIDER AND WITH_SYSTEM_BLAS)
101101
${REFERENCE_CBLAS_INCLUDE_SEARCH_PATHS})
102102
find_library(REFERENCE_CBLAS_LIBRARY NAMES cblas PATHS
103103
${REFERENCE_CBLAS_LIB_SEARCH_PATHS})
104+
find_library(REFERENCE_BLAS_LIBRARY NAMES blas PATHS
105+
${REFERENCE_CBLAS_LIB_SEARCH_PATHS})
104106

105107
if(REFERENCE_CBLAS_INCLUDE_DIR AND REFERENCE_CBLAS_LIBRARY)
106108
set(CBLAS_PROVIDER REFERENCE_CBLAS)
@@ -125,7 +127,9 @@ endif()
125127
# linear algebra libraries for cc_library(xxx SRCS xxx.c DEPS cblas)
126128

127129
include_directories(${CBLAS_INC_DIR})
128-
if(NOT ${CBLAS_PROVIDER} STREQUAL MKLML)
130+
if(${CBLAS_PROVIDER} STREQUAL REFERENCE_CBLAS)
131+
target_link_libraries(cblas gfortran ${CBLAS_LIBRARIES} ${REFERENCE_BLAS_LIBRARY})
132+
elseif(NOT ${CBLAS_PROVIDER} STREQUAL MKLML)
129133
target_link_libraries(cblas ${CBLAS_LIBRARIES})
130134
endif()
131135

cmake/cuda.cmake

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ function(detect_installed_gpus out_variable)
6262
if(NOT CUDA_gpu_detect_output)
6363
message(STATUS "Automatic GPU detection failed. Building for all known architectures.")
6464
set(${out_variable} ${paddle_known_gpu_archs} PARENT_SCOPE)
65-
#Todo: fix Automatic GPU detection failed on windows
66-
if(WIN32)
67-
set(${out_variable} "61 75" PARENT_SCOPE)
68-
endif()
6965
else()
7066
set(${out_variable} ${CUDA_gpu_detect_output} PARENT_SCOPE)
7167
endif()
@@ -198,7 +194,9 @@ elseif (${CMAKE_CUDA_COMPILER_VERSION} LESS 12.0) # CUDA 11.x
198194
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -D__STRICT_ANSI__")
199195
endif()
200196

201-
add_definitions("-DPADDLE_CUDA_BINVER=\"${CUDA_VERSION_MAJOR}${CUDA_VERSION_MINOR}\"")
197+
add_definitions("-DCUDA_VERSION_MAJOR=\"${CUDA_VERSION_MAJOR}\"")
198+
add_definitions("-DCUDA_VERSION_MINOR=\"${CUDA_VERSION_MINOR}\"")
199+
add_definitions("-DCUDA_TOOLKIT_ROOT_DIR=\"${CUDA_TOOLKIT_ROOT_DIR}\"")
202200

203201
# setting nvcc arch flags
204202
select_nvcc_arch_flags(NVCC_FLAGS_EXTRA)
@@ -249,3 +247,4 @@ endif()
249247

250248
mark_as_advanced(CUDA_BUILD_CUBIN CUDA_BUILD_EMULATION CUDA_VERBOSE_BUILD)
251249
mark_as_advanced(CUDA_SDK_ROOT_DIR CUDA_SEPARABLE_COMPILATION)
250+

cmake/cudnn.cmake

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,18 @@ list(APPEND CUDNN_CHECK_LIBRARY_DIRS
3535
${CUDA_TOOLKIT_ROOT_DIR}/lib/x64
3636
)
3737
set(CUDNN_LIB_NAME "")
38+
3839
if (LINUX)
39-
set(CUDNN_LIB_NAME "libcudnn.so")
40+
set(CUDNN_LIB_NAME "libcudnn.so")
4041
endif(LINUX)
4142

4243
if(WIN32)
43-
# only support cudnn7
44-
set(CUDNN_LIB_NAME "cudnn.lib" "cudnn64_7.dll")
44+
# only support cudnn7
45+
set(CUDNN_LIB_NAME "cudnn.lib" "cudnn64_7.dll")
4546
endif(WIN32)
4647

4748
if(APPLE)
48-
set(CUDNN_LIB_NAME "libcudnn.dylib" "libcudnn.so")
49+
set(CUDNN_LIB_NAME "libcudnn.dylib" "libcudnn.so")
4950
endif(APPLE)
5051

5152
find_library(CUDNN_LIBRARY NAMES ${CUDNN_LIB_NAME} # libcudnn_static.a
@@ -88,7 +89,7 @@ macro(find_cudnn_version cudnn_header_file)
8889
if(NOT CUDNN_MAJOR_VERSION)
8990
set(CUDNN_VERSION "???")
9091
else()
91-
add_definitions("-DPADDLE_CUDNN_BINVER=\"${CUDNN_MAJOR_VERSION}\"")
92+
add_definitions("-DCUDNN_MAJOR_VERSION=\"${CUDNN_MAJOR_VERSION}\"")
9293
math(EXPR CUDNN_VERSION
9394
"${CUDNN_MAJOR_VERSION} * 1000 +
9495
${CUDNN_MINOR_VERSION} * 100 + ${CUDNN_PATCHLEVEL_VERSION}")

cmake/cupti.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ find_path(CUPTI_INCLUDE_DIR cupti.h
88
PATHS ${CUPTI_ROOT} ${CUPTI_ROOT}/include
99
$ENV{CUPTI_ROOT} $ENV{CUPTI_ROOT}/include
1010
${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/include
11+
${CUDA_TOOLKIT_ROOT_DIR}/targets/x86_64-linux/include
1112
NO_DEFAULT_PATH
1213
)
1314

@@ -27,6 +28,7 @@ list(APPEND CUPTI_CHECK_LIBRARY_DIRS
2728
$ENV{CUPTI_ROOT}/lib64
2829
$ENV{CUPTI_ROOT}/lib
2930
/usr/lib
31+
${CUDA_TOOLKIT_ROOT_DIR}/targets/x86_64-linux/lib64
3032
${CUDA_TOOLKIT_ROOT_DIR}/extras/CUPTI/lib64)
3133
find_library(CUPTI_LIBRARY NAMES libcupti.so libcupti.dylib # libcupti_static.a
3234
PATHS ${CUPTI_CHECK_LIBRARY_DIRS} ${CUPTI_INCLUDE_DIR} ${__libpath_hist}

cmake/external/brpc.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ ExternalProject_Add(
4040
extern_brpc
4141
${EXTERNAL_PROJECT_LOG_ARGS}
4242
${SHALLOW_CLONE}
43-
GIT_REPOSITORY "https://github.com/apache/incubator-brpc.git"
43+
GIT_REPOSITORY "${GIT_URL}/apache/incubator-brpc.git"
4444
GIT_TAG "ad00fe940b4f05225b214131959293bbed8744a0" #rdma branch's head now.
4545
PREFIX ${BRPC_SOURCES_DIR}
4646
UPDATE_COMMAND ""

cmake/external/cryptopp.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ INCLUDE(ExternalProject)
1717
SET(CRYPTOPP_PREFIX_DIR ${THIRD_PARTY_PATH}/cryptopp)
1818
SET(CRYPTOPP_INSTALL_DIR ${THIRD_PARTY_PATH}/install/cryptopp)
1919
SET(CRYPTOPP_INCLUDE_DIR "${CRYPTOPP_INSTALL_DIR}/include" CACHE PATH "cryptopp include directory." FORCE)
20-
SET(CRYPTOPP_REPOSITORY https://github.com/weidai11/cryptopp.git)
20+
SET(CRYPTOPP_REPOSITORY ${GIT_URL}/weidai11/cryptopp.git)
2121
SET(CRYPTOPP_TAG CRYPTOPP_8_2_0)
2222

2323
IF(WIN32)
@@ -55,7 +55,7 @@ ExternalProject_Add(
5555
SOURCE_DIR ${CRYPTOPP_SOURCE_DIR}
5656
PATCH_COMMAND
5757
COMMAND ${CMAKE_COMMAND} -E remove_directory "<SOURCE_DIR>/cmake/"
58-
COMMAND git clone https://github.com/noloader/cryptopp-cmake "<SOURCE_DIR>/cmake"
58+
COMMAND git clone ${GIT_URL}/noloader/cryptopp-cmake "<SOURCE_DIR>/cmake"
5959
COMMAND cd "<SOURCE_DIR>/cmake" && git checkout tags/${CRYPTOPP_TAG} -b ${CRYPTOPP_TAG}
6060
COMMAND ${CMAKE_COMMAND} -E copy_directory "<SOURCE_DIR>/cmake/" "<SOURCE_DIR>/"
6161
INSTALL_DIR ${CRYPTOPP_INSTALL_DIR}

cmake/external/cub.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ include(ExternalProject)
1616

1717
set(CUB_PREFIX_DIR ${THIRD_PARTY_PATH}/cub)
1818
set(CUB_SOURCE_DIR ${THIRD_PARTY_PATH}/cub/src/extern_cub)
19-
set(CUB_REPOSITORY https://github.com/NVlabs/cub.git)
19+
set(CUB_REPOSITORY ${GIT_URL}/NVlabs/cub.git)
2020
set(CUB_TAG 1.8.0)
2121

2222
cache_third_party(extern_cub

0 commit comments

Comments
 (0)