summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD57
-rw-r--r--test.cpp83
-rwxr-xr-xtest.sh5
4 files changed, 132 insertions, 29 deletions
diff --git a/.SRCINFO b/.SRCINFO
index e627abc2991a..458044b208de 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,20 +1,20 @@
pkgbase = rocalution
pkgdesc = Next generation library for iterative sparse solvers for ROCm platform
- pkgver = 4.0.0
- pkgrel = 2
+ pkgver = 5.4.1
+ pkgrel = 1
url = https://rocalution.readthedocs.io/en/master
arch = x86_64
license = MIT
- makedepends = cmake
- makedepends = git
- depends = hip-rocclr
+ makedepends = rocm-cmake
+ depends = hip
depends = rocsparse
depends = rocblas
depends = rocprim
depends = rocrand
depends = openmp
- source = rocalution-4.0.0.tar.gz::https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-4.0.0.tar.gz
- sha256sums = 80a224a5c19dea290e6edc0e170c3dff2e726c2b3105d599ec6858cc66f076a9
+ source = rocalution-5.4.1.tar.gz::https://github.com/ROCmSoftwarePlatform/rocALUTION/archive/rocm-5.4.1.tar.gz
+ source = rocalution-remove-git.patch::https://github.com/ROCmSoftwarePlatform/rocALUTION/commit/773e8be7354bbc961d86810dbb23e6248f6e513b.patch
+ sha256sums = c11b76ccd89ea65f649fe283eb2fc9056c290e7a06ea234cb88c82dacf6f9608
+ sha256sums = 9daafee87896ef043b655542f36e078b9a3f3a4a106b69849cfd8add25637cca
pkgname = rocalution
-
diff --git a/PKGBUILD b/PKGBUILD
index 4b035a08249a..415553a5b20f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,36 +1,51 @@
-# Maintainer: Markus Näther <naetherm@informatik.uni-freiburg.de>
+# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
+# Contributor: Markus Näther <naetherm@informatik.uni-freiburg.de>
pkgname=rocalution
-pkgver=4.0.0
-pkgrel=2
+pkgver=5.4.1
+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-rocclr' 'rocsparse' 'rocblas' 'rocprim' 'rocrand' 'openmp')
-makedepends=('cmake' 'git')
+depends=('hip' 'rocsparse' 'rocblas' 'rocprim' 'rocrand' 'openmp')
+makedepends=('rocm-cmake')
_git='https://github.com/ROCmSoftwarePlatform/rocALUTION'
-source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz")
-sha256sums=('80a224a5c19dea290e6edc0e170c3dff2e726c2b3105d599ec6858cc66f076a9')
+source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz"
+ "$pkgname-remove-git.patch::$_git/commit/773e8be7354bbc961d86810dbb23e6248f6e513b.patch")
+sha256sums=('c11b76ccd89ea65f649fe283eb2fc9056c290e7a06ea234cb88c82dacf6f9608'
+ '9daafee87896ef043b655542f36e078b9a3f3a4a106b69849cfd8add25637cca')
_dirname="$(basename "$_git")-$(basename "${source[0]}" ".tar.gz")"
+prepare() {
+ cd "$_dirname"
+ patch -Np1 -i "$srcdir/$pkgname-remove-git.patch"
+}
+
build() {
- CXX=/opt/rocm/hip/bin/hipcc \
- cmake -B build -Wno-dev \
- -S "$_dirname" \
- -DCMAKE_INSTALL_PREFIX=/opt/rocm \
- -DSUPPORT_HIP=ON \
- -DSUPPORT_OMP=ON \
- -DSUPPORT_MPI=OFF \
- -Dhip_DIR=/opt/rocm/hip/lib/cmake/hip \
- -Damd_comgr_DIR=/opt/rocm/lib/cmake/amd_comgr
- make -C 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" \
+ 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 \
+ -DHIP_ROOT_DIR=/opt/rocm/hip \
+ -DSUPPORT_HIP=ON \
+ -DSUPPORT_OMP=ON \
+ -DSUPPORT_MPI=OFF \
+ -DBUILD_SHARED_LIBS=ON
+ cmake --build build
}
package() {
- DESTDIR="$pkgdir" make -C build install
+ DESTDIR="$pkgdir" cmake --install build
+
+ echo "/opt/rocm/$pkgname/lib" > "$pkgname.conf"
+ install -Dm644 "$pkgname.conf" "$pkgdir/etc/ld.so.conf.d/rocalution.conf"
- install -Dm644 /dev/stdin "$pkgdir/etc/ld.so.conf.d/rocalution.conf" << EOF
-/opt/rocm/rocalution/lib
-EOF
install -Dm644 "$_dirname/LICENSE.md" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
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