Skip to content

Commit 082bc7a

Browse files
committed
Use CUDA_ARCH_NAME=All in the paddle/scripts/docker/build.sh and remove 20 21(20) in cmake/cuda.cmake.
1 parent 3d080f3 commit 082bc7a

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

cmake/cuda.cmake

Lines changed: 4 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ if(NOT WITH_GPU)
22
return()
33
endif()
44

5-
set(paddle_known_gpu_archs "20 21(20) 30 35 50 52 60 61 70")
6-
set(paddle_known_gpu_archs7 "20 21(20) 30 35 50 52")
7-
set(paddle_known_gpu_archs8 "20 21(20) 30 35 50 52 60 61")
5+
set(paddle_known_gpu_archs "30 35 50 52 60 61 70")
6+
set(paddle_known_gpu_archs7 "30 35 50 52")
7+
set(paddle_known_gpu_archs8 "30 35 50 52 60 61")
88

99
######################################################################################
1010
# A function for automatic detection of GPUs installed (if autodetection is enabled)
@@ -40,7 +40,7 @@ function(detect_installed_gpus out_variable)
4040
STRING(REGEX REPLACE "\n" ";" nvcc_out "${nvcc_out}")
4141
list(GET nvcc_out -1 nvcc_out)
4242
string(REPLACE "2.1" "2.1(2.0)" nvcc_out "${nvcc_out}")
43-
set(CUDA_gpu_detect_output ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from caffe_detect_gpus tool" FORCE)
43+
set(CUDA_gpu_detect_output ${nvcc_out} CACHE INTERNAL "Returned GPU architetures from detect_installed_gpus tool" FORCE)
4444
endif()
4545
endif()
4646

@@ -137,10 +137,6 @@ function(select_nvcc_arch_flags out_variable)
137137
set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE)
138138
endfunction()
139139

140-
if(NOT CUDA_FOUND)
141-
return()
142-
endif()
143-
144140
message(STATUS "CUDA detected: " ${CUDA_VERSION})
145141
if (${CUDA_VERSION} LESS 7.0)
146142
set(paddle_known_gpu_archs ${paddle_known_gpu_archs})
@@ -163,37 +159,11 @@ if(NOT WITH_DSO)
163159
list(APPEND EXTERNAL_LIBS ${CUDNN_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_curand_LIBRARY} ${NCCL_LIBRARY})
164160
endif(NOT WITH_DSO)
165161

166-
# find libcuda.so and lbnvrtc.so
167-
# For libcuda.so, we will find it under lib, lib64, and then the
168-
# stubs folder, in case we are building on a system that does not
169-
# have cuda driver installed. On windows, we also search under the
170-
# folder lib/x64.
171-
172-
find_library(CUDA_CUDA_LIB cuda
173-
PATHS ${CUDA_TOOLKIT_ROOT_DIR}
174-
PATH_SUFFIXES lib lib64 lib/stubs lib64/stubs lib/x64)
175-
find_library(CUDA_NVRTC_LIB nvrtc
176-
PATHS ${CUDA_TOOLKIT_ROOT_DIR}
177-
PATH_SUFFIXES lib lib64 lib/x64)
178-
179162
# setting nvcc arch flags
180163
select_nvcc_arch_flags(NVCC_FLAGS_EXTRA)
181164
list(APPEND CUDA_NVCC_FLAGS ${NVCC_FLAGS_EXTRA})
182165
message(STATUS "Added CUDA NVCC flags for: ${NVCC_FLAGS_EXTRA_readable}")
183166

184-
if(CUDA_CUDA_LIB)
185-
# message(STATUS "Found libcuda: ${CUDA_CUDA_LIB}")
186-
list(APPEND Caffe2_DEPENDENCY_LIBS ${CUDA_CUDA_LIB})
187-
else()
188-
message(FATAL_ERROR "Cannot find libcuda.so.")
189-
endif()
190-
if(CUDA_NVRTC_LIB)
191-
# message(STATUS "Found libnvrtc: ${CUDA_NVRTC_LIB}")
192-
list(APPEND Caffe2_DEPENDENCY_LIBS ${CUDA_NVRTC_LIB})
193-
else()
194-
message(FATAL_ERROR "Cannot find libnvrtc.so.")
195-
endif()
196-
197167
# Set C++11 support
198168
set(CUDA_PROPAGATE_HOST_FLAGS OFF)
199169

paddle/scripts/docker/build.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ function cmake_gen() {
3434
${PYTHON_FLAGS}
3535
-DWITH_DOC=OFF
3636
-DWITH_GPU=${WITH_GPU:-OFF}
37+
-DCUDA_ARCH_NAME=All
3738
-DWITH_MKLDNN=${WITH_MKLDNN:-ON}
3839
-DWITH_MKLML=${WITH_MKLML:-ON}
3940
-DWITH_AVX=${WITH_AVX:-OFF}
@@ -56,6 +57,7 @@ EOF
5657
${PYTHON_FLAGS} \
5758
-DWITH_DOC=OFF \
5859
-DWITH_GPU=${WITH_GPU:-OFF} \
60+
-DCUDA_ARCH_NAME=All \
5961
-DWITH_MKLDNN=${WITH_MKLDNN:-ON} \
6062
-DWITH_MKLML=${WITH_MKLML:-ON} \
6163
-DWITH_AVX=${WITH_AVX:-OFF} \

0 commit comments

Comments
 (0)