SHA256
1
0
forked from ROCm/roctracer
Files
roctracer/roctracer.spec
2025-10-28 08:57:42 +01:00

227 lines
6.3 KiB
RPMSpec

#
# spec file for package roctracer
#
# Copyright Fedora Project Authors.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global upstreamname roctracer
%global rocm_release 6.4
%global rocm_patch 0
%global rocm_version %{rocm_release}.%{rocm_patch}
%global toolchain clang
# hipcc does not support some clang flags
%global build_cxxflags %(echo %{optflags} | sed -e 's/-fstack-protector-strong/-Xarch_host -fstack-protector-strong/' -e 's/-fcf-protection/-Xarch_host -fcf-protection/')
# Needs ROCm HW and is only suitable for local testing
# GPU_TARGETS in the cmake config are only for testing
%bcond_with test
%if %{with test}
# rpm flags interfere with building the tests
%global build_cflags %{nil}
%endif
%bcond_with doc
# Compression type and level for source/binary package payloads.
# "w7T0.xzdio" xz level 7 using %%{getncpus} threads
%define _source_payload w7T0.xzdio
%define _binary_payload w7T0.xzdio
Name: roctracer
Version: %{rocm_version}
Release: 6%{?dist}
Summary: ROCm Tracer Callback/Activity Library for Performance tracing AMD GPUs
URL: https://github.com/ROCm/%{upstreamname}
License: MIT
Source0: %{url}/archive/rocm-%{rocm_version}.tar.gz#/%{upstreamname}-%{rocm_version}.tar.gz
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: rocm-cmake
BuildRequires: rocm-comgr-devel
BuildRequires: rocm-compilersupport-macros
BuildRequires: rocm-hip-devel
BuildRequires: rocm-rpm-macros
BuildRequires: rocm-runtime-devel
%if 0%{?suse_version}
BuildRequires: python3-CppHeaderParser
BuildRequires: libatomic1
%else
BuildRequires: libatomic
# https://github.com/ROCm/roctracer/issues/113
BuildRequires: python3-cppheaderparser
%endif
%if %{with doc}
BuildRequires: doxygen
BuildRequires: texlive-adjustbox
BuildRequires: texlive-dvips
BuildRequires: texlive-ec
BuildRequires: texlive-hanging
BuildRequires: texlive-latex
BuildRequires: texlive-makeindex
BuildRequires: texlive-metafont
BuildRequires: texlive-multirow
BuildRequires: texlive-newunicodechar
BuildRequires: texlive-stackengine
BuildRequires: texlive-texlive-scripts
BuildRequires: texlive-tocloft
BuildRequires: texlive-ulem
BuildRequires: texlive-url
BuildRequires: texlive-wasy
BuildRequires: texlive-wasysym
%endif
# ROCm is only x86_64 for now
ExclusiveArch: x86_64
%description
ROC-tracer
* ROC-tracer library: Runtimes Generic Callback/Activity APIs
The goal of the implementation is to provide a generic independent
from specific runtime profiler to trace API and asynchronous activity.
The API provides functionality for registering the runtimes API
callbacks and asynchronous activity records pool support.
* ROC-TX library: Code Annotation Events API
Includes API for:
* roctxMark
* roctxRangePush
* roctxRangePop
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%package devel
Summary: The %{name} development package
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The headers of libraries for %{name}.
%if %{with doc}
%package doc
Summary: Docs for %{name}
%description doc
%{summary}
%endif
%if %{with test}
%package test
Summary: Tests for %{name}
Requires: %{name}%{?_isa} = %{version}-%{release}
%description test
%{summary}
%endif
%prep
%autosetup -p1 -n %{upstreamname}-rocm-%{version}
# No knob in cmake to turn off testing
%if %{without test}
sed -i -e 's@add_subdirectory(test)@#add_subdirectory(test)@' CMakeLists.txt
%else
# Adjust test running script lib dir
sed -i -e 's@../lib/@../lib64/@' test/run.sh
%endif
%build
%cmake \
-DCMAKE_CXX_COMPILER=%rocmllvm_bindir/clang++ \
-DCMAKE_C_COMPILER=%rocmllvm_bindir/clang \
-DCMAKE_MODULE_PATH=%{_libdir}/cmake/hip \
-DCMAKE_PREFIX_PATH=%{rocmllvm_cmakedir}/.. \
-DBUILD_FILE_REORG_BACKWARD_COMPATIBILITY=OFF \
-DROCM_SYMLINK_LIBS=OFF \
-DGPU_TARGETS=%{rocm_gpu_list_test} \
-DHIP_PLATFORM=amd \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=RelDebInfo
%cmake_build
%if %{with doc}
%cmake_build -t doc
%endif
%install
%cmake_install
# Only install the pdf
rm -rf rm %{buildroot}%{_datadir}/html
%files
%dir %{_libdir}/%{name}
%license LICENSE
%doc README.md
%{_libdir}/lib%{name}64.so.*
%{_libdir}/libroctx64.so.*
%{_libdir}/%{name}/libfile_plugin.so
%{_libdir}/%{name}/libhip_stats.so
%{_libdir}/%{name}/libroctracer_tool.so
%exclude %{_docdir}/%{name}*/LICENSE
%files devel
%{_includedir}/%{name}
%{_libdir}/lib%{name}64.so
%{_libdir}/libroctx64.so
%if %{with doc}
%files doc
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/%{name}.pdf
%endif
%if %{with test}
%files test
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%endif
%changelog