summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorsten Keßler2022-12-13 15:58:55 +0100
committerTorsten Keßler2022-12-13 15:58:55 +0100
commit8ff80f7c2b520afe3a03c12caf1513099d6f349b (patch)
tree98f31a1261077cba5347381ddc46ff8c4cfd1686
parentc01081fed40f78815766d45f7d75ad9755780793 (diff)
downloadaur-8ff80f7c2b520afe3a03c12caf1513099d6f349b.tar.gz
upgpkg: hipblas 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; * set cmake build type to None to comply with arch's cmake policy; * remove unneeded build flags; * update checksum and links to docu.
-rw-r--r--.SRCINFO8
-rw-r--r--PKGBUILD14
-rw-r--r--test.cpp82
-rwxr-xr-xtest.sh5
4 files changed, 97 insertions, 12 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 65f924ed1190..0a425e815cf0 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,16 +1,16 @@
pkgbase = hipblas
pkgdesc = ROCm BLAS marshalling library
- pkgver = 5.3.0
+ pkgver = 5.4.0
pkgrel = 1
url = https://hipblas.readthedocs.io/en/latest/
arch = x86_64
license = MIT
- makedepends = cmake
+ makedepends = rocm-cmake
makedepends = gcc-fortran
depends = hip
depends = rocblas
depends = rocsolver
- source = hipblas-5.3.0.tar.gz::https://github.com/ROCmSoftwarePlatform/hipBLAS/archive/rocm-5.3.0.tar.gz
- sha256sums = 873d55749479873994679840906c4257316dfb09a6200411204ad4a8c2480565
+ source = hipblas-5.4.0.tar.gz::https://github.com/ROCmSoftwarePlatform/hipBLAS/archive/rocm-5.4.0.tar.gz
+ sha256sums = 341d61adff8d08cbf70aa07bd11a088bcd0687fc6156870a1aee9eff74f3eb4f
pkgname = hipblas
diff --git a/PKGBUILD b/PKGBUILD
index 31ef4d3a94fa..f3bc133e369c 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,32 +1,30 @@
# Maintainer: Torsten Keßler <t dot kessler at posteo dot de>
# Contributor: Markus Näther <naether.markus@gmail.com>
pkgname=hipblas
-pkgver=5.3.0
+pkgver=5.4.0
pkgrel=1
pkgdesc='ROCm BLAS marshalling library'
arch=('x86_64')
url='https://hipblas.readthedocs.io/en/latest/'
license=('MIT')
depends=('hip' 'rocblas' 'rocsolver')
-makedepends=('cmake' 'gcc-fortran')
+makedepends=('rocm-cmake' 'gcc-fortran')
_git='https://github.com/ROCmSoftwarePlatform/hipBLAS'
source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz")
-sha256sums=('873d55749479873994679840906c4257316dfb09a6200411204ad4a8c2480565')
+sha256sums=('341d61adff8d08cbf70aa07bd11a088bcd0687fc6156870a1aee9eff74f3eb4f')
_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 \
- -Damd_comgr_DIR=/opt/rocm/lib/cmake/amd_comgr \
- -DBUILD_CLIENTS_SAMPLES=OFF \
- -DBUILD_CLIENTS_TESTS=OFF
+ -DCMAKE_INSTALL_PREFIX=/opt/rocm
cmake --build build
}
diff --git a/test.cpp b/test.cpp
new file mode 100644
index 000000000000..f47a97fc7072
--- /dev/null
+++ b/test.cpp
@@ -0,0 +1,82 @@
+#include <hipblas/hipblas.h>
+#include <hip/hip_runtime.h>
+#include <vector>
+#include <random>
+#include <algorithm>
+#include <cmath>
+#include <iostream>
+
+int main()
+{
+ size_t n = 64;
+ size_t m = 41;
+ size_t size = n * n;
+
+ std::random_device rd;
+ std::mt19937 gen(rd());
+ std::uniform_real_distribution<float> dist(-1.0, 1.0);
+ auto myrand = [&](){return dist(gen);};
+
+ float *a;
+ float *ac;
+ int *ipiv;
+ float *x;
+ float *r;
+ hipMalloc((void**)&a, sizeof *a * size);
+ hipMalloc((void**)&ac, sizeof *ac * size);
+ hipMalloc((void**)&ipiv, sizeof *ipiv * n);
+ hipMalloc((void**)&x, sizeof *x * n * m);
+ hipMalloc((void**)&r, sizeof *r * n * m);
+
+ std::vector<float> ain(size);
+ std::vector<float> xin(n * m);
+ std::generate(ain.begin(), ain.end(), myrand);
+ std::generate(xin.begin(), xin.end(), myrand);
+
+ hipMemcpy(a, ain.data(), sizeof *a * size, hipMemcpyHostToDevice);
+ hipMemcpy(ac, ain.data(), sizeof *ac * size, hipMemcpyHostToDevice);
+ hipMemcpy(x, xin.data(), sizeof *x * n * m, hipMemcpyHostToDevice);
+ hipMemcpy(r, xin.data(), sizeof *x * n * m, hipMemcpyHostToDevice);
+
+ hipblasHandle_t handle;
+ hipblasCreate(&handle);
+
+ int *info;
+ hipMalloc((void**)&info, sizeof *info);
+
+ hipblasSgetrf(handle, n, a, n, ipiv, info);
+
+ int hinfo[1];
+ hipblasSgetrs(handle, HIPBLAS_OP_N, n, m, a, n,
+ ipiv, x, n, &hinfo[0]);
+
+ float alpha = 1.0;
+ float beta = -1.0;
+ hipblasSgemm(handle, HIPBLAS_OP_N, HIPBLAS_OP_N, n, m, n,
+ &alpha, ac, n, x, n, &beta, r, n);
+
+ std::vector<float> rout(n * m);
+ hipMemcpy(rout.data(), r, sizeof *r * n * m, hipMemcpyDeviceToHost);
+
+ float tol = 0.001f;
+ for(size_t i = 0; i < n; i++){
+ for(size_t j = 0; j < m; j++){
+ if(std::abs(rout[i]) > tol){
+ std::cout << "Missmatch at index " << i << "," << j << "\n"
+ << "Desired: 0" << "\n"
+ << "Actual : " << rout[i + j * n] << std::endl;
+ return 1;
+ }
+ }
+ }
+
+ std::cout << "TESTS PASSED!" << std::endl;
+
+ hipFree(a);
+ hipFree(ac);
+ hipFree(ipiv);
+ hipFree(x);
+ hipFree(r);
+ hipFree(info);
+ hipblasDestroy(handle);
+}
diff --git a/test.sh b/test.sh
new file mode 100755
index 000000000000..ceb50c33a35e
--- /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 -lhipblas -lrocsolver -lrocblas
+"$OUT"/test