diff options
author | Torsten Keßler | 2022-12-09 17:25:39 +0100 |
---|---|---|
committer | Torsten Keßler | 2022-12-09 17:25:39 +0100 |
commit | 68f54dd2305102131e964396f605d9241144028c (patch) | |
tree | d6dfd44a9cb5078dcc48500209d6799d7c3370ea | |
parent | 2ace23ff028d8d989721054a857c1c3c800d8b07 (diff) | |
download | aur-68f54dd2305102131e964396f605d9241144028c.tar.gz |
upgpkg: rocfft 5.4.0-1
Update to ROCm 5.4.0:
* simple test case to be run after package installation that checks if
it's correctly configured and installed.
* Set build type to None to match arch's cmake package standard.
* Add rocm-cmake as build dependency to avoid download during build.
* Update checksum.
-rw-r--r-- | .SRCINFO | 8 | ||||
-rw-r--r-- | PKGBUILD | 9 | ||||
-rw-r--r-- | test.cpp | 67 | ||||
-rwxr-xr-x | test.sh | 5 |
4 files changed, 81 insertions, 8 deletions
@@ -1,14 +1,14 @@ pkgbase = rocfft pkgdesc = Next generation FFT implementation for ROCm - pkgver = 5.3.0 + pkgver = 5.4.0 pkgrel = 1 url = https://rocfft.readthedocs.io/en/latest/library.html arch = x86_64 license = MIT - makedepends = cmake + makedepends = rocm-cmake depends = hip options = !lto - source = rocfft-5.3.0.tar.gz::https://github.com/ROCmSoftwarePlatform/rocFFT/archive/rocm-5.3.0.tar.gz - sha256sums = d655c5541c4aff4267e80e36d002fc3a55c2f84a0ae8631197c12af3bf03fa7d + source = rocfft-5.4.0.tar.gz::https://github.com/ROCmSoftwarePlatform/rocFFT/archive/rocm-5.4.0.tar.gz + sha256sums = d35a67332f4425fba1824eed78cf98d5c9a17a422614ff3f4cba2461df952336 pkgname = rocfft @@ -2,28 +2,29 @@ # Contributor: Jakub Okoński <jakub@okonski.org> # Contributor: Markus Näther <naetherm@cs.uni-freiburg.de> pkgname=rocfft -pkgver=5.3.0 +pkgver=5.4.0 pkgrel=1 pkgdesc='Next generation FFT implementation for ROCm' arch=('x86_64') url='https://rocfft.readthedocs.io/en/latest/library.html' license=('MIT') depends=('hip') -makedepends=('cmake') +makedepends=('rocm-cmake') _git='https://github.com/ROCmSoftwarePlatform/rocFFT' source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz") -sha256sums=('d655c5541c4aff4267e80e36d002fc3a55c2f84a0ae8631197c12af3bf03fa7d') +sha256sums=('d35a67332f4425fba1824eed78cf98d5c9a17a422614ff3f4cba2461df952336') options=(!lto) _dirname="$(basename "$_git")-$(basename "${source[0]}" ".tar.gz")" build() { # -fcf-protection is not supported by HIP, see - # https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.3/page/Appendix_A.html + # https://docs.amd.com/bundle/ROCm-Compiler-Reference-Guide-v5.4/page/Appendix_A.html CXXFLAGS="${CXXFLAGS} -fcf-protection=none" \ 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 diff --git a/test.cpp b/test.cpp new file mode 100644 index 000000000000..c1b0149915c2 --- /dev/null +++ b/test.cpp @@ -0,0 +1,67 @@ +#include <rocfft/rocfft.h> +#include <hip/hip_runtime.h> +#include <hip/hip_vector_types.h> +#include <vector> +#include <numeric> +#include <cmath> +#include <iostream> + +int main() +{ + size_t size = 1024 * 1024; + + rocfft_setup(); + + float2 *x; + hipMalloc((void**)&x, sizeof *x * size); + + + std::vector<float2> xin(size); + for(auto &xx: xin){ + xx.x = 1.0f; + xx.y = 0.0f; + } + hipMemcpy(x, xin.data(), sizeof *x * size, hipMemcpyHostToDevice); + + rocfft_plan plan = nullptr; + size_t len = size; + rocfft_plan_create(&plan, rocfft_placement_inplace, + rocfft_transform_type_complex_forward, rocfft_precision_single, + 1, &len, 1, nullptr); + size_t work_size = 0; + rocfft_plan_get_work_buffer_size(plan, &work_size); + void *work; + rocfft_execution_info info = nullptr; + if(work_size){ + rocfft_execution_info_create(&info); + hipMalloc((void**)&work, work_size); + rocfft_execution_info_set_work_buffer(info, work, work_size); + } + rocfft_execute(plan, (void**)&x, nullptr, info); + + std::vector<float2> xout(size); + hipMemcpy(xout.data(), x, sizeof *x * size, hipMemcpyDeviceToHost); + + std::vector<float2> 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); + rocfft_plan_destroy(plan); + rocfft_cleanup(); +} diff --git a/test.sh b/test.sh new file mode 100755 index 000000000000..a954730b8241 --- /dev/null +++ b/test.sh @@ -0,0 +1,5 @@ +#! /usr/bin/env sh + +OUT=$(mktemp -d) +/opt/rocm/bin/hipcc -o "$OUT"/test test.cpp -lrocfft +"$OUT"/test |