Date: Wednesday, December 28, 2022 @ 15:24:05
Author: tpkessler
Revision: 1370928
archrelease: copy trunk to community-testing-x86_64
Added:
hipfft/repos/community-testing-x86_64/
hipfft/repos/community-testing-x86_64/PKGBUILD
(from rev 1370927, hipfft/trunk/PKGBUILD)
hipfft/repos/community-testing-x86_64/hipfft-no-git.patch
(from rev 1370927, hipfft/trunk/hipfft-no-git.patch)
hipfft/repos/community-testing-x86_64/test.cpp
(from rev 1370927, hipfft/trunk/test.cpp)
hipfft/repos/community-testing-x86_64/test.sh
(from rev 1370927, hipfft/trunk/test.sh)
---------------------+
PKGBUILD | 46 +++++++++++++++++++++++++++++++++++++++++++++
hipfft-no-git.patch | 12 +++++++++++
test.cpp | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
test.sh | 5 ++++
4 files changed, 114 insertions(+)
Copied: hipfft/repos/community-testing-x86_64/PKGBUILD (from rev 1370927,
hipfft/trunk/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD (rev 0)
+++ community-testing-x86_64/PKGBUILD 2022-12-28 15:24:05 UTC (rev 1370928)
@@ -0,0 +1,46 @@
+# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
+
+pkgname=hipfft
+pkgver=5.4.1
+pkgrel=2
+pkgdesc='rocFFT marshalling library.'
+arch=('x86_64')
+url='https://hipfft.readthedocs.io/en/latest/'
+license=('MIT')
+depends=('hip' 'rocfft')
+makedepends=('rocm-cmake')
+_git='https://github.com/ROCmSoftwarePlatform/hipFFT'
+source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz"
+ "hipfft-no-git.patch")
+sha256sums=('6ebe66858418f71ae13b14ef36628e3c6b6cd116964372c95ff241ed3082dce4'
+ '6bf435844134dc8e8909ec3f1b73e210e82d61b00b8a555106bd1570fda3294a')
+_dirname="$(basename "$_git")-$(basename "${source[0]}" ".tar.gz")"
+
+prepare() {
+ cd "$_dirname"
+ patch -Np1 -i "$srcdir/hipfft-no-git.patch"
+}
+
+build() {
+ # -fcf-protection is not supported by HIP, see
+ #
https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.4/page/Appendix_A.html
+ CXXFLAGS="${CXXFLAGS} -fcf-protection=none" \
+ ROCM_PATH=/opt/rocm \
+ cmake \
+ -Wno-dev \
+ -B build \
+ -S "$_dirname" \
+ -DCMAKE_BUILD_TYPE=None \
+ -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \
+ -DCMAKE_INSTALL_PREFIX=/opt/rocm
+ cmake --build build
+}
+
+package() {
+ DESTDIR="$pkgdir" cmake --install build
+
+ echo "/opt/rocm/$pkgname/lib" > "$pkgname.conf"
+ install -Dm644 "$pkgname.conf" "$pkgdir/etc/ld.so.conf.d/hipfft.conf"
+
+ install -Dm644 "$srcdir/$_dirname/LICENSE.md"
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}
Copied: hipfft/repos/community-testing-x86_64/hipfft-no-git.patch (from rev
1370927, hipfft/trunk/hipfft-no-git.patch)
===================================================================
--- community-testing-x86_64/hipfft-no-git.patch
(rev 0)
+++ community-testing-x86_64/hipfft-no-git.patch 2022-12-28 15:24:05 UTC
(rev 1370928)
@@ -0,0 +1,12 @@
+--- hipFFT-rocm-5.4.0/cmake/dependencies.cmake.bak 2022-12-09
17:36:51.944287264 +0100
++++ hipFFT-rocm-5.4.0/cmake/dependencies.cmake 2022-12-09 17:36:56.178248184
+0100
+@@ -21,9 +21,6 @@
+ #
+ #
#############################################################################
+
+-# Git
+-find_package(Git REQUIRED)
+-
+ # HIP
+ if( NOT CMAKE_CXX_COMPILER MATCHES ".*/hipcc$" )
+ if( NOT BUILD_WITH_LIB STREQUAL "CUDA" )
Copied: hipfft/repos/community-testing-x86_64/test.cpp (from rev 1370927,
hipfft/trunk/test.cpp)
===================================================================
--- community-testing-x86_64/test.cpp (rev 0)
+++ community-testing-x86_64/test.cpp 2022-12-28 15:24:05 UTC (rev 1370928)
@@ -0,0 +1,51 @@
+#include <hipfft/hipfft.h>
+#include <hip/hip_runtime.h>
+#include <vector>
+#include <numeric>
+#include <cmath>
+#include <iostream>
+
+int main()
+{
+ size_t size = 1024 * 1024;
+
+ hipfftComplex *x;
+ hipMalloc((void**)&x, sizeof *x * size);
+
+ std::vector<hipfftComplex> xin(size);
+ for(auto &xx: xin){
+ xx.x = 1.0f;
+ xx.y = 0.0f;
+ }
+ hipMemcpy(x, xin.data(), sizeof *x * size, hipMemcpyHostToDevice);
+
+ hipfftHandle plan;
+ hipfftPlan1d(&plan, size, HIPFFT_C2C, 1);
+
+ hipfftExecC2C(plan, x, x, HIPFFT_FORWARD);
+
+ std::vector<hipfftComplex> xout(size);
+ hipMemcpy(xout.data(), x, sizeof *x * size, hipMemcpyDeviceToHost);
+
+ std::vector<hipfftComplex> xref(size);
+ for(auto &xx: xref){
+ xx.x = 0.0f;
+ xx.y = 0.0f;
+ }
+ xref[0].x = 1.0f * size;
+
+ float tol = 0.001f;
+ for(size_t i = 0; i < size; i++){
+ if(std::abs(xref[i].x - xout[i].x) + std::abs(xref[i].y - xout[i].y) >
tol){
+ std::cout << "Element mismatch at index " << i << "\n";
+ std::cout << "Expected: " << xref[i].x << " " << xref[i].y << "\n";
+ std::cout << "Actual : " << xout[i].x << " " << xout[i].y << "\n";
+ return 1;
+ }
+ }
+
+ std::cout << "TESTS PASSED!" << std::endl;
+
+ hipFree(x);
+ hipfftDestroy(plan);
+}
Copied: hipfft/repos/community-testing-x86_64/test.sh (from rev 1370927,
hipfft/trunk/test.sh)
===================================================================
--- community-testing-x86_64/test.sh (rev 0)
+++ community-testing-x86_64/test.sh 2022-12-28 15:24:05 UTC (rev 1370928)
@@ -0,0 +1,5 @@
+#! /usr/bin/env sh
+
+OUT=$(mktemp -d)
+/opt/rocm/bin/hipcc -o "$OUT"/test test.cpp -lhipfft -lrocfft
+"$OUT"/test