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

            A new commit has been pushed.

            Repo   : rpms/rocrand
            Branch : epel10
            Commit : f69f88bd578552a79798916b1dc0809023219c38
            Author : Tom Rix <Tom.Rix@amd.com>
            Date   : 2026-02-09T08:22:16-08:00
            Stats  : +47/-1 in 3 file(s)
            URL    : https://src.fedoraproject.org/rpms/rocrand/c/f69f88bd578552a79798916b1dc0809023219c38?branch=epel10

            Log:
            Reuse Archlinux smoke test

Licensed as 0BSD
repo https://gitlab.archlinux.org/archlinux/packaging/packages/rocrand.git
commit 24bcc79a1155f3649abf937f9f96b70f0afa2f5d

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

---
diff --git a/rocrand.spec b/rocrand.spec
index 27b830e..c6e84a7 100644
--- a/rocrand.spec
+++ b/rocrand.spec
@@ -128,7 +128,7 @@ Release:        1%{?dist}
 Summary:        ROCm random number generator
 
 URL:            https://github.com/ROCm/rocm-libraries
-License:        MIT AND BSD-3-Clause
+License:        MIT AND BSD-3-Clause AND 0BSD
 %if %{with gitcommit}
 Source0:        %{url}/archive/%{commit0}/rocm-libraries-%{shortcommit0}.tar.gz
 %else

diff --git a/test.cpp b/test.cpp
new file mode 100644
index 0000000..28db5d5
--- /dev/null
+++ b/test.cpp
@@ -0,0 +1,37 @@
+#include <hip/hip_runtime.h>
+#include <rocrand/rocrand.hpp>
+#include <vector>
+#include <numeric>
+#include <cmath>
+#include <iostream>
+
+int main()
+{
+    size_t size = 1024 * 1024;
+    float mean = -1.24f;
+    float std = 0.43f;
+    rocrand_generator gen;
+    rocrand_create_generator(&gen, ROCRAND_RNG_PSEUDO_XORWOW);
+
+    float *x;
+    hipMalloc((void**)&x, sizeof *x * size);
+    rocrand_generate_normal(gen, x, size, mean, std);
+
+    std::vector<float> x_d(size);
+    hipMemcpy(x_d.data(), x, sizeof *x * size, hipMemcpyDeviceToHost);
+
+    float mean_hat = std::accumulate(x_d.begin(), x_d.end(), 0.0f) / size;
+
+    // Tolerance set so that test may at most fail in 1 of 10,000 runs
+    float tol = 3e-1;
+    if(std::abs(mean - mean_hat) > tol){
+        std::cout << "Tolerance in mean not reached:\n"
+            << mean_hat << " differs more than " << tol
+            << " from " << mean << std::endl;
+        return 1;
+    }
+    std::cout << "TESTS PASSED!" << std::endl;
+
+    rocrand_destroy_generator(gen);
+    hipFree(x);
+}

diff --git a/test.sh b/test.sh
new file mode 100755
index 0000000..225cc44
--- /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} -lrocrand -lamdhip64
+"$OUT"/test

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

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

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 23:51 [rpms/rocrand] 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