|
|
|
@ -27,6 +27,13 @@ include(init)
|
|
|
|
|
# TODO(Shibo Tao): remove find_package(CUDA) completely.
|
|
|
|
|
find_package(CUDA QUIET)
|
|
|
|
|
option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND})
|
|
|
|
|
|
|
|
|
|
# cmake 3.12, 3.13, 3.14 will append gcc link options to nvcc, and nvcc doesn't recognize them.
|
|
|
|
|
if(WITH_GPU AND (${CMAKE_VERSION} VERSION_GREATER_EQUAL 3.12) AND (${CMAKE_VERSION} VERSION_LESS 3.15))
|
|
|
|
|
message(FATAL_ERROR "cmake ${CMAKE_VERSION} is not supported when WITH_GPU=ON because of bug https://tinyurl.com/ydbb9m7n. "
|
|
|
|
|
"You can use cmake 3.16 (recommended), 3.10, 3.11, 3.15 or 3.17. Please refer to the install document: https://cmake.org/install/")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
if(WITH_GPU AND NOT APPLE)
|
|
|
|
|
enable_language(CUDA)
|
|
|
|
|
message(STATUS "CUDA compiler: ${CMAKE_CUDA_COMPILER}, version: "
|
|
|
|
|