diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 0a57f0e488..316362ade4 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -1186,13 +1186,10 @@ if (onnxruntime_ENABLE_TRAINING) message(STATUS "NCCL_MINOR_VERSION: ${NCCL_MINOR_VERSION}") endif() - if (${NCCL_MAJOR_VERSION} GREATER 2) - add_definitions(-DUSE_NCCL_P2P=1) - else() - if(${NCCL_MAJOR_VERSION} EQUAL 2) - if(${NCCL_MINOR_VERSION} GREATER 7) - add_definitions(-DUSE_NCCL_P2P=1) - endif() + if (NCCL_MAJOR_VERSION_DEFINED AND NCCL_MINOR_VERSION_DEFINED) + if ("${NCCL_MAJOR_VERSION}.${NCCL_MINOR_VERSION}" VERSION_GREATER_EQUAL "2.7") + add_definitions(-DUSE_NCCL_P2P=1) + message( STATUS "NCCL P2P is enabled for supporting ncclSend and ncclRecv." ) endif() endif()