public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/hipcub] epel10: Reuse Archlinux smoke test
@ 2026-06-11 13:23 Tom Rix
  0 siblings, 0 replies; only message in thread
From: Tom Rix @ 2026-06-11 13:23 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/hipcub
            Branch : epel10
            Commit : ffda8f1ce3cae4f4123af3ce92c015f0a2e52ca6
            Author : Tom Rix <Tom.Rix@amd.com>
            Date   : 2026-02-11T07:45:05-08:00
            Stats  : +58/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/hipcub/c/ffda8f1ce3cae4f4123af3ce92c015f0a2e52ca6?branch=epel10

            Log:
            Reuse Archlinux smoke test

Licensed as 0BSD
repo https://gitlab.archlinux.org/archlinux/packaging/packages/hipcub.git
commit 1b4b1d224ff16f6de30543a64133475b218a3c4d

Signed-off-by: Tom Rix <Tom.Rix@amd.com>

---
diff --git a/hipcub.spec b/hipcub.spec
index 8c4ac21..cf9d6a2 100644
--- a/hipcub.spec
+++ b/hipcub.spec
@@ -82,7 +82,7 @@ Release:        1%{?dist}
 %endif
 Summary:        ROCm port of CUDA CUB library
 
-License:        MIT and BSD-3-Clause
+License:        MIT AND BSD-3-Clause AND 0BSD
 URL:            https://github.com/ROCm/rocm-libraries
 
 %if %{with gitcommit}

diff --git a/test.cpp b/test.cpp
new file mode 100644
index 0000000..79fd950
--- /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 0000000..4cdf5fc
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,9 @@
+#! /usr/bin/env sh
+
+BPATH=/usr/bin
+IPATH=/usr/include
+LPATH=/usr/lib64
+
+OUT=$(mktemp -d)
+${BPATH}/hipcc -o "$OUT"/test test.cpp -I${IPATH} -L${LPATH} -lamdhip64
+"$OUT"/test

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-11 13:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-11 13:23 [rpms/hipcub] epel10: Reuse Archlinux smoke test Tom Rix

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox