Use CMake built-in function to compare NCCL version (#5118)

* Use CMake built-in function to compare version

* Address comment
This commit is contained in:
Wei-Sheng Chin 2020-09-10 15:59:47 -07:00 committed by GitHub
parent c5d4ae0401
commit 5618b9dddc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()