@@ -98,6 +98,13 @@ else(WIN32)
9898endif (WIN32 )
9999
100100find_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+
101108find_package (Threads REQUIRED)
102109
103110include (simd)
@@ -131,6 +138,7 @@ option(WITH_LITE "Compile Paddle Fluid with Lite Engine" OFF)
131138option (WITH_NCCL "Compile PaddlePaddle with NCCL support" ON )
132139option (WITH_CRYPTO "Compile PaddlePaddle with crypto support" ON )
133140option (WITH_ARM "Compile PaddlePaddle with arm support" OFF )
141+ option (WITH_SW "Compile PaddlePaddle with sw support" OFF )
134142option (WITH_MUSL "Compile with musl libc instead of gblic" OFF )
135143
136144# PY_VERSION
@@ -193,10 +201,19 @@ if(WITH_BRPC_RDMA)
193201 endif ()
194202endif ()
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
201218if (WITH_DISTRIBUTE)
202219 if (WITH_GRPC)
@@ -209,18 +226,8 @@ if(WITH_DISTRIBUTE)
209226 endif ()
210227endif ()
211228
212- # there is no official support of nccl, cupti in windows
213- if (NOT WIN32 )
214- include (cupti)
215- endif ()
216-
217229include (flags ) # set paddle compile flags
218230
219- if (WITH_GPU)
220- include (cuda)
221- include (tensorrt)
222- endif ()
223-
224231if (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)
256262endif ()
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+
258273set (PADDLE_PYTHON_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR} /python/build" )
259274
260275set (CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -g -DNDEBUG" )
0 commit comments