Date: Sunday, January 1, 2023 @ 15:45:02
  Author: tpkessler
Revision: 1372773

Migrate rocalution from AUR to community

Added:
  rocalution/
  rocalution/repos/
  rocalution/trunk/
  rocalution/trunk/PKGBUILD
  rocalution/trunk/rocalution-remove-git.patch
  rocalution/trunk/test.cpp
  rocalution/trunk/test.sh

-----------------------------+
 PKGBUILD                    |   51 +++++++++++++++++++++++++
 rocalution-remove-git.patch |   23 +++++++++++
 test.cpp                    |   83 ++++++++++++++++++++++++++++++++++++++++++
 test.sh                     |    5 ++
 4 files changed, 162 insertions(+)

Added: rocalution/trunk/PKGBUILD
===================================================================
--- rocalution/trunk/PKGBUILD                           (rev 0)
+++ rocalution/trunk/PKGBUILD   2023-01-01 15:45:02 UTC (rev 1372773)
@@ -0,0 +1,51 @@
+# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
+# Contributor: Markus Näther <[email protected]>
+pkgname=rocalution
+pkgver=5.4.1
+pkgrel=2
+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='https://github.com/ROCmSoftwarePlatform/rocALUTION'
+source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz"
+        "$pkgname-remove-git.patch")
+sha256sums=('c11b76ccd89ea65f649fe283eb2fc9056c290e7a06ea234cb88c82dacf6f9608'
+            '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.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" cmake --install build
+
+  echo "/opt/rocm/$pkgname/lib" > "$pkgname.conf"
+  install -Dm644 "$pkgname.conf" "$pkgdir/etc/ld.so.conf.d/$pkgname.conf"
+
+  install -Dm644 "$_dirname/LICENSE.md" 
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+}

Added: rocalution/trunk/rocalution-remove-git.patch
===================================================================
--- rocalution/trunk/rocalution-remove-git.patch                                
(rev 0)
+++ rocalution/trunk/rocalution-remove-git.patch        2023-01-01 15:45:02 UTC 
(rev 1372773)
@@ -0,0 +1,23 @@
+From 773e8be7354bbc961d86810dbb23e6248f6e513b Mon Sep 17 00:00:00 2001
+From: Cory Bloor <[email protected]>
+Date: Mon, 14 Nov 2022 02:36:50 -0700
+Subject: [PATCH] Remove Git from build requirements (#121)
+
+---
+ cmake/Dependencies.cmake | 3 ---
+ 1 file changed, 3 deletions(-)
+
+diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake
+index eee565bf..9d742ebe 100644
+--- a/cmake/Dependencies.cmake
++++ b/cmake/Dependencies.cmake
+@@ -23,9 +23,6 @@
+ 
+ # Dependencies
+ 
+-# Git
+-find_package(Git REQUIRED)
+-
+ # Find OpenMP package
+ find_package(OpenMP)
+ if (NOT OPENMP_FOUND)

Added: rocalution/trunk/test.cpp
===================================================================
--- rocalution/trunk/test.cpp                           (rev 0)
+++ rocalution/trunk/test.cpp   2023-01-01 15:45:02 UTC (rev 1372773)
@@ -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();
+}

Added: rocalution/trunk/test.sh
===================================================================
--- rocalution/trunk/test.sh                            (rev 0)
+++ rocalution/trunk/test.sh    2023-01-01 15:45:02 UTC (rev 1372773)
@@ -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


Property changes on: rocalution/trunk/test.sh
___________________________________________________________________
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property

Reply via email to