From 3a9ae518f2c9424251eae13fb23db6ea571cfce1 Mon Sep 17 00:00:00 2001 From: Nikita Shulga Date: Wed, 24 Aug 2022 18:31:25 +0000 Subject: [PATCH] Skip NCCL slimming for cxx11 libtorch builds (#83959) Fixes https://github.com/pytorch/pytorch/issues/83887 Pull Request resolved: https://github.com/pytorch/pytorch/pull/83959 Approved by: https://github.com/atalman --- cmake/External/nccl.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/External/nccl.cmake b/cmake/External/nccl.cmake index fa882d0bfb8..18b39033119 100644 --- a/cmake/External/nccl.cmake +++ b/cmake/External/nccl.cmake @@ -42,7 +42,13 @@ if(NOT __NCCL_INCLUDED) string(REGEX REPLACE "GNU objcopy .+ ([0-9])\\.([0-9]+).*" "\\1" OBJCOPY_VERSION_MAJOR ${OBJCOPY_VERSION_STR}) string(REGEX REPLACE "GNU objcopy .+ ([0-9])\\.([0-9]+).*" "\\2" OBJCOPY_VERSION_MINOR ${OBJCOPY_VERSION_STR}) - if((${OBJCOPY_VERSION_MAJOR} GREATER 2) OR ((${OBJCOPY_VERSION_MAJOR} EQUAL 2) AND (${OBJCOPY_VERSION_MINOR} GREATER 27))) + # TODO: Replace me with SKIP_NCCL_SLIMMING option (and investigate why it does not work on newer compilers) + if("$ENV{BUILD_ENVIRONMENT}" MATCHES ".*-libtorch-cxx11-abi$") + # See https://github.com/pytorch/pytorch/issues/83887 + message(WARNING "Skip NCCL library slimming for cxx11-abi builds") + set(__NCCL_LIBRARY_DEP nccl_external) + set(NCCL_LIBRARIES ${__NCCL_BUILD_DIR}/lib/libnccl_static.a) + elseif((${OBJCOPY_VERSION_MAJOR} GREATER 2) OR ((${OBJCOPY_VERSION_MAJOR} EQUAL 2) AND (${OBJCOPY_VERSION_MINOR} GREATER 27))) message(WARNING "Enabling NCCL library slimming") add_custom_command( OUTPUT "${__NCCL_BUILD_DIR}/lib/libnccl_slim_static.a"