@@ -20,6 +20,13 @@ set(PADDLE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
2020
2121include (system )
2222
23+ # Note(zhouwei): Ninja Generator will set CMAKE_BUILD_TYPE to Debug
24+ if (NOT CMAKE_BUILD_TYPE )
25+ set (CMAKE_BUILD_TYPE "Release" CACHE STRING
26+ "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
27+ FORCE)
28+ endif ()
29+
2330project (paddle CXX C)
2431
2532# enable language CUDA
@@ -213,12 +220,6 @@ if(NOT PY_VERSION)
213220endif ()
214221set (PYBIND11_PYTHON_VERSION ${PY_VERSION} )
215222
216- # CMAKE_BUILD_TYPE
217- if (NOT CMAKE_BUILD_TYPE )
218- set (CMAKE_BUILD_TYPE "Release" CACHE STRING
219- "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel"
220- FORCE)
221- endif ()
222223
223224# the type of sanitizer, options are: Address, Leak, Memory, Thread, Undefined. Default: OFF
224225if (SANITIZER_TYPE AND NOT "${SANITIZER_TYPE} " MATCHES "^(Address|Leak|Memory|Thread|Undefined)$" )
@@ -283,6 +284,27 @@ if(WITH_GPU)
283284 endif ()
284285endif ()
285286
287+ if (WITH_ROCM)
288+ include (hip)
289+ include (miopen) # set miopen libraries, must before configure
290+ endif (WITH_ROCM)
291+
292+ if (NOT WITH_ROCM AND WITH_RCCL)
293+ MESSAGE (WARNING
294+ "Disable RCCL when compiling without ROCM. Force WITH_RCCL=OFF." )
295+ set (WITH_RCCL OFF CACHE STRING
296+ "Disable RCCL when compiling without ROCM" FORCE)
297+ endif ()
298+
299+ if (WITH_RCCL)
300+ add_definitions ("-DPADDLE_WITH_RCCL" )
301+ include (rccl)
302+ else ()
303+ if (WITH_ROCM)
304+ MESSAGE (WARNING "If the environment is multi-card, the WITH_RCCL option needs to be turned on, otherwise only a single card can be used." )
305+ endif ()
306+ endif ()
307+
286308include (third_party) # download, build, install third_party, Contains about 20+ dependencies
287309
288310include (flags ) # set paddle compile flags
@@ -307,26 +329,6 @@ include(configure) # add paddle env configuration
307329
308330include_directories ("${PADDLE_SOURCE_DIR} " )
309331
310- if (WITH_ROCM)
311- include (hip)
312- endif (WITH_ROCM)
313-
314- if (NOT WITH_ROCM AND WITH_RCCL)
315- MESSAGE (WARNING
316- "Disable RCCL when compiling without ROCM. Force WITH_RCCL=OFF." )
317- set (WITH_RCCL OFF CACHE STRING
318- "Disable RCCL when compiling without ROCM" FORCE)
319- endif ()
320-
321- if (WITH_RCCL)
322- add_definitions ("-DPADDLE_WITH_RCCL" )
323- include (rccl)
324- else ()
325- if (WITH_ROCM)
326- MESSAGE (WARNING "If the environment is multi-card, the WITH_RCCL option needs to be turned on, otherwise only a single card can be used." )
327- endif ()
328- endif ()
329-
330332if (WITH_NV_JETSON)
331333 set (WITH_ARM ON CACHE STRING "Set WITH_ARM=ON when compiling WITH_NV_JETSON=ON." FORCE)
332334endif ()
0 commit comments