* add hipfft
This commit is contained in:
parent
2c30f1b12c
commit
a55f44e62a
23
rocm/hipfft/.SRCINFO
Normal file
23
rocm/hipfft/.SRCINFO
Normal file
@ -0,0 +1,23 @@
|
||||
pkgbase = hipfft
|
||||
pkgdesc = rocFFT marshalling library.
|
||||
pkgver = 6.2.4
|
||||
pkgrel = 1
|
||||
url = https://rocm.docs.amd.com/projects/hipFFT/en/latest/index.html
|
||||
arch = x86_64
|
||||
arch = powerpc64le
|
||||
arch = powerpc64
|
||||
arch = riscv64
|
||||
license = MIT
|
||||
makedepends = cmake
|
||||
makedepends = rocm-cmake
|
||||
makedepends = git
|
||||
depends = rocm-core
|
||||
depends = glibc
|
||||
depends = gcc-libs
|
||||
depends = hip-runtime-amd
|
||||
depends = rocfft
|
||||
options = !lto
|
||||
source = hipfft-6.2.4.tar.gz::https://github.com/ROCm/hipFFT/archive/rocm-6.2.4.tar.gz
|
||||
sha256sums = 308b81230498b01046f7fc3299a9e9c2c5456d80fd71a94f490ad97f51ed9de8
|
||||
|
||||
pkgname = hipfft
|
5
rocm/hipfft/.nvchecker.toml
Normal file
5
rocm/hipfft/.nvchecker.toml
Normal file
@ -0,0 +1,5 @@
|
||||
[hipfft]
|
||||
source = 'github'
|
||||
github = 'ROCm/hipFFT'
|
||||
use_latest_release = true
|
||||
prefix = 'rocm-'
|
39
rocm/hipfft/PKGBUILD
Normal file
39
rocm/hipfft/PKGBUILD
Normal file
@ -0,0 +1,39 @@
|
||||
# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
|
||||
# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
|
||||
|
||||
pkgname=hipfft
|
||||
pkgver=6.2.4
|
||||
pkgrel=1
|
||||
pkgdesc='rocFFT marshalling library.'
|
||||
arch=(x86_64 powerpc64le powerpc64 riscv64)
|
||||
url='https://rocm.docs.amd.com/projects/hipFFT/en/latest/index.html'
|
||||
license=('MIT')
|
||||
depends=('rocm-core' 'glibc' 'gcc-libs' 'hip-runtime-amd' 'rocfft')
|
||||
makedepends=('cmake' 'rocm-cmake' 'git')
|
||||
_git='https://github.com/ROCm/hipFFT'
|
||||
source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz")
|
||||
sha256sums=('308b81230498b01046f7fc3299a9e9c2c5456d80fd71a94f490ad97f51ed9de8')
|
||||
options=(!lto)
|
||||
_dirname="$(basename "$_git")-$(basename "${source[0]}" ".tar.gz")"
|
||||
|
||||
build() {
|
||||
# -fcf-protection is not supported by HIP, see
|
||||
# https://rocm.docs.amd.com/projects/llvm-project/en/latest/reference/rocmcc.html#support-status-of-other-clang-options
|
||||
local cmake_args=(
|
||||
-Wno-dev
|
||||
-S "$_dirname"
|
||||
-B build
|
||||
-D CMAKE_BUILD_TYPE=None
|
||||
-D CMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc
|
||||
-D CMAKE_CXX_FLAGS="${CXXFLAGS} -fcf-protection=none"
|
||||
-D CMAKE_INSTALL_PREFIX=/opt/rocm
|
||||
)
|
||||
ROCM_PATH=/opt/rocm cmake "${cmake_args[@]}"
|
||||
cmake --build build
|
||||
}
|
||||
|
||||
package() {
|
||||
DESTDIR="$pkgdir" cmake --install build
|
||||
|
||||
install -Dm644 "$srcdir/$_dirname/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
}
|
51
rocm/hipfft/test.cpp
Normal file
51
rocm/hipfft/test.cpp
Normal file
@ -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);
|
||||
}
|
5
rocm/hipfft/test.sh
Executable file
5
rocm/hipfft/test.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#! /usr/bin/env sh
|
||||
|
||||
OUT=$(mktemp -d)
|
||||
/opt/rocm/bin/hipcc -o "$OUT"/test test.cpp -lhipfft -lrocfft
|
||||
"$OUT"/test
|
Loading…
x
Reference in New Issue
Block a user