120 lines
3.9 KiB
RPMSpec
120 lines
3.9 KiB
RPMSpec
#
|
|
# spec file for package hipify
|
|
#
|
|
# 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 HIPIFY
|
|
|
|
%global rocm_release 6.4
|
|
%global rocm_patch 1
|
|
%global rocm_version %{rocm_release}.%{rocm_patch}
|
|
|
|
# This is a clang tool so best to build with clang
|
|
%global toolchain clang
|
|
|
|
Name: hipify
|
|
Version: %{rocm_version}
|
|
Release: 5%{?dist}
|
|
Summary: Convert CUDA to HIP
|
|
|
|
URL: https://github.com/ROCm
|
|
License: MIT
|
|
Source0: %{url}/%{upstreamname}/archive/rocm-%{version}.tar.gz#/%{upstreamname}-%{version}.tar.gz
|
|
Patch0: 0001-prepare-hipify-cmake-for-fedora.patch
|
|
|
|
BuildRequires: chrpath
|
|
BuildRequires: cmake
|
|
BuildRequires: gcc-c++
|
|
BuildRequires: perl
|
|
# System clang may be too old, use rocm-llvm
|
|
BuildRequires: rocm-llvm-static
|
|
BuildRequires: rocm-clang-devel
|
|
BuildRequires: rocm-compilersupport-macros
|
|
BuildRequires: zlib-devel
|
|
|
|
Requires: perl
|
|
|
|
# ROCm is really only on x86_64
|
|
ExclusiveArch: x86_64
|
|
|
|
%description
|
|
HIPIFY is a set of tools to translate CUDA source code into portable
|
|
HIP C++ automatically.
|
|
|
|
%prep
|
|
%autosetup -p1 -n %{upstreamname}-rocm-%{version}
|
|
|
|
%build
|
|
%cmake \
|
|
-DCMAKE_CXX_COMPILER=%rocmllvm_bindir/clang++ \
|
|
-DCMAKE_C_COMPILER=%rocmllvm_bindir/clang \
|
|
-DCMAKE_PREFIX_PATH=%{rocmllvm_cmakedir}/..
|
|
|
|
%cmake_build
|
|
|
|
%check
|
|
echo "void f(int *a, const cudaDeviceProp *b) { cudaChooseDevice(a,b); }" > b.cu
|
|
echo "void f(int *a, const hipDeviceProp_t *b) { hipChooseDevice(a,b); }" > e.hip
|
|
./bin/hipify-perl b.cu -o t.hip
|
|
diff e.hip t.hip
|
|
|
|
%install
|
|
%cmake_install
|
|
rm -rf %{buildroot}/usr/hip
|
|
# Fix executable perm:
|
|
chmod a+x %{buildroot}%{_bindir}/*
|
|
# Fix script shebang (Fedora doesn't allow using "env"):
|
|
sed -i 's|\(/usr/bin/\)env perl|\1perl|' %{buildroot}%{_bindir}//hipify-perl
|
|
|
|
# Fix
|
|
# /usr/bin/hipify-clang: error while loading shared libraries: libclang-cpp.so.19.0git
|
|
chrpath %{buildroot}%{_bindir}/hipify-clang -r %rocmllvm_libdir
|
|
|
|
rm -rf %{buildroot}%{_includedir}
|
|
|
|
%files
|
|
%doc README.md
|
|
%license LICENSE.txt
|
|
%{_bindir}/hipconvertinplace-perl.sh
|
|
%{_bindir}/hipconvertinplace.sh
|
|
%{_bindir}/hipexamine-perl.sh
|
|
%{_bindir}/hipexamine.sh
|
|
%{_bindir}/hipify-clang
|
|
%{_bindir}/hipify-perl
|
|
%{_libexecdir}/%{name}
|
|
|
|
%changelog
|