From c68b82ebc8fdb40aabf45bfc66fe30104a2dcd47 Mon Sep 17 00:00:00 2001 From: Anders Papitto Date: Tue, 30 Oct 2018 15:16:54 -0700 Subject: [PATCH] don't expand cmake variable in IF Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/13331 Differential Revision: D12849306 Pulled By: anderspapitto fbshipit-source-id: 2f1f72a44ed3a176be8c7490652e49771c3fadbf --- cmake/External/nccl.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cmake/External/nccl.cmake b/cmake/External/nccl.cmake index 57abce4ce95..4f1e8bf4ea8 100644 --- a/cmake/External/nccl.cmake +++ b/cmake/External/nccl.cmake @@ -8,9 +8,11 @@ if (NOT __NCCL_INCLUDED) target_link_libraries(__caffe2_nccl INTERFACE ${NCCL_LIBRARIES}) target_include_directories(__caffe2_nccl INTERFACE ${NCCL_INCLUDE_DIRS}) else() - if (${TORCH_CUDA_ARCH_LIST}) + if (TORCH_CUDA_ARCH_LIST) torch_cuda_get_nvcc_gencode_flag(NVCC_GENCODE) string(REPLACE "-gencode;" "-gencode=" NVCC_GENCODE "${NVCC_GENCODE}") + # this second replacement is needed when there are multiple archs + string(REPLACE ";-gencode" " -gencode" NVCC_GENCODE "${NVCC_GENCODE}") endif() ExternalProject_Add(nccl_external