diff --git a/CMakeLists.txt b/CMakeLists.txt index 36b33e0eba6f7b66c6320801b3a40984b1a6cc24..8322b7f378a5ea08509ff02178ef304e595b0fb9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,7 @@ include(generic) # simplify cmake module # TODO(Shibo Tao): remove find_package(CUDA) completely. find_package(CUDA QUIET) option(WITH_GPU "Compile PaddlePaddle with NVIDIA GPU" ${CUDA_FOUND}) +option(WITH_TENSORRT "Compile PaddlePaddle with NVIDIA TensorRT" OFF) option(WITH_XPU "Compile PaddlePaddle with BAIDU KUNLUN" OFF) if (WITH_GPU AND WITH_XPU) message(FATAL_ERROR "Error when compile GPU and XPU at the same time") diff --git a/cmake/tensorrt.cmake b/cmake/tensorrt.cmake index d715dfd0dbe6d1efba395fc375d124d8900aeae5..889332fc55704f96f0afbd5815042ae8c0ba1035 100644 --- a/cmake/tensorrt.cmake +++ b/cmake/tensorrt.cmake @@ -1,4 +1,4 @@ -if(NOT WITH_GPU) +if(NOT WITH_GPU OR NOT WITH_TENSORRT) return() endif() @@ -40,7 +40,7 @@ if(TENSORRT_INCLUDE_DIR AND TENSORRT_LIBRARY) set(TENSORRT_FOUND ON) else() set(TENSORRT_FOUND OFF) - message(STATUS "TensorRT is disabled.") + message(WARNING "TensorRT is disabled. You are compiling PaddlePaddle with option -DWITH_TENSORRT=ON, but TensorRT is not found, please configure path to TensorRT with option -DTENSORRT_ROOT or install it.") endif() if(TENSORRT_FOUND) diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 12077781da5b8779524216f0d104437e0cdb32bd..35c9d581d9fefebbf431d86b65d1e390efe27fcb 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -222,6 +222,7 @@ function cmake_base() { -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} ${PYTHON_FLAGS} -DWITH_GPU=${WITH_GPU:-OFF} + -DWITH_TENSORRT=${WITH_TENSORRT:-ON} -DWITH_AMD_GPU=${WITH_AMD_GPU:-OFF} -DWITH_DISTRIBUTE=${distibuted_flag} -DWITH_MKL=${WITH_MKL:-ON} @@ -254,6 +255,7 @@ EOF -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release} \ ${PYTHON_FLAGS} \ -DWITH_GPU=${WITH_GPU:-OFF} \ + -DWITH_TENSORRT=${WITH_TENSORRT:-ON} \ -DWITH_AMD_GPU=${WITH_AMD_GPU:-OFF} \ -DWITH_DISTRIBUTE=${distibuted_flag} \ -DWITH_MKL=${WITH_MKL:-ON} \