Getting verbose message for cmake

For PyTorch, I get this error

-- Could NOT find NCCL (missing: NCCL_INCLUDE_DIR NCCL_LIBRARY)
CMake Warning at third_party/gloo/cmake/Dependencies.cmake:96 (message):
  Not compiling with NCCL support.  Suppress this warning with
  -DUSE_NCCL=OFF.
Call Stack (most recent call first):
  third_party/gloo/CMakeLists.txt:56 (include)

Part of third_party/gloo/cmake/Dependencies.cmake that contains the error is

if(USE_CUDA AND USE_NCCL)
  # NCCL_EXTERNAL is set if using the Caffe2 bundled version of NCCL
  if(NCCL_EXTERNAL)
    include_directories(SYSTEM ${NCCL_INCLUDE_DIRS})
    list(APPEND gloo_cuda_DEPENDENCY_LIBS ${NCCL_LIBRARIES} dl rt)
  else()
    find_package(nccl REQUIRED)
    if(NCCL_FOUND)
      include_directories(SYSTEM ${NCCL_INCLUDE_DIRS})
      list(APPEND gloo_cuda_DEPENDENCY_LIBS ${NCCL_LIBRARIES} dl rt)
    else()
      message(WARNING "Not compiling with NCCL support. Suppress this warning with -DUSE_NCCL=OFF.")
      set(USE_NCCL OFF)
    endif()
  endif()
endif()

Although, I have set env variables correctly, I would like to get more verbosity when cmake is reading that file. I mean, I want to know what is the value of NCCL_INCLUDE_DIRS when cmake is reading that file.

In the terminal, I see nothing wrong.

$ echo $NCCL_INCLUDE_DIRS
/opt/nccl-2.4.8/include
$ echo $NCCL_LIBRARIES
/opt/nccl-2.4.8/lib

NCCL_INCLUDE_DIRS and NCCL_LIBRARIES are result variables of calling find_package(nccl REQUIRED) :


They are not inputs, and setting them as environment variables doesn’t change how Findnccl.cmake works.

The only environment variable that Findnccl.cmake reads is NCCL_ROOT_DIR:


So I guess, you should set the environment variable NCCL_ROOT_DIR to /opt/nccl-2.4.8 to get it working.

I hope this helps!

1 Like