From a2a567c538e0ce1eee3ffd8c0d24fdd62a2a21d6 Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Tue, 11 Feb 2020 20:10:50 +0000 Subject: [PATCH 1/2] clang: Disable unused-function warnings for 3rd-party NCCL library --- src/3rd_party/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index e100a619..c8d7119b 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -95,7 +95,7 @@ if(CUDA_FOUND) BUILD_COMMAND $(MAKE) -f ${CMAKE_CURRENT_SOURCE_DIR}/nccl/Makefile src.build BUILDDIR=${CMAKE_BINARY_DIR}/local CUDA_HOME=${CUDA_TOOLKIT_ROOT_DIR} - CUDA8_GENCODE=${GENCODE} CXX=${CMAKE_CXX_COMPILER} + CUDA8_GENCODE=${GENCODE} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-Wno-unused-function INSTALL_COMMAND "") set_target_properties(nccl PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/local/lib/libnccl_static.a) From 0873311d4866532d5a6520d11b76be6fcee183fc Mon Sep 17 00:00:00 2001 From: Kenneth Heafield Date: Tue, 11 Feb 2020 20:19:50 +0000 Subject: [PATCH 2/2] Gate warning on clang --- src/3rd_party/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/3rd_party/CMakeLists.txt b/src/3rd_party/CMakeLists.txt index c8d7119b..1952dd75 100644 --- a/src/3rd_party/CMakeLists.txt +++ b/src/3rd_party/CMakeLists.txt @@ -86,6 +86,12 @@ if(CUDA_FOUND) if(COMPILE_CUDA_SM70) set(GENCODE "${GENCODE} -gencode=arch=compute_70,code=sm_70") endif(COMPILE_CUDA_SM70) + # clang generates a lot of unused function warnings for NCCL + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set(NCCL_CXXFLAGS "-Wno-unused-function") + else() + set(NCCL_CXXFLAGS "") + endif() # install nccl in ${CMAKE_BINARY_DIR}/local similar to /usr/local linux installation ExternalProject_Add(nccl_install @@ -95,7 +101,7 @@ if(CUDA_FOUND) BUILD_COMMAND $(MAKE) -f ${CMAKE_CURRENT_SOURCE_DIR}/nccl/Makefile src.build BUILDDIR=${CMAKE_BINARY_DIR}/local CUDA_HOME=${CUDA_TOOLKIT_ROOT_DIR} - CUDA8_GENCODE=${GENCODE} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=-Wno-unused-function + CUDA8_GENCODE=${GENCODE} CXX=${CMAKE_CXX_COMPILER} CXXFLAGS=${NCCL_CXXFLAGS} INSTALL_COMMAND "") set_target_properties(nccl PROPERTIES IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/local/lib/libnccl_static.a)