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
6c39068f
Commit
6c39068f
authored
Nov 17, 2017
by
Ramesh Errabolu
Browse files
Update CMakeListst.txt to be build in ROCm repo forest
parent
3be08c98
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
48 deletions
+101
-48
CMakeLists.txt
CMakeLists.txt
+97
-45
common.cpp
common.cpp
+1
-1
common.hpp
common.hpp
+1
-0
rocm_bandwidth_test.cpp
rocm_bandwidth_test.cpp
+1
-1
rocm_bandwidth_test_trans.cpp
rocm_bandwidth_test_trans.cpp
+1
-1
No files found.
CMakeLists.txt
View file @
6c39068f
...
@@ -24,67 +24,119 @@ cmake_minimum_required(VERSION 2.8.0)
...
@@ -24,67 +24,119 @@ cmake_minimum_required(VERSION 2.8.0)
# @note: Add -DCMAKE_BUILD_TYPE=Debug if you want to build Debug
# @note: Add -DCMAKE_BUILD_TYPE=Debug if you want to build Debug
#
#
# Build is not supported on Windows plaform
if
(
WIN32
)
if
(
WIN32
)
MESSAGE
(
"Windows platfom is not supported"
)
message
(
"Windows platfom is not supported"
)
R
RETURN
()
RETURN
()
endif
()
endif
()
#
# Flag to enable / disable verbose output.
# Flag to enable / disable verbose output.
#
SET
(
CMAKE_VERBOSE_MAKEFILE on
)
SET
(
CMAKE_VERBOSE_MAKEFILE on
)
# Compiler Preprocessor definitions.
#
add_definitions
(
-D__linux__
)
# Determin Roc Runtime header files are accessible
add_definitions
(
-DUNIX_OS
)
#
add_definitions
(
-DLINUX
)
if
(
NOT EXISTS
${
ROCR_INC_DIR
}
/hsa/hsa.h
)
add_definitions
(
-D__AMD64__
)
MESSAGE
(
"ERROR: ROC Runtime headers can't be found under specified path"
)
add_definitions
(
-D__x86_64__
)
RETURN
()
add_definitions
(
-DAMD_INTERNAL_BUILD
)
add_definitions
(
-DLITTLEENDIAN_CPU=1
)
add_definitions
(
-DHSA_LARGE_MODEL=
)
add_definitions
(
-DHSA_DEPRECATED=
)
# Enable debug trace
if
(
DEFINED ENV{CMAKE_DEBUG_TRACE}
)
add_definitions
(
-DDEBUG_TRACE=1
)
endif
()
endif
()
#
# Set core runtime module name
#
set
(
ROC_THUNK_NAME
"hsakmt"
)
set
(
CORE_RUNTIME_NAME
"hsa-runtime"
)
set
(
ROC_THUNK_LIBRARY
"lib
${
ROC_THUNK_NAME
}
"
)
set
(
CORE_RUNTIME_TARGET
"
${
CORE_RUNTIME_NAME
}
64"
)
set
(
CORE_RUNTIME_LIBRARY
"lib
${
CORE_RUNTIME_TARGET
}
"
)
if
(
NOT EXISTS
${
ROCR_LIB_DIR
}
/
${
CORE_RUNTIME_LIBRARY
}
.so
)
# Linux Compiler options
MESSAGE
(
"ERROR: ROC Runtime libraries can't be found under sprcified path"
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11"
)
RETURN
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Werror"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Werror=return-type"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fPIC"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-rtti"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fexceptions"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-math-errno"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fms-extensions"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fvisibility=hidden"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fmerge-all-constants"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-threadsafe-statics"
)
# CLANG options
if
(
"$ENV{CXX}"
STREQUAL
"/usr/bin/clang++"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-ferror-limit=1000000"
)
endif
()
endif
()
set
(
PROJECT_NAME
"rocm_bandwidth_test"
)
set
(
CMAKE_SHARED_LINKER_FLAGS
"-Wl,-Bdynamic -Wl,-z,noexecstack"
)
set
(
TEST_NAME
"
${
PROJECT_NAME
}
"
)
set
(
CMAKE_SKIP_BUILD_RPATH TRUE
)
project
(
${
PROJECT_NAME
}
)
string
(
TOLOWER
"
${
CMAKE_BUILD_TYPE
}
"
tmp
)
# Check Env vars
if
(
"
${
tmp
}
"
STREQUAL
"debug"
)
if
(
NOT DEFINED CMAKE_BUILD_TYPE OR
"
${
CMAKE_BUILD_TYPE
}
"
STREQUAL
""
)
set
(
ISDEBUG
"1"
)
if
(
DEFINED ENV{CMAKE_BUILD_TYPE}
)
add_definitions
(
-DDEBUG
)
set
(
CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE}
)
endif
()
endif
()
endif
()
if
(
ISDEBUG
)
if
(
NOT DEFINED CMAKE_PREFIX_PATH AND DEFINED ENV{CMAKE_PREFIX_PATH}
)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -O0"
)
set
(
CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}
)
endif
()
# Extend Compiler flags based on build type
string
(
TOLOWER
"
${
CMAKE_BUILD_TYPE
}
"
CMAKE_BUILD_TYPE
)
if
(
"
${
CMAKE_BUILD_TYPE
}
"
STREQUAL debug
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-ggdb"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-ggdb"
)
set
(
CMAKE_BUILD_TYPE
"debug"
)
else
()
else
()
set
(
CMAKE_
CXX_FLAGS
"-std=c++11 -O2
"
)
set
(
CMAKE_
BUILD_TYPE
"release
"
)
endif
()
endif
()
#
# Extend Compiler flags based on Processor architecture
# Set the remaining compiler flags
if
(
"
${
CMAKE_SYSTEM_PROCESSOR
}
"
STREQUAL
"x86_64"
)
#
set
(
NBIT 64
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Wall"
)
set
(
NBITSTR
"64"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-Werror"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m64 -msse -msse2"
)
elseif
(
"
${
CMAKE_SYSTEM_PROCESSOR
}
"
STREQUAL
"x86"
)
set
(
NBIT 32
)
set
(
NBITSTR
""
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-m32"
)
endif
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-rtti"
)
# Set project requirements
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fexceptions"
)
set
(
ROC_THUNK_NAME
"hsakmt"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-math-errno"
)
set
(
CORE_RUNTIME_NAME
"hsa-runtime"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fms-extensions"
)
set
(
ROC_THUNK_LIBRARY
"lib
${
ROC_THUNK_NAME
}
"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fmerge-all-constants"
)
set
(
CORE_RUNTIME_TARGET
"
${
CORE_RUNTIME_NAME
}
64"
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-fno-threadsafe-statics"
)
set
(
CORE_RUNTIME_LIBRARY
"lib
${
CORE_RUNTIME_TARGET
}
"
)
# Determine Roc Runtime header files are accessible
if
(
NOT EXISTS
${
ROCR_INC_DIR
}
/hsa/hsa.h
)
message
(
"ERROR: ROC Runtime headers can't be found under specified path"
)
RETURN
()
endif
()
if
(
NOT EXISTS
${
ROCR_LIB_DIR
}
/
${
CORE_RUNTIME_LIBRARY
}
.so
)
message
(
"ERROR: ROC Runtime libraries can't be found under sprcified path"
)
RETURN
()
endif
()
# Basic Tool Chain Information
message
(
" "
)
message
(
"----------------NBIT:
${
NBIT
}
"
)
message
(
"-----------BuildType:
${
CMAKE_BUILD_TYPE
}
"
)
message
(
"------------Compiler:
${
CMAKE_CXX_COMPILER
}
"
)
message
(
"----Compiler-Version:
${
CMAKE_CXX_COMPILER_VERSION
}
"
)
message
(
"-----HSA-Runtime-Inc:
${
ROCR_INC_DIR
}
"
)
message
(
"-----HSA-Runtime-Lib:
${
ROCR_LIB_DIR
}
"
)
message
(
"-----CMAKE_CXX_FLAGS:
${
CMAKE_CXX_FLAGS
}
"
)
message
(
"---CMAKE_PREFIX_PATH:
${
CMAKE_PREFIX_PATH
}
"
)
message
(
" "
)
set
(
PROJECT_NAME
"rocm_bandwidth_test"
)
set
(
TEST_NAME
"
${
PROJECT_NAME
}
"
)
project
(
${
PROJECT_NAME
}
)
INCLUDE_DIRECTORIES
(
${
ROCR_INC_DIR
}
)
INCLUDE_DIRECTORIES
(
${
ROCR_INC_DIR
}
)
...
@@ -94,5 +146,5 @@ LINK_DIRECTORIES(${ROCR_LIB_DIR})
...
@@ -94,5 +146,5 @@ LINK_DIRECTORIES(${ROCR_LIB_DIR})
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
Src
)
aux_source_directory
(
${
CMAKE_CURRENT_SOURCE_DIR
}
Src
)
add_executable
(
${
TEST_NAME
}
${
Src
}
)
add_executable
(
${
TEST_NAME
}
${
Src
}
)
target_link_libraries
(
${
TEST_NAME
}
${
CORE_RUNTIME_TARGET
}
c stdc++ dl pthread rt
)
target_link_libraries
(
${
TEST_NAME
}
${
CORE_RUNTIME_TARGET
}
${
ROC_THUNK_NAME
}
c stdc++ dl pthread rt
)
common.cpp
View file @
6c39068f
...
@@ -46,7 +46,7 @@ void error_check(hsa_status_t hsa_error_code, int line_num, const char* str) {
...
@@ -46,7 +46,7 @@ void error_check(hsa_status_t hsa_error_code, int line_num, const char* str) {
if
(
hsa_error_code
!=
HSA_STATUS_SUCCESS
&&
if
(
hsa_error_code
!=
HSA_STATUS_SUCCESS
&&
hsa_error_code
!=
HSA_STATUS_INFO_BREAK
)
{
hsa_error_code
!=
HSA_STATUS_INFO_BREAK
)
{
printf
(
"HSA Error Found! In file: %s; At line: %d
\n
"
,
str
,
line_num
);
printf
(
"HSA Error Found! In file: %s; At line: %d
\n
"
,
str
,
line_num
);
const
char
*
string
=
nullptr
;
const
char
*
string
=
NULL
;
hsa_status_string
(
hsa_error_code
,
&
string
);
hsa_status_string
(
hsa_error_code
,
&
string
);
printf
(
"Error: %s
\n
"
,
string
);
printf
(
"Error: %s
\n
"
,
string
);
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
...
...
common.hpp
View file @
6c39068f
...
@@ -47,6 +47,7 @@
...
@@ -47,6 +47,7 @@
#include <iostream>
#include <iostream>
#include <vector>
#include <vector>
#include <cmath>
#include <cmath>
#include <stdio.h>
#include "hsa/hsa.h"
#include "hsa/hsa.h"
#include "hsa/hsa_ext_amd.h"
#include "hsa/hsa_ext_amd.h"
...
...
rocm_bandwidth_test.cpp
View file @
6c39068f
...
@@ -425,7 +425,7 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
...
@@ -425,7 +425,7 @@ void RocmBandwidthTest::RunCopyBenchmark(async_trans_t& trans) {
buf_dst_fwd
,
buf_dst_rev
,
signal_fwd
,
signal_rev
);
buf_dst_fwd
,
buf_dst_rev
,
signal_fwd
,
signal_rev
);
if
(
validate_
)
{
if
(
validate_
)
{
hsa_signal_t
fake_signal
{
0
};
hsa_signal_t
fake_signal
=
{
0
};
ReleaseBuffers
(
false
,
validation_src
,
NULL
,
ReleaseBuffers
(
false
,
validation_src
,
NULL
,
validation_dst
,
NULL
,
validation_signal
,
fake_signal
);
validation_dst
,
NULL
,
validation_signal
,
fake_signal
);
}
}
...
...
rocm_bandwidth_test_trans.cpp
View file @
6c39068f
...
@@ -73,7 +73,7 @@ bool RocmBandwidthTest::BuildReadOrWriteTrans(uint32_t req_type,
...
@@ -73,7 +73,7 @@ bool RocmBandwidthTest::BuildReadOrWriteTrans(uint32_t req_type,
// Agent has access, build an instance of transaction
// Agent has access, build an instance of transaction
// and add it to the list of transactions
// and add it to the list of transactions
async_trans_t
trans
(
req_type
);
async_trans_t
trans
(
req_type
);
trans
.
kernel
.
code_
=
nullptr
;
trans
.
kernel
.
code_
=
NULL
;
trans
.
kernel
.
pool_
=
pool
;
trans
.
kernel
.
pool_
=
pool
;
trans
.
kernel
.
pool_idx_
=
pool_idx
;
trans
.
kernel
.
pool_idx_
=
pool_idx
;
trans
.
kernel
.
agent_
=
exec_agent
;
trans
.
kernel
.
agent_
=
exec_agent
;
...
...
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