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
96295afe
Unverified
Commit
96295afe
authored
Jul 31, 2020
by
Ramesh Errabolu
Committed by
GitHub
Jul 31, 2020
Browse files
Merge pull request #59 from ashutom/adapt_HSA
Adapting the HSA changes
parents
f671f73b
62f3ede8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
57 deletions
+16
-57
CMakeLists.txt
CMakeLists.txt
+12
-53
base_test.hpp
base_test.hpp
+1
-1
common.hpp
common.hpp
+2
-2
rocm_bandwidth_test.hpp
rocm_bandwidth_test.hpp
+1
-1
No files found.
CMakeLists.txt
View file @
96295afe
...
@@ -27,6 +27,12 @@ cmake_minimum_required(VERSION 2.8.0)
...
@@ -27,6 +27,12 @@ cmake_minimum_required(VERSION 2.8.0)
#
#
#
#
# Specify name of project to build, install and package
set
(
PROJECT_NAME
"rocm-bandwidth-test"
)
set
(
TEST_NAME
"
${
PROJECT_NAME
}
"
)
project
(
${
PROJECT_NAME
}
)
# Build is not supported on Windows plaform
# Build is not supported on Windows plaform
if
(
WIN32
)
if
(
WIN32
)
message
(
"Windows platfom is not supported"
)
message
(
"Windows platfom is not supported"
)
...
@@ -103,61 +109,15 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
...
@@ -103,61 +109,15 @@ elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86")
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m32"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m32"
)
endif
()
endif
()
# Specify name of project to build, install a
nd
package
fi
nd
_
package
(
hsa-runtime64 REQUIRED
set
(
PROJECT_NAME
"rocm-bandwidth-test"
)
PATHS /opt/rocm
set
(
TEST_NAME
"
${
PROJECT_NAME
}
"
)
)
project
(
${
PROJECT_NAME
}
)
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"
)
# Bind default root directory to look for ROCm artifacts
# such as ROCr header and ROCr, ROCt libraries
set
(
ROCM_ROOT /opt/rocm/ CACHE PATH
"Root of ROCm"
)
if
(
DEFINED ENV{CMAKE_PREFIX_PATH}
)
set
(
CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}
)
endif
()
if
(
CMAKE_PREFIX_PATH
)
set
(
ROCM_ROOT
${
CMAKE_PREFIX_PATH
}
CACHE PATH
"Root of ROCm"
)
endif
()
# Search for ROCr header file
find_path
(
ROCR_HDR hsa/hsa.h PATHS
${
ROCM_ROOT
}
PATH_SUFFIXES include
)
if
(
NOT ROCR_HDR
)
message
(
"Rocr Header hsa/hsa.h not found"
)
return
()
endif
()
# Add directories to look for header files to compile
INCLUDE_DIRECTORIES
(
${
ROCR_HDR
}
)
# Search for ROCr library file
find_library
(
ROCR_LIB
${
CORE_RUNTIME_TARGET
}
PATHS
${
ROCM_ROOT
}
PATH_SUFFIXES lib lib64
)
if
(
NOT ROCR_LIB
)
message
(
"Rocr Library
${
CORE_RUNTIME_TARGET
}
not found"
)
return
()
endif
()
# Search for ROCr library file
find_library
(
ROCT_LIB
${
ROC_THUNK_NAME
}
PATHS
${
ROCM_ROOT
}
PATH_SUFFIXES lib lib64
)
if
(
NOT ROCT_LIB
)
message
(
"Roct Library
${
ROC_THUNK_NAME
}
not found"
)
return
()
endif
()
# Add ROCr library to be used in linking target
add_library
(
${
CORE_RUNTIME_TARGET
}
SHARED IMPORTED GLOBAL
)
set_target_properties
(
${
CORE_RUNTIME_TARGET
}
PROPERTIES
IMPORTED_LOCATION
"
${
ROCR_LIB
}
"
INTERFACE_INCLUDE_DIRECTORIES
"
${
ROCR_HDR
}
"
)
# Add ROCr library to be used in linking target
add_library
(
${
ROC_THUNK_NAME
}
SHARED IMPORTED GLOBAL
)
set_target_properties
(
${
ROC_THUNK_NAME
}
PROPERTIES
IMPORTED_LOCATION
"
${
ROCT_LIB
}
"
)
# Add cmake_modules to default module path if it is not
# Add cmake_modules to default module path if it is not
# already set and include utils from cmake modules
# already set and include utils from cmake modules
if
(
NOT DEFINED CMAKE_MODULE_PATH
)
if
(
NOT DEFINED CMAKE_MODULE_PATH
)
...
@@ -192,9 +152,8 @@ aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} Src)
...
@@ -192,9 +152,8 @@ 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
}
${
ROC_THUNK_NAME
}
)
target_link_libraries
(
${
TEST_NAME
}
PRIVATE hsa-runtime64::hsa-runtime64
)
target_link_libraries
(
${
TEST_NAME
}
${
CORE_RUNTIME_TARGET
}
)
target_link_libraries
(
${
TEST_NAME
}
PRIVATE c stdc++ dl pthread rt
)
target_link_libraries
(
${
TEST_NAME
}
c stdc++ dl pthread rt
)
# Update linker flags to include RPATH
# Update linker flags to include RPATH
# Add --enable-new-dtags to generate DT_RUNPATH
# Add --enable-new-dtags to generate DT_RUNPATH
...
...
base_test.hpp
View file @
96295afe
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#ifndef ROC_BANDWIDTH_TEST_BASE_H_
#ifndef ROC_BANDWIDTH_TEST_BASE_H_
#define ROC_BANDWIDTH_TEST_BASE_H_
#define ROC_BANDWIDTH_TEST_BASE_H_
#include "hsa
/hsa
.h"
#include "hsa.h"
#include <iostream>
#include <iostream>
#include <string>
#include <string>
#include <vector>
#include <vector>
...
...
common.hpp
View file @
96295afe
...
@@ -48,8 +48,8 @@
...
@@ -48,8 +48,8 @@
#include <vector>
#include <vector>
#include <cmath>
#include <cmath>
#include <stdio.h>
#include <stdio.h>
#include "hsa
/hsa
.h"
#include "hsa.h"
#include "hsa
/hsa
_ext_amd.h"
#include "hsa_ext_amd.h"
using
namespace
std
;
using
namespace
std
;
...
...
rocm_bandwidth_test.hpp
View file @
96295afe
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
#ifndef __ROC_BANDWIDTH_TEST_H__
#ifndef __ROC_BANDWIDTH_TEST_H__
#define __ROC_BANDWIDTH_TEST_H__
#define __ROC_BANDWIDTH_TEST_H__
#include "hsa
/hsa
.h"
#include "hsa.h"
#include "base_test.hpp"
#include "base_test.hpp"
#include "hsatimer.hpp"
#include "hsatimer.hpp"
#include "common.hpp"
#include "common.hpp"
...
...
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