Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
wangsen
rocm_bandwidth_test
Commits
55d36484
Unverified
Commit
55d36484
authored
Aug 22, 2020
by
Ramesh Errabolu
Committed by
GitHub
Aug 22, 2020
Browse files
Merge pull request #62 from ashutom/failsafe_hsa
Failsafe find_package(hsa
parents
7480780b
848d7edb
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
CMakeLists.txt
CMakeLists.txt
+23
-6
Readme.md
Readme.md
+14
-7
No files found.
CMakeLists.txt
View file @
55d36484
...
@@ -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
...
...
Readme.md
View file @
55d36484
...
@@ -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 -D
ROCR_LIB_DIR="Path of ROC Runtime Library Fi
les" \
e.g. cmake -D
CMAKE_MODULE_PATH="_ABSOLUTE_PATH_TO_RBT/roc_bandwidth_test/cmake_modu
les" \
-D
ROCR_INC_DIR="Path of ROC Runtime Header Files" \
-D
CMAKE_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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment