summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0-r1.ebuild (renamed from dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0.ebuild)52
1 files changed, 47 insertions, 5 deletions
diff --git a/dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0.ebuild b/dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0-r1.ebuild
index f73d7b0ff195..c5be88d58c53 100644
--- a/dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0.ebuild
+++ b/dev-util/rocm_bandwidth_test/rocm_bandwidth_test-7.1.0-r1.ebuild
@@ -3,7 +3,8 @@
EAPI=8
-inherit cmake
+ROCM_VERSION=${PV}
+inherit cmake rocm
DESCRIPTION="Bandwidth test for ROCm"
HOMEPAGE="https://github.com/ROCm/rocm_bandwidth_test"
@@ -14,26 +15,41 @@ LICENSE="MIT"
SLOT="0/$(ver_cut 1-2)"
KEYWORDS="~amd64"
+REQUIRED_USE="${ROCM_REQUIRED_USE}"
+
RDEPEND="
dev-libs/rocr-runtime:${SLOT}
dev-util/hip:${SLOT}
+ dev-libs/boost:=[stacktrace]
dev-libs/libfmt:=
dev-libs/spdlog:=
+ net-misc/curl
sys-process/numactl
"
DEPEND="
${RDEPEND}
dev-cpp/nlohmann_json
dev-util/hipcc
- dev-libs/boost[stacktrace]
- net-misc/curl
dev-cpp/cli11
dev-cpp/catch
"
PATCHES=( "${FILESDIR}"/rocm_bandwidth_test-7.1.0-nogit.patch )
+tb_plugin_wrapper() {
+ local PATCHES=()
+ local CMAKE_USE_DIR="${S}/plugins/tb/transferbench"
+ local BUILD_DIR="${CMAKE_USE_DIR}/build"
+ "$@"
+}
+
src_prepare() {
+ # rocm_bandwidth_test cmake files reinvents variables for everything:
+ # installation paths, flags, generator, compiler, linker selection, etc.
+ # Then cmake calls bash, which calls another cmake, which ignores niceness, verbose logs, CXX, etc.
+ # That code is objectively bad, a lot of patches go below.
+ # See also: https://github.com/ROCm/rocm_bandwidth_test/issues/131
+
# Relax version checks
sed -e "s/ \${FMT_PKG_MINIMUM_REQUIRED_VERSION}//" -i cmake/build_utils.cmake || die
sed -e "s/ \${SPDLOG_PKG_MINIMUM_REQUIRED_VERSION}//" -i cmake/build_utils.cmake || die
@@ -43,7 +59,6 @@ src_prepare() {
sed -e "/set(CATCH2_PACKAGE_NAME/ s/catch2/Catch2/" -i cmake/build_utils.cmake || die
sed -e "s/ QUIT)/)/" -i main/cmdline/CMakeLists.txt || die
- # https://github.com/ROCm/rocm_bandwidth_test/issues/131
sed -e "/set(AMD_ROCM_STAGING_INSTALL_PATH/ s:/usr/local:${EPREFIX}/usr:" \
-e "/set(AMD_STANDALONE_STAGING_INSTALL_LIBDIR/ s/lib/$(get_libdir)/" \
-e "/set(AMD_STANDALONE_STAGING_INSTALL_EXPORTDIR/ s/lib/$(get_libdir)/" \
@@ -65,10 +80,22 @@ src_prepare() {
sed -e "s:./rocm_bandwidth_test:rocm_bandwidth_test:" -i bin/rbt_run_tb || die
+ # Let the user decide, which programs to use (definitely not `gcc -fuse-ld=lld`)
+ # Bug: https://bugs.gentoo.org/965916
+ sed -e '/find_program(CCACHE_PATH/d' -e '/find_program(LD_LLD_PATH/d' \
+ -e '/find_program(LD_MOLD_PATH/d' -i cmake/build_utils.cmake || die
+
+ # Cleanup build script as we build in src_compile.
+ # This shell script basically calls "cmake ... && cmake install",
+ # we replace it with normal cmake.eclass functions with tb_plugin_wrapper.
+ echo "" > plugins/tb/transferbench/build_libamd_tb.sh || die
+
cmake_src_prepare
+ tb_plugin_wrapper cmake_src_prepare
}
src_configure() {
+ # Configure plugin launcher (can be compiled with any compiler)
local mycmakeargs=(
-DROCM_PATH="${EPREFIX}/usr"
-DUSE_LOCAL_FMT_LIB=ON
@@ -78,15 +105,30 @@ src_configure() {
-DUSE_LOCAL_CLI11=ON
-DUSE_LOCAL_CATCH2=ON
+ -DAMD_APP_BUILD_DOCS=OFF
+ -DAMD_APP_BUILD_EXAMPLES=OFF
-DAMD_APP_COMPILER_TRY_CLANG=OFF
-DAMD_APP_STANDALONE_BUILD_PACKAGE=ON
-DAMD_APP_TREAT_WARNINGS_AS_ERRORS=OFF
-Wno-dev
)
cmake_src_configure
+
+ # Configure tb plugin (HIP code)
+ rocm_use_clang
+ mycmakeargs=(
+ -DBUILD_INTERNAL_BINARY_VERSION=$(< VERSION)
+ -DGPU_TARGETS="$(get_amdgpu_flags)"
+ -DHSA_INCLUDE_DIR="${EPREFIX}/usr/include/hsa"
+ -DROCM_PATH="${EPREFIX}/usr"
+ )
+ tb_plugin_wrapper cmake_src_configure
}
src_compile() {
- cmake_src_compile AMD_TB_LIBRARY
+ # tb plugin must be compiled before transferbench
+ tb_plugin_wrapper cmake_src_compile
+ cp "${S}"/plugins/tb/transferbench/build/libamd_tb.* "${S}/plugins/tb/lib" || die
+
cmake_src_compile
}