Supporting cases where rocm-cmake is not installed
This commit is contained in:
@@ -27,7 +27,6 @@ if(ENABLE_CUDA_BACKEND)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_HSA_BACKEND)
|
if(ENABLE_HSA_BACKEND)
|
||||||
# TODO: Needs rocm-cmake, what if its not insalled?
|
|
||||||
find_package(ROCmCMakeBuildTools)
|
find_package(ROCmCMakeBuildTools)
|
||||||
if (ROCmCMakeBuildTools_FOUND)
|
if (ROCmCMakeBuildTools_FOUND)
|
||||||
find_package(hsa-runtime64 1.0 REQUIRED)
|
find_package(hsa-runtime64 1.0 REQUIRED)
|
||||||
@@ -48,11 +47,23 @@ if(ENABLE_HSA_BACKEND)
|
|||||||
message(STATUS "${BoldYellow}HSA not found, disabling HSA backend${ColorReset}")
|
message(STATUS "${BoldYellow}HSA not found, disabling HSA backend${ColorReset}")
|
||||||
set(ENABLE_HSA_BACKEND false)
|
set(ENABLE_HSA_BACKEND false)
|
||||||
endif()
|
endif()
|
||||||
|
else()
|
||||||
|
# rocm-cmake is not installed, try to manually find neccesary files.
|
||||||
|
if (NOT DEFINED ROCM_PATH)
|
||||||
|
set(ROCM_PATH "/opt/rocm" CACHE PATH "Path to ROCm")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(HSA_INCLUDE_DIR hsa/hsa.h HINTS ${ROCM_PATH}/include)
|
||||||
|
find_library(HSA_LIBRARY hsa-runtime64 HINTS ${ROCM_PATH}/lib ${ROCM_PATH}/lib64)
|
||||||
|
|
||||||
|
if (HSA_INCLUDE_DIR and HSA_LIBRARY)
|
||||||
|
message(STATUS "${BoldYellow}Found ROCm manually${ColorReset}")
|
||||||
else()
|
else()
|
||||||
set(ENABLE_HSA_BACKEND false)
|
set(ENABLE_HSA_BACKEND false)
|
||||||
message(STATUS "${BoldYellow}ROCm not found${ColorReset}")
|
message(STATUS "${BoldYellow}ROCm not found${ColorReset}")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
||||||
find_package(PCIUTILS)
|
find_package(PCIUTILS)
|
||||||
@@ -136,7 +147,7 @@ if(ENABLE_HSA_BACKEND)
|
|||||||
target_include_directories(hsa_backend PRIVATE "${HSA_INCLUDE_DIR}")
|
target_include_directories(hsa_backend PRIVATE "${HSA_INCLUDE_DIR}")
|
||||||
message(STATUS "Found HSA: ${HSA_INCLUDE_DIR}")
|
message(STATUS "Found HSA: ${HSA_INCLUDE_DIR}")
|
||||||
|
|
||||||
target_link_libraries(hsa_backend PRIVATE hsa-runtime64::hsa-runtime64)
|
target_link_libraries(hsa_backend PRIVATE ${HSA_LIBRARY})
|
||||||
target_link_libraries(gpufetch hsa_backend)
|
target_link_libraries(gpufetch hsa_backend)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user