diff options
author | Torsten Keßler | 2022-12-09 11:47:09 +0100 |
---|---|---|
committer | Torsten Keßler | 2022-12-09 11:47:09 +0100 |
commit | ebdf5aa5ae961617a0ebeb82bea0ce8d1ebe3d49 (patch) | |
tree | 088f049875d380571aa88c12e742034fc1e40864 | |
parent | 6d19b16867db6d41eae38b007f98766824582aed (diff) | |
download | aur-ebdf5aa5ae961617a0ebeb82bea0ce8d1ebe3d49.tar.gz |
upgpkg: hipcub 5.4.0-1
Update to ROCm 5.4.0 with the following changes:
* Simple test case to be run after the package is installed to check if
it's correctly configured and installed;
* Follow arch's cmake build guidelines;
* Remove git from dependencies as it is not needed if rocprim and
rocm-cmake are installed;
* updated checksum.
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | PKGBUILD | 27 | ||||
-rw-r--r-- | test.cpp | 48 | ||||
-rwxr-xr-x | test.sh | 6 |
4 files changed, 75 insertions, 17 deletions
@@ -1,15 +1,14 @@ pkgbase = hipcub pkgdesc = Header-only library on top of rocPRIM or CUB - pkgver = 5.3.0 + pkgver = 5.4.0 pkgrel = 1 - url = https://docs.amd.com/bundle/hipCUB-release-rocm-rel-5.2/page/introduction.html + url = https://hipcub.readthedocs.io/en/latest/ arch = x86_64 license = custom makedepends = rocm-cmake - makedepends = git - makedepends = hip depends = rocprim - source = hipcub-5.3.0.tar.gz::https://github.com/ROCmSoftwarePlatform/hipCUB/archive/rocm-5.3.0.tar.gz - sha256sums = 4016cfc240b3cc1a97b549ecc4a5b76369610d46247661834630846391e5fad2 + depends = hip + source = hipcub-5.4.0.tar.gz::https://github.com/ROCmSoftwarePlatform/hipCUB/archive/rocm-5.4.0.tar.gz + sha256sums = 78db2c2ea466a4c5d84beedc000ae934f6d0ff1793eae90bb8d02b2dbff8932c pkgname = hipcub @@ -1,31 +1,36 @@ # Maintainer: Torsten Keßler <t dot kessler at posteo dot de> # Contributor: Markus Näther <naetherm@informatik.uni-freiburg.de> pkgname=hipcub -pkgver=5.3.0 +pkgver=5.4.0 pkgrel=1 pkgdesc='Header-only library on top of rocPRIM or CUB' arch=('x86_64') -url='https://docs.amd.com/bundle/hipCUB-release-rocm-rel-5.2/page/introduction.html' +url='https://hipcub.readthedocs.io/en/latest/' license=('custom') -depends=('rocprim') -makedepends=('rocm-cmake' 'git' 'hip') +depends=('rocprim' 'hip') +makedepends=('rocm-cmake') _git='https://github.com/ROCmSoftwarePlatform/hipCUB' source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz") -sha256sums=('4016cfc240b3cc1a97b549ecc4a5b76369610d46247661834630846391e5fad2') +sha256sums=('78db2c2ea466a4c5d84beedc000ae934f6d0ff1793eae90bb8d02b2dbff8932c') _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 -S "$_dirname" \ - -DCMAKE_INSTALL_PREFIX=/opt/rocm \ - -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \ - -Damd_comgr_DIR=/opt/rocm/lib/cmake/amd_comgr + cmake \ + -Wno-dev \ + -S "$_dirname" \ + -B build \ + -DCMAKE_BUILD_TYPE=None \ + -DCMAKE_INSTALL_PREFIX=/opt/rocm \ + -DCMAKE_CXX_COMPILER=/opt/rocm/bin/hipcc \ + -Damd_comgr_DIR=/opt/rocm/lib/cmake/amd_comgr + cmake --build build } package() { - DESTDIR="$pkgdir" make install + DESTDIR="$pkgdir" cmake --install build install -Dm644 "$_dirname/LICENSE.txt" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" } diff --git a/test.cpp b/test.cpp new file mode 100644 index 000000000000..79fd950aceca --- /dev/null +++ b/test.cpp @@ -0,0 +1,48 @@ +#include <hipcub/hipcub.hpp> +#include <vector> +#include <iostream> +#include <random> +#include <algorithm> + +int main() +{ + size_t size = 1024; + std::vector<float> xin(size); + + std::random_device rd; + std::mt19937 gen(rd()); + std::uniform_real_distribution<float> dist(-1.0, 1.0); + + auto myrand = [&]() -> float {return dist(gen);}; + + std::generate(xin.begin(), xin.end(), myrand); + + float *x; + float *xs; + hipMalloc((void**)&x, sizeof *x * size); + hipMalloc((void**)&xs, sizeof *xs * size); + + hipMemcpy(x, xin.data(), sizeof *x * size, hipMemcpyHostToDevice); + + void *tmp_storage = nullptr; + size_t tmp_storage_bytes = 0; + hipcub::DeviceRadixSort::SortKeys(tmp_storage, tmp_storage_bytes, x, xs, size); + hipMalloc((void**)&tmp_storage, tmp_storage_bytes); + hipcub::DeviceRadixSort::SortKeys(tmp_storage, tmp_storage_bytes, x, xs, size); + + std::vector<float> xout(size); + hipMemcpy(xout.data(), xs, sizeof *xs * size, hipMemcpyDeviceToHost); + + for(size_t i = 1; i < size; i++){ + if(xout[i - 1] > xout[i]){ + std::cout << "Elements not sorted at index " << i << "\n"; + std::cout << x[i - 1] << " " << x[i] << std::endl; + return 1; + } + } + std::cout << "TESTS PASSED!" << std::endl; + + hipFree(x); + hipFree(xs); + hipFree(tmp_storage); +} diff --git a/test.sh b/test.sh new file mode 100755 index 000000000000..fc157809db20 --- /dev/null +++ b/test.sh @@ -0,0 +1,6 @@ +#! /usr/bin/env sh + +OUT=$(mktemp -d) +# hipCUB uses C++14 extensions but hipcc uses C++11 by default +/opt/rocm/bin/hipcc -std=gnu++14 -o "$OUT"/test test.cpp +"$OUT"/test |