Date: Wednesday, December 28, 2022 @ 15:44:32
  Author: tpkessler
Revision: 1371518

archrelease: copy trunk to community-testing-x86_64

Added:
  rocthrust/repos/community-testing-x86_64/
  rocthrust/repos/community-testing-x86_64/PKGBUILD
    (from rev 1371515, rocthrust/trunk/PKGBUILD)
  rocthrust/repos/community-testing-x86_64/test.cpp
    (from rev 1371515, rocthrust/trunk/test.cpp)
  rocthrust/repos/community-testing-x86_64/test.sh
    (from rev 1371516, rocthrust/trunk/test.sh)

----------+
 PKGBUILD |   34 ++++++++++++++++++++++++++++++++++
 test.cpp |   39 +++++++++++++++++++++++++++++++++++++++
 test.sh  |    6 ++++++
 3 files changed, 79 insertions(+)

Copied: rocthrust/repos/community-testing-x86_64/PKGBUILD (from rev 1371515, 
rocthrust/trunk/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD                           (rev 0)
+++ community-testing-x86_64/PKGBUILD   2022-12-28 15:44:32 UTC (rev 1371518)
@@ -0,0 +1,34 @@
+# Maintainer: Torsten Keßler <tpkessler at archlinux dot org>
+# Contributor: Markus Näther <[email protected]>
+pkgname=rocthrust
+pkgver=5.4.1
+pkgrel=2
+pkgdesc='Port of the Thrust parallel algorithm library atop HIP/ROCm'
+arch=('x86_64')
+url='https://docs.amd.com/bundle/rocTHRUST_API_Guide/page/index.html'
+license=('Apache')
+depends=('hip' 'rocprim')
+makedepends=('rocm-cmake')
+_git='https://github.com/ROCmSoftwarePlatform/rocThrust'
+source=("$pkgname-$pkgver.tar.gz::$_git/archive/rocm-$pkgver.tar.gz")
+sha256sums=('8d71e6e51785dbd354d35135879fb040ed3113c3f2698090b2e5d9ec01d6ce98')
+_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.4/page/Appendix_A.html
+  CXXFLAGS="${CXXFLAGS} -fcf-protection=none" \
+  cmake \
+    -Wno-dev \
+    -S "$_dirname" \
+    -B build \
+    -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
+  cmake --build build
+}
+
+package() {
+  DESTDIR="$pkgdir" cmake --install build
+}

Copied: rocthrust/repos/community-testing-x86_64/test.cpp (from rev 1371515, 
rocthrust/trunk/test.cpp)
===================================================================
--- community-testing-x86_64/test.cpp                           (rev 0)
+++ community-testing-x86_64/test.cpp   2022-12-28 15:44:32 UTC (rev 1371518)
@@ -0,0 +1,39 @@
+#include <thrust/copy.h>
+#include <thrust/host_vector.h>
+#include <thrust/device_vector.h>
+#include <thrust/sort.h>
+#include <iostream>
+#include <vector>
+#include <algorithm>
+#include <random>
+
+int main(int argc, char *argv[])
+{
+    size_t size = 1024;
+
+    std::random_device rd;
+    std::mt19937 gen(rd());
+    std::uniform_real_distribution<float> dist(-1.0, 1.0);
+
+    auto myrand = [&]() -> float {return dist(gen);};
+
+    thrust::host_vector<float> xin(size);
+    std::generate(xin.begin(), xin.end(), myrand);
+
+    thrust::device_vector<float> x(size);
+    x = xin;
+
+    thrust::sort(x.begin(), x.end());
+    thrust::copy(x.begin(), x.end(), xin.begin());
+
+    for(size_t i = 1; i < size; i++){
+        if(xin[i - 1] > xin[i]){
+            std::cout << "Elements " << i - 1 << " and " << i
+                << "are not sorted:\n";
+            std::cout << xin[i - 1] << " " << xin[i] << std::endl;
+            return 1;
+        }
+    }
+
+    std::cout << "TESTS PASSED!" << std::endl;
+}

Copied: rocthrust/repos/community-testing-x86_64/test.sh (from rev 1371516, 
rocthrust/trunk/test.sh)
===================================================================
--- community-testing-x86_64/test.sh                            (rev 0)
+++ community-testing-x86_64/test.sh    2022-12-28 15:44:32 UTC (rev 1371518)
@@ -0,0 +1,6 @@
+#! /usr/bin/env sh
+
+OUT=$(mktemp -d)
+# rocTHRUST 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

Reply via email to