Skip to content

Commit

Permalink
make CUDA_ARCH_NAME default Auto (#21352)
Browse files Browse the repository at this point in the history
* make CUDA_ARCH_NAME default Auto

test=develop

* refine warning

test=develop
  • Loading branch information
luotao1 authored Nov 26, 2019
1 parent be2e3e6 commit d8e7d25
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cmake/cuda.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ endfunction()
function(select_nvcc_arch_flags out_variable)
# List of arch names
set(archs_names "Kepler" "Maxwell" "Pascal" "Volta" "Turing" "All" "Manual")
set(archs_name_default "All")
set(archs_name_default "Auto")
list(APPEND archs_names "Auto")

# set CUDA_ARCH_NAME strings (so it will be seen as dropbox in CMake-Gui)
Expand All @@ -73,7 +73,7 @@ function(select_nvcc_arch_flags out_variable)
# verify CUDA_ARCH_NAME value
if(NOT ";${archs_names};" MATCHES ";${CUDA_ARCH_NAME};")
string(REPLACE ";" ", " archs_names "${archs_names}")
message(FATAL_ERROR "Only ${archs_names} architeture names are supported.")
message(FATAL_ERROR "Only ${archs_names} architectures names are supported.")
endif()

if(${CUDA_ARCH_NAME} STREQUAL "Manual")
Expand All @@ -98,6 +98,12 @@ function(select_nvcc_arch_flags out_variable)
elseif(${CUDA_ARCH_NAME} STREQUAL "All")
set(cuda_arch_bin ${paddle_known_gpu_archs})
elseif(${CUDA_ARCH_NAME} STREQUAL "Auto")
message(STATUS "WARNING: This is just a warning for publishing release.
You are building GPU version without supporting different architectures.
So the wheel package may fail on other GPU architectures.
You can add -DCUDA_ARCH_NAME=All in cmake command
to get a full wheel package to resolve this warning.
While, this version will still work on local GPU architecture.")
detect_installed_gpus(cuda_arch_bin)
else() # (${CUDA_ARCH_NAME} STREQUAL "Manual")
set(cuda_arch_bin ${CUDA_ARCH_BIN})
Expand Down

0 comments on commit d8e7d25

Please sign in to comment.