From d261ba029a50aa8786bce78cf35f45f6c686faf2 Mon Sep 17 00:00:00 2001 From: Tanuja Kirthi Doddapaneni Date: Thu, 29 Oct 2020 03:06:31 +0530 Subject: [PATCH] Added USE_NCCL_LIB_PATH option to enable user to set NCCL_LIBRARY during build (#6310) Description: To enable user to set NCCL_LIBRARY during build --- cmake/modules/FindNccl.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cmake/modules/FindNccl.cmake b/cmake/modules/FindNccl.cmake index 643c45f07..929d495b6 100644 --- a/cmake/modules/FindNccl.cmake +++ b/cmake/modules/FindNccl.cmake @@ -22,19 +22,24 @@ # # NCCL_ROOT - When set, this path is inspected instead of standard library # locations as the root of the NCCL installation. -# The environment variable NCCL_ROOT overrides this veriable. +# The environment variable NCCL_ROOT overrides this variable. # # This module defines # Nccl_FOUND, whether nccl has been found # NCCL_INCLUDE_DIR, directory containing header # NCCL_LIBRARY, directory containing nccl library # NCCL_LIB_NAME, nccl library name +# USE_NCCL_LIB_PATH, when set, NCCL_LIBRARY path is also inspected for the +# location of the nccl library. This would disable +# switching between static and shared. # # This module assumes that the user has already called find_package(CUDA) if (NCCL_LIBRARY) - # Don't cache NCCL_LIBRARY to enable switching between static and shared. - unset(NCCL_LIBRARY CACHE) + if(NOT USE_NCCL_LIB_PATH) + # Don't cache NCCL_LIBRARY to enable switching between static and shared. + unset(NCCL_LIBRARY CACHE) + endif(NOT USE_NCCL_LIB_PATH) endif() if (BUILD_WITH_SHARED_NCCL)