Skip to content

Commit

Permalink
Use CUDA_ARCH_NAME=All in the paddle/scripts/docker/build.sh and remo…
Browse files Browse the repository at this point in the history
…ve 20 21(20) in cmake/cuda.cmake.
  • Loading branch information
qingqing01 committed Nov 17, 2017
1 parent 3d080f3 commit 082bc7a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
38 changes: 4 additions & 34 deletions cmake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ if(NOT WITH_GPU)
return()
endif()

set(paddle_known_gpu_archs "20 21(20) 30 35 50 52 60 61 70")
set(paddle_known_gpu_archs7 "20 21(20) 30 35 50 52")
set(paddle_known_gpu_archs8 "20 21(20) 30 35 50 52 60 61")
set(paddle_known_gpu_archs "30 35 50 52 60 61 70")
set(paddle_known_gpu_archs7 "30 35 50 52")
set(paddle_known_gpu_archs8 "30 35 50 52 60 61")

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

Expand Down Expand Up @@ -137,10 +137,6 @@ function(select_nvcc_arch_flags out_variable)
set(${out_variable}_readable ${nvcc_archs_readable} PARENT_SCOPE)
endfunction()

if(NOT CUDA_FOUND)
return()
endif()

message(STATUS "CUDA detected: " ${CUDA_VERSION})
if (${CUDA_VERSION} LESS 7.0)
set(paddle_known_gpu_archs ${paddle_known_gpu_archs})
Expand All @@ -163,37 +159,11 @@ if(NOT WITH_DSO)
list(APPEND EXTERNAL_LIBS ${CUDNN_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} ${CUDA_curand_LIBRARY} ${NCCL_LIBRARY})
endif(NOT WITH_DSO)

# find libcuda.so and lbnvrtc.so
# For libcuda.so, we will find it under lib, lib64, and then the
# stubs folder, in case we are building on a system that does not
# have cuda driver installed. On windows, we also search under the
# folder lib/x64.

find_library(CUDA_CUDA_LIB cuda
PATHS ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/stubs lib64/stubs lib/x64)
find_library(CUDA_NVRTC_LIB nvrtc
PATHS ${CUDA_TOOLKIT_ROOT_DIR}
PATH_SUFFIXES lib lib64 lib/x64)

# setting nvcc arch flags
select_nvcc_arch_flags(NVCC_FLAGS_EXTRA)
list(APPEND CUDA_NVCC_FLAGS ${NVCC_FLAGS_EXTRA})
message(STATUS "Added CUDA NVCC flags for: ${NVCC_FLAGS_EXTRA_readable}")

if(CUDA_CUDA_LIB)
# message(STATUS "Found libcuda: ${CUDA_CUDA_LIB}")
list(APPEND Caffe2_DEPENDENCY_LIBS ${CUDA_CUDA_LIB})
else()
message(FATAL_ERROR "Cannot find libcuda.so.")
endif()
if(CUDA_NVRTC_LIB)
# message(STATUS "Found libnvrtc: ${CUDA_NVRTC_LIB}")
list(APPEND Caffe2_DEPENDENCY_LIBS ${CUDA_NVRTC_LIB})
else()
message(FATAL_ERROR "Cannot find libnvrtc.so.")
endif()

# Set C++11 support
set(CUDA_PROPAGATE_HOST_FLAGS OFF)

Expand Down
2 changes: 2 additions & 0 deletions paddle/scripts/docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function cmake_gen() {
${PYTHON_FLAGS}
-DWITH_DOC=OFF
-DWITH_GPU=${WITH_GPU:-OFF}
-DCUDA_ARCH_NAME=All
-DWITH_MKLDNN=${WITH_MKLDNN:-ON}
-DWITH_MKLML=${WITH_MKLML:-ON}
-DWITH_AVX=${WITH_AVX:-OFF}
Expand All @@ -56,6 +57,7 @@ EOF
${PYTHON_FLAGS} \
-DWITH_DOC=OFF \
-DWITH_GPU=${WITH_GPU:-OFF} \
-DCUDA_ARCH_NAME=All \
-DWITH_MKLDNN=${WITH_MKLDNN:-ON} \
-DWITH_MKLML=${WITH_MKLML:-ON} \
-DWITH_AVX=${WITH_AVX:-OFF} \
Expand Down

0 comments on commit 082bc7a

Please sign in to comment.