diff options
author | Torsten Keßler | 2022-12-13 19:57:56 +0100 |
---|---|---|
committer | Torsten Keßler | 2022-12-13 19:57:56 +0100 |
commit | c675b879e98e582fb81429646b2c2ed6f49982d2 (patch) | |
tree | b754b2d1fadd8c77e10d48bc142c90d597b2919c | |
parent | 27e1509204b8a727c7aa69624fc698625693e20a (diff) | |
download | aur-c675b879e98e582fb81429646b2c2ed6f49982d2.tar.gz |
upgpkg: rocalution 5.4.0-1
Update to ROCm 5.4.0:
* Simple test case to be run after installation that checks if the
package is correctly configured and installed.
* Use upstream patch to remove git as dependency.
* Set build type to None to comply with arch's package policy.
* Update checksums and links to docu.
-rw-r--r-- | .SRCINFO | 9 | ||||
-rw-r--r-- | PKGBUILD | 25 | ||||
-rw-r--r-- | test.cpp | 83 | ||||
-rwxr-xr-x | test.sh | 5 |
4 files changed, 112 insertions, 10 deletions
@@ -1,19 +1,20 @@ pkgbase = rocalution pkgdesc = Next generation library for iterative sparse solvers for ROCm platform - pkgver = 5.3.0 + pkgver = 5.4.0 pkgrel = 1 url = https://rocalution.readthedocs.io/en/master arch = x86_64 license = MIT makedepends = rocm-cmake - makedepends = git depends = hip depends = rocsparse depends = rocblas depends = rocprim depends = rocrand depends = openmp - source = rocalution-5.3.0.tar.gz::https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-5.3.0.tar.gz - sha256sums = f623449789a5c9c9137ae51d4dbbee5c6940d8813826629cb4b7e84f07fab494 + source = rocalution-5.4.0.tar.gz::https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-5.4.0.tar.gz + source = rocalution-remove-git.patch::https://github.com/ROCmSoftwarePlatform/rocALUTION/commit/773e8be7354bbc961d86810dbb23e6248f6e513b.patch + sha256sums = dccf004434e0fee6d0c7bedd46827f5a2af0392bc4807a08403b130e461f55eb + sha256sums = 9daafee87896ef043b655542f36e078b9a3f3a4a106b69849cfd8add25637cca pkgname = rocalution @@ -1,30 +1,43 @@ # Maintainer: Torsten Keßler <t dot kessler at posteo dot de> # Contributor: Markus Näther <naetherm@informatik.uni-freiburg.de> pkgname=rocalution -pkgver=5.3.0 +pkgver=5.4.0 pkgrel=1 pkgdesc='Next generation library for iterative sparse solvers for ROCm platform' arch=('x86_64') url='https://rocalution.readthedocs.io/en/master' license=('MIT') depends=('hip' 'rocsparse' 'rocblas' 'rocprim' 'rocrand' 'openmp') -makedepends=('rocm-cmake' 'git') +makedepends=('rocm-cmake') _git='https://github.com/ROCmSoftwarePlatform/rocALUTION' -source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz") -sha256sums=('f623449789a5c9c9137ae51d4dbbee5c6940d8813826629cb4b7e84f07fab494') +source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz" + "$pkgname-remove-git.patch::$_git/commit/773e8be7354bbc961d86810dbb23e6248f6e513b.patch") +sha256sums=('dccf004434e0fee6d0c7bedd46827f5a2af0392bc4807a08403b130e461f55eb' + '9daafee87896ef043b655542f36e078b9a3f3a4a106b69849cfd8add25637cca') _dirname="$(basename "$_git")-$(basename "${source[0]}" ".tar.gz")" +prepare() { + cd "$_dirname" + patch -Np1 -i "$srcdir/$pkgname-remove-git.patch" +} + 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 \ - -DROCM_PATH=/opt/rocm + -DROCM_PATH=/opt/rocm \ + -DHIP_ROOT_DIR=/opt/rocm/hip \ + -DSUPPORT_HIP=ON \ + -DSUPPORT_OMP=ON \ + -DSUPPORT_MPI=OFF \ + -DBUILD_SHARED_LIBS=ON cmake --build build } diff --git a/test.cpp b/test.cpp new file mode 100644 index 000000000000..5431de84aecb --- /dev/null +++ b/test.cpp @@ -0,0 +1,83 @@ +#include <rocalution/rocalution.hpp> +#include <vector> +#include <iostream> + +using namespace rocalution; + +int main() +{ + init_rocalution(); + info_rocalution(); + size_t n = 128; + + + float *data = new float[3 * n]; + int *row_ptr = new int[n + 1]; + int *col = new int[3 * n]; + row_ptr[0] = 0; + int off; + for(int i = 0; i < n; i++){ + off = row_ptr[i]; + if(i > 0){ + data[off] = -1.0; + col[off++] = i - 1; + } + data[off] = 2.0; + col[off++] = i; + if(i < n - 1){ + data[off] = -1.0; + col[off++] = i + 1; + } + row_ptr[i + 1] = off; + } + + + LocalVector<float> x; + LocalVector<float> b; + LocalVector<float> r; + LocalMatrix<float> A; + + A.SetDataPtrCSR(&row_ptr, &col, &data, + "matrix", row_ptr[n], n, n); + A.Check(); + + A.MoveToAccelerator(); + x.MoveToAccelerator(); + b.MoveToAccelerator(); + r.MoveToAccelerator(); + + x.Allocate("x", n); + b.Allocate("b", n); + r.Allocate("r", n); + + CG<LocalMatrix<float>, LocalVector<float>, float> ls; + + b.SetRandomUniform(2342359); + x.Zeros(); + r.CopyFrom(b); + + A.Info(); + + ls.InitTol(1e-6, 5e-4, 1e3); + ls.SetOperator(A); + + ls.Build(); + ls.Verbose(1); + + ls.Solve(b, &x); + + A.Apply(x, &r); + + r.ScaleAdd(-1.0, b); + + float nrm = r.Norm(); + float tol = 0.001f; + if(nrm > tol){ + std::cout << "Solver failed with tolerance " << tol << std::endl; + return 1; + } + + std::cout << "TESTS PASSED!" << std::endl; + + stop_rocalution(); +} diff --git a/test.sh b/test.sh new file mode 100755 index 000000000000..564eb1ae1700 --- /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 -lrocalution -lrocrand -lrocsolver -lrocblas +"$OUT"/test |