fix cmake logic to handle old and new include dirs

Starting from rocm 5.2 there is a reorganization of the
include directories. This pr allows to compile
rccl on both the old and the new directory layout.
This solution is using find_package() for identifying correct
settings for rocm_smi starting from rocm-5.2, and the original (manual)
settings for all previous releases.

Tested with rocm-5.2, 5.1.1, 5.0.2, and 4.5.2.


[ROCm/rccl commit: 4c4a7cb696]
Этот коммит содержится в:
Edgar
2022-04-27 12:18:29 -04:00
родитель 95b30d9762
Коммит 053b658a48
+14 -3
Просмотреть файл
@@ -222,7 +222,18 @@ if(COLLTRACE)
add_definitions(-DENABLE_COLLTRACE)
endif()
CHECK_INCLUDE_FILE_CXX("${ROCM_PATH}/rocm_smi/include/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
find_package(rocm_smi PATHS ${ROCM_PATH}/lib/cmake/rocm_smi)
if (rocm_smi_FOUND)
message ("-- Found rocm_smi at ${ROCM_SMI_INCLUDE_DIR}")
CHECK_INCLUDE_FILE_CXX("${ROCM_SMI_INCLUDE_DIR}/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
else()
message ("-- Checking old include directory structure for rocm_smi")
set(ROCM_SMI_INCLUDE_DIR "${ROCM_PATH}/rocm_smi/include")
set(ROCM_SMI_LIB_DIR "${ROCM_PATH}/rocm_smi/lib")
set(ROCM_SMI_LIBRARIES rocm_smi64)
CHECK_INCLUDE_FILE_CXX("${ROCM_SMI_INCLUDE_DIR}/rocm_smi/rocm_smi64Config.h" HAVE_ROCM_SMI64CONFIG)
endif()
IF(HAVE_ROCM_SMI64CONFIG)
add_definitions(-DUSE_ROCM_SMI64CONFIG)
ENDIF()
@@ -265,8 +276,8 @@ if("${HIP_COMPILER}" MATCHES "hcc")
endif()
endif()
target_include_directories(rccl PRIVATE ${ROCM_PATH}/rocm_smi/include)
target_link_libraries(rccl PRIVATE hip::device dl -lrocm_smi64 -L${ROCM_PATH}/rocm_smi/lib)
target_include_directories(rccl PRIVATE ${ROCM_SMI_INCLUDE_DIR})
target_link_libraries(rccl PRIVATE hip::device dl -l${ROCM_SMI_LIBRARIES} -L${ROCM_SMI_LIB_DIR})
target_link_libraries(rccl INTERFACE hip::host)
#Setup librccl.so version