"git@developer.sourcefind.cn:OpenDAS/ollama.git" did not exist on "d88582dffd4a4ff0dcf7f347091f023945f9a26f"
Unverified Commit 55d36484 authored by Ramesh Errabolu's avatar Ramesh Errabolu Committed by GitHub
Browse files

Merge pull request #62 from ashutom/failsafe_hsa

Failsafe find_package(hsa
parents 7480780b 848d7edb
...@@ -108,12 +108,8 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86") ...@@ -108,12 +108,8 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32")
endif() endif()
find_package(hsa-runtime64 REQUIRED
PATHS /opt/rocm
)
message( " hsa-runtime64 found @ ${hsa-runtime64_DIR} " )
# Set project requirements # Set project requirements
set(ROC_THUNK_NAME "hsakmt")
set(CORE_RUNTIME_NAME "hsa-runtime") set(CORE_RUNTIME_NAME "hsa-runtime")
set(CORE_RUNTIME_TARGET "${CORE_RUNTIME_NAME}64") set(CORE_RUNTIME_TARGET "${CORE_RUNTIME_NAME}64")
...@@ -124,6 +120,23 @@ if(NOT DEFINED CMAKE_MODULE_PATH) ...@@ -124,6 +120,23 @@ if(NOT DEFINED CMAKE_MODULE_PATH)
endif() endif()
include(utils) include(utils)
#making find_package(has-runtime64 Optional as it can fail when building old hsa
#When find_package fails, then using old method of find_libraries for
#searching the required libs for building RBT
find_package(hsa-runtime64
PATHS /opt/rocm )
if(${hsa-runtime64_FOUND})
message( " hsa-runtime64 found @ ${hsa-runtime64_DIR} " )
else()
message(" hsa-runtime64 NOT found Resolving to OLD Way" )
find_path(ROCR_HDR hsa.h PATHS "/opt/rocm" PATH_SUFFIXES include/hsa REQUIRED )
INCLUDE_DIRECTORIES(${ROCR_HDR})
# Search for ROCr library file
find_library(ROCR_LIB ${CORE_RUNTIME_TARGET} PATHS "/opt/rocm" PATH_SUFFIXES lib lib64 REQUIRED)
# Search for ROCt library file
find_library(ROCT_LIB ${ROC_THUNK_NAME} PATHS "/opt/rocm" PATH_SUFFIXES lib lib64 REQUIRED)
endif()
# #
# Set the package version for the test. It is critical that this # Set the package version for the test. It is critical that this
# value track what is used in the test source. The code from utils # value track what is used in the test source. The code from utils
...@@ -151,7 +164,11 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} Src) ...@@ -151,7 +164,11 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} Src)
# Build and link the test program # Build and link the test program
add_executable(${TEST_NAME} ${Src}) add_executable(${TEST_NAME} ${Src})
target_link_libraries(${TEST_NAME} PRIVATE hsa-runtime64::hsa-runtime64) if(${hsa-runtime64_FOUND})
target_link_libraries(${TEST_NAME} PRIVATE hsa-runtime64::hsa-runtime64)
else()
target_link_libraries(${TEST_NAME} PRIVATE ${ROCR_LIB} ${ROCT_LIB} )
endif()
target_link_libraries(${TEST_NAME} PRIVATE c stdc++ dl pthread rt) target_link_libraries(${TEST_NAME} PRIVATE c stdc++ dl pthread rt)
# Update linker flags to include RPATH # Update linker flags to include RPATH
......
...@@ -31,16 +31,23 @@ The following simply lists the steps to build RocBandwidthTest ...@@ -31,16 +31,23 @@ The following simply lists the steps to build RocBandwidthTest
The argument for cmake should be the root folder of RocBandwidthTest The argument for cmake should be the root folder of RocBandwidthTest
test suite test suite
// Assume that Roc Runtime has its libraries & headers are located in the path :
// libraries : _ABSOLUTE_PATH_TO_ROCR_LIBS_/lib
// headers : _ABSOLUTE_PATH_TO_ROCR_LIBS_/include/hsa
// Note : Observe that both include & lib folder are under common path (_ABSOLUTE_PATH_TO_ROCR_LIBS_)
// Builds Debug version // Builds Debug version
// Assumes pwd is .../roc_bandwidth_test/build // Assumes pwd is _ABSOLUTE_PATH_TO_RBT/roc_bandwidth_test/build
e.g. cmake -DROCR_LIB_DIR="Path of ROC Runtime Library Files" \
-DROCR_INC_DIR="Path of ROC Runtime Header Files" \ e.g. cmake -DCMAKE_BUILD_TYPE="Debug" \
-DCMAKE_BUILD_TYPE:STRING=Debug .. -DCMAKE_MODULE_PATH="_ABSOLUTE_PATH_TO_RBT/roc_bandwidth_test/cmake_modules" \
-DCMAKE_PREFIX_PATH="_ABSOLUTE_PATH_TO_ROCR_LIBS_"
..
// Builds Release version - default // Builds Release version - default
// Assumes pwd is .../roc_bandwidth_test/build // Assumes pwd is _ABSOLUTE_PATH_TO_RBT/roc_bandwidth_test/build
e.g. cmake -DROCR_LIB_DIR="Path of ROC Runtime Library Files" \ e.g. cmake -DCMAKE_MODULE_PATH="_ABSOLUTE_PATH_TO_RBT/roc_bandwidth_test/cmake_modules" \
-DROCR_INC_DIR="Path of ROC Runtime Header Files" \ -DCMAKE_PREFIX_PATH="_ABSOLUTE_PATH_TO_ROCR_LIBS_"
.. ..
--- Invoke the native build rules generated by cmake to build the various --- Invoke the native build rules generated by cmake to build the various
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment