diff options
author | Tongzhou Wang <SsnL@users.noreply.github.com> | 2018-06-19 16:31:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-19 16:31:17 -0400 |
commit | a60540ed2b3dc65a6dbc5d850f85c6a4da2304de (patch) | |
tree | bf45f1f92bb02b9dcff318b40dc6c58190b5ccdb /cmake | |
parent | 61c96811be8051e39b1d5663b2c3538cafb93fd0 (diff) | |
download | pytorch-a60540ed2b3dc65a6dbc5d850f85c6a4da2304de.tar.gz pytorch-a60540ed2b3dc65a6dbc5d850f85c6a4da2304de.tar.bz2 pytorch-a60540ed2b3dc65a6dbc5d850f85c6a4da2304de.zip |
Make NCCL build select NVCC_GENCODE smarter (#8615)
* Make NCCL build select NVCC_GENCODE smarter
* add info print
* replace ; with \s
* gencode\s -> gencode=
* Don't let nccl use sccache
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/public/cuda.cmake | 19 | ||||
-rw-r--r-- | cmake/public/utils.cmake | 28 |
2 files changed, 29 insertions, 18 deletions
diff --git a/cmake/public/cuda.cmake b/cmake/public/cuda.cmake index 0c3578d7a6..0ea36530e8 100644 --- a/cmake/public/cuda.cmake +++ b/cmake/public/cuda.cmake @@ -323,24 +323,7 @@ elseif (CUDA_VERSION VERSION_EQUAL 8.0) endif() # setting nvcc arch flags -if ((NOT EXISTS ${TORCH_CUDA_ARCH_LIST}) AND (DEFINED ENV{TORCH_CUDA_ARCH_LIST})) - message(WARNING - "In the future we will require one to explicitly pass " - "TORCH_CUDA_ARCH_LIST to cmake instead of implicitly setting it as an " - "env variable. This will become a FATAL_ERROR in future version of " - "pytorch.") - set(TORCH_CUDA_ARCH_LIST $ENV{TORCH_CUDA_ARCH_LIST}) -endif() -if (EXISTS ${CUDA_ARCH_NAME}) - message(WARNING - "CUDA_ARCH_NAME is no longer used. Use TORCH_CUDA_ARCH_LIST instead. " - "Right now, CUDA_ARCH_NAME is ${CUDA_ARCH_NAME} and " - "TORCH_CUDA_ARCH_LIST is ${TORCH_CUDA_ARCH_LIST}.") - set(TORCH_CUDA_ARCH_LIST TORCH_CUDA_ARCH_LIST ${CUDA_ARCH_NAME}) -endif() - -# Invoke cuda_select_nvcc_arch_flags from proper cmake FindCUDA. -cuda_select_nvcc_arch_flags(NVCC_FLAGS_EXTRA ${TORCH_CUDA_ARCH_LIST}) +torch_cuda_get_nvcc_gencode_flag(NVCC_FLAGS_EXTRA) list(APPEND CUDA_NVCC_FLAGS ${NVCC_FLAGS_EXTRA}) message(STATUS "Added CUDA NVCC flags for: ${NVCC_FLAGS_EXTRA}") diff --git a/cmake/public/utils.cmake b/cmake/public/utils.cmake index 3137a5e938..84ed2c4c6e 100644 --- a/cmake/public/utils.cmake +++ b/cmake/public/utils.cmake @@ -138,6 +138,34 @@ endmacro() ############################################################################## +# Get the NVCC arch flags specified by TORCH_CUDA_ARCH_LIST and CUDA_ARCH_NAME. +# Usage: +# torch_cuda_get_nvcc_gencode_flag(variable_to_store_flags) +# +macro(torch_cuda_get_nvcc_gencode_flag store_var) + # setting nvcc arch flags + if ((NOT EXISTS ${TORCH_CUDA_ARCH_LIST}) AND (DEFINED ENV{TORCH_CUDA_ARCH_LIST})) + message(WARNING + "In the future we will require one to explicitly pass " + "TORCH_CUDA_ARCH_LIST to cmake instead of implicitly setting it as an " + "env variable. This will become a FATAL_ERROR in future version of " + "pytorch.") + set(TORCH_CUDA_ARCH_LIST $ENV{TORCH_CUDA_ARCH_LIST}) + endif() + if (EXISTS ${CUDA_ARCH_NAME}) + message(WARNING + "CUDA_ARCH_NAME is no longer used. Use TORCH_CUDA_ARCH_LIST instead. " + "Right now, CUDA_ARCH_NAME is ${CUDA_ARCH_NAME} and " + "TORCH_CUDA_ARCH_LIST is ${TORCH_CUDA_ARCH_LIST}.") + set(TORCH_CUDA_ARCH_LIST TORCH_CUDA_ARCH_LIST ${CUDA_ARCH_NAME}) + endif() + + # Invoke cuda_select_nvcc_arch_flags from proper cmake FindCUDA. + cuda_select_nvcc_arch_flags(${store_var} ${TORCH_CUDA_ARCH_LIST}) +endmacro() + + +############################################################################## # Add ATen compile options. # Usage: # aten_compile_options(lib_name) |