summaryrefslogtreecommitdiff
path: root/test/routines
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-03-04 15:21:33 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-03-04 15:21:33 +0100
commite993ee077b50d3a6134309d465a4174b5c749596 (patch)
treeb967f2702b90d8080a3e3cb41b9cbc01ab9eddc3 /test/routines
parent3fc73851f7ed885335940eb85e53069638567323 (diff)
Added a proper data-preparation function for the TRSM tests
Diffstat (limited to 'test/routines')
-rw-r--r--test/routines/level1/xamax.hpp5
-rw-r--r--test/routines/level1/xasum.hpp5
-rw-r--r--test/routines/level1/xaxpy.hpp5
-rw-r--r--test/routines/level1/xcopy.hpp5
-rw-r--r--test/routines/level1/xdot.hpp5
-rw-r--r--test/routines/level1/xdotc.hpp5
-rw-r--r--test/routines/level1/xdotu.hpp5
-rw-r--r--test/routines/level1/xnrm2.hpp5
-rw-r--r--test/routines/level1/xscal.hpp5
-rw-r--r--test/routines/level1/xswap.hpp5
-rw-r--r--test/routines/level2/xgbmv.hpp5
-rw-r--r--test/routines/level2/xgemv.hpp5
-rw-r--r--test/routines/level2/xger.hpp5
-rw-r--r--test/routines/level2/xgerc.hpp5
-rw-r--r--test/routines/level2/xgeru.hpp5
-rw-r--r--test/routines/level2/xhbmv.hpp5
-rw-r--r--test/routines/level2/xhemv.hpp5
-rw-r--r--test/routines/level2/xher.hpp5
-rw-r--r--test/routines/level2/xher2.hpp5
-rw-r--r--test/routines/level2/xhpmv.hpp5
-rw-r--r--test/routines/level2/xhpr.hpp5
-rw-r--r--test/routines/level2/xhpr2.hpp5
-rw-r--r--test/routines/level2/xsbmv.hpp5
-rw-r--r--test/routines/level2/xspmv.hpp5
-rw-r--r--test/routines/level2/xspr.hpp5
-rw-r--r--test/routines/level2/xspr2.hpp5
-rw-r--r--test/routines/level2/xsymv.hpp5
-rw-r--r--test/routines/level2/xsyr.hpp5
-rw-r--r--test/routines/level2/xsyr2.hpp5
-rw-r--r--test/routines/level2/xtbmv.hpp5
-rw-r--r--test/routines/level2/xtpmv.hpp5
-rw-r--r--test/routines/level2/xtrmv.hpp5
-rw-r--r--test/routines/level2/xtrsv.hpp53
-rw-r--r--test/routines/level3/xgemm.hpp5
-rw-r--r--test/routines/level3/xhemm.hpp5
-rw-r--r--test/routines/level3/xher2k.hpp5
-rw-r--r--test/routines/level3/xherk.hpp5
-rw-r--r--test/routines/level3/xsymm.hpp5
-rw-r--r--test/routines/level3/xsyr2k.hpp5
-rw-r--r--test/routines/level3/xsyrk.hpp5
-rw-r--r--test/routines/level3/xtrmm.hpp5
-rw-r--r--test/routines/level3/xtrsm.hpp52
-rw-r--r--test/routines/level3/xtrsm_data.hpp187
-rw-r--r--test/routines/levelx/xinvert.hpp5
-rw-r--r--test/routines/levelx/xomatcopy.hpp5
45 files changed, 434 insertions, 68 deletions
diff --git a/test/routines/level1/xamax.hpp b/test/routines/level1/xamax.hpp
index f98bdb06..a22f681f 100644
--- a/test/routines/level1/xamax.hpp
+++ b/test/routines/level1/xamax.hpp
@@ -68,6 +68,11 @@ class TestXamax {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xasum.hpp b/test/routines/level1/xasum.hpp
index 64aa37c2..64377189 100644
--- a/test/routines/level1/xasum.hpp
+++ b/test/routines/level1/xasum.hpp
@@ -68,6 +68,11 @@ class TestXasum {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xaxpy.hpp b/test/routines/level1/xaxpy.hpp
index b24e6fe8..eba067c0 100644
--- a/test/routines/level1/xaxpy.hpp
+++ b/test/routines/level1/xaxpy.hpp
@@ -69,6 +69,11 @@ class TestXaxpy {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xcopy.hpp b/test/routines/level1/xcopy.hpp
index 87bc21d4..753f0da5 100644
--- a/test/routines/level1/xcopy.hpp
+++ b/test/routines/level1/xcopy.hpp
@@ -68,6 +68,11 @@ class TestXcopy {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xdot.hpp b/test/routines/level1/xdot.hpp
index c4f6076a..8127247d 100644
--- a/test/routines/level1/xdot.hpp
+++ b/test/routines/level1/xdot.hpp
@@ -72,6 +72,11 @@ class TestXdot {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xdotc.hpp b/test/routines/level1/xdotc.hpp
index aae892a8..96d97dc4 100644
--- a/test/routines/level1/xdotc.hpp
+++ b/test/routines/level1/xdotc.hpp
@@ -72,6 +72,11 @@ class TestXdotc {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xdotu.hpp b/test/routines/level1/xdotu.hpp
index f6be385b..70c7fceb 100644
--- a/test/routines/level1/xdotu.hpp
+++ b/test/routines/level1/xdotu.hpp
@@ -72,6 +72,11 @@ class TestXdotu {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xnrm2.hpp b/test/routines/level1/xnrm2.hpp
index e604077c..ce33fe59 100644
--- a/test/routines/level1/xnrm2.hpp
+++ b/test/routines/level1/xnrm2.hpp
@@ -68,6 +68,11 @@ class TestXnrm2 {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xscal.hpp b/test/routines/level1/xscal.hpp
index 3c438bd6..d89688b4 100644
--- a/test/routines/level1/xscal.hpp
+++ b/test/routines/level1/xscal.hpp
@@ -65,6 +65,11 @@ class TestXscal {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level1/xswap.hpp b/test/routines/level1/xswap.hpp
index a0491f12..49b0d3d0 100644
--- a/test/routines/level1/xswap.hpp
+++ b/test/routines/level1/xswap.hpp
@@ -68,6 +68,11 @@ class TestXswap {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xgbmv.hpp b/test/routines/level2/xgbmv.hpp
index 5ed92aae..f371b9a7 100644
--- a/test/routines/level2/xgbmv.hpp
+++ b/test/routines/level2/xgbmv.hpp
@@ -80,6 +80,11 @@ class TestXgbmv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xgemv.hpp b/test/routines/level2/xgemv.hpp
index 9ee6d535..2442be4c 100644
--- a/test/routines/level2/xgemv.hpp
+++ b/test/routines/level2/xgemv.hpp
@@ -80,6 +80,11 @@ class TestXgemv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xger.hpp b/test/routines/level2/xger.hpp
index 42283107..3e7ccbc3 100644
--- a/test/routines/level2/xger.hpp
+++ b/test/routines/level2/xger.hpp
@@ -76,6 +76,11 @@ class TestXger {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xgerc.hpp b/test/routines/level2/xgerc.hpp
index ef69c197..d880ae1f 100644
--- a/test/routines/level2/xgerc.hpp
+++ b/test/routines/level2/xgerc.hpp
@@ -76,6 +76,11 @@ class TestXgerc {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xgeru.hpp b/test/routines/level2/xgeru.hpp
index b2afc6d8..1735e42a 100644
--- a/test/routines/level2/xgeru.hpp
+++ b/test/routines/level2/xgeru.hpp
@@ -76,6 +76,11 @@ class TestXgeru {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xhbmv.hpp b/test/routines/level2/xhbmv.hpp
index 8bda4d0c..99538bf1 100644
--- a/test/routines/level2/xhbmv.hpp
+++ b/test/routines/level2/xhbmv.hpp
@@ -74,6 +74,11 @@ class TestXhbmv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xhemv.hpp b/test/routines/level2/xhemv.hpp
index 80565d04..3792cb66 100644
--- a/test/routines/level2/xhemv.hpp
+++ b/test/routines/level2/xhemv.hpp
@@ -74,6 +74,11 @@ class TestXhemv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xher.hpp b/test/routines/level2/xher.hpp
index d71c8009..c58eb189 100644
--- a/test/routines/level2/xher.hpp
+++ b/test/routines/level2/xher.hpp
@@ -70,6 +70,11 @@ class TestXher {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<U>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<U> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xher2.hpp b/test/routines/level2/xher2.hpp
index 083dfa2f..8a7eb0b6 100644
--- a/test/routines/level2/xher2.hpp
+++ b/test/routines/level2/xher2.hpp
@@ -74,6 +74,11 @@ class TestXher2 {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xhpmv.hpp b/test/routines/level2/xhpmv.hpp
index 1dd63562..0862b619 100644
--- a/test/routines/level2/xhpmv.hpp
+++ b/test/routines/level2/xhpmv.hpp
@@ -74,6 +74,11 @@ class TestXhpmv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xhpr.hpp b/test/routines/level2/xhpr.hpp
index a5c77811..5b454174 100644
--- a/test/routines/level2/xhpr.hpp
+++ b/test/routines/level2/xhpr.hpp
@@ -70,6 +70,11 @@ class TestXhpr {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<U>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<U> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xhpr2.hpp b/test/routines/level2/xhpr2.hpp
index d09178f0..b770da2e 100644
--- a/test/routines/level2/xhpr2.hpp
+++ b/test/routines/level2/xhpr2.hpp
@@ -74,6 +74,11 @@ class TestXhpr2 {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xsbmv.hpp b/test/routines/level2/xsbmv.hpp
index 8e0f8321..7a836170 100644
--- a/test/routines/level2/xsbmv.hpp
+++ b/test/routines/level2/xsbmv.hpp
@@ -74,6 +74,11 @@ class TestXsbmv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xspmv.hpp b/test/routines/level2/xspmv.hpp
index 977f733a..352c8cfd 100644
--- a/test/routines/level2/xspmv.hpp
+++ b/test/routines/level2/xspmv.hpp
@@ -74,6 +74,11 @@ class TestXspmv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xspr.hpp b/test/routines/level2/xspr.hpp
index 93da4b73..988bcdc2 100644
--- a/test/routines/level2/xspr.hpp
+++ b/test/routines/level2/xspr.hpp
@@ -70,6 +70,11 @@ class TestXspr {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xspr2.hpp b/test/routines/level2/xspr2.hpp
index b835f2b0..ee517bc1 100644
--- a/test/routines/level2/xspr2.hpp
+++ b/test/routines/level2/xspr2.hpp
@@ -74,6 +74,11 @@ class TestXspr2 {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xsymv.hpp b/test/routines/level2/xsymv.hpp
index 0ec96f1d..5eecfb74 100644
--- a/test/routines/level2/xsymv.hpp
+++ b/test/routines/level2/xsymv.hpp
@@ -74,6 +74,11 @@ class TestXsymv {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xsyr.hpp b/test/routines/level2/xsyr.hpp
index b49132e3..ac4ee1ff 100644
--- a/test/routines/level2/xsyr.hpp
+++ b/test/routines/level2/xsyr.hpp
@@ -70,6 +70,11 @@ class TestXsyr {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xsyr2.hpp b/test/routines/level2/xsyr2.hpp
index 7c65daa2..43644883 100644
--- a/test/routines/level2/xsyr2.hpp
+++ b/test/routines/level2/xsyr2.hpp
@@ -74,6 +74,11 @@ class TestXsyr2 {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xtbmv.hpp b/test/routines/level2/xtbmv.hpp
index cf30c2f7..ab9244af 100644
--- a/test/routines/level2/xtbmv.hpp
+++ b/test/routines/level2/xtbmv.hpp
@@ -69,6 +69,11 @@ class TestXtbmv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xtpmv.hpp b/test/routines/level2/xtpmv.hpp
index d08e132f..3821e1a4 100644
--- a/test/routines/level2/xtpmv.hpp
+++ b/test/routines/level2/xtpmv.hpp
@@ -69,6 +69,11 @@ class TestXtpmv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xtrmv.hpp b/test/routines/level2/xtrmv.hpp
index cf9a0063..7211c757 100644
--- a/test/routines/level2/xtrmv.hpp
+++ b/test/routines/level2/xtrmv.hpp
@@ -69,6 +69,11 @@ class TestXtrmv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level2/xtrsv.hpp b/test/routines/level2/xtrsv.hpp
index fed4378a..78b9672f 100644
--- a/test/routines/level2/xtrsv.hpp
+++ b/test/routines/level2/xtrsv.hpp
@@ -29,36 +29,6 @@
namespace clblast {
// =================================================================================================
-// Prepares the data
-template <typename T>
-void PrepareData(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- if (args.a_ld < args.n) { return; }
- if (args.a_size <= 0 || args.x_size <= 0) { return; }
-
- // Copies input buffers to the host
- std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));
- std::vector<T> x_vec_cpu(args.x_size, static_cast<T>(0));
- buffers.a_mat.Read(queue, args.a_size, a_mat_cpu);
- buffers.x_vec.Read(queue, args.x_size, x_vec_cpu);
-
- // Generates 'proper' input for the TRSV routine
- // TODO: Improve this, currently loosely based on clBLAS's implementation
- for (auto i = size_t{0}; i < args.n; ++i) {
- auto diagonal = a_mat_cpu[i*args.a_ld + i + args.a_offset];
- diagonal = AbsoluteValue(diagonal) + static_cast<T>(args.n / size_t{4});
- for (auto j = size_t{0}; j < args.n; ++j) {
- a_mat_cpu[j*args.a_ld + i + args.a_offset] /= ConstantTwo<T>();
- }
- a_mat_cpu[i*args.a_ld + i + args.a_offset] = diagonal;
- x_vec_cpu[i * args.x_inc + args.x_offset] /= ConstantTwo<T>();
- }
-
- // Copies input buffers back to the OpenCL device
- buffers.a_mat.Write(queue, args.a_size, a_mat_cpu);
- buffers.x_vec.Write(queue, args.x_size, x_vec_cpu);
- return;
-}
-
// See comment at top of file for a description of the class
template <typename T>
class TestXtrsv {
@@ -99,9 +69,28 @@ class TestXtrsv {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T> &args, Queue&, const int, std::vector<T> &x_source,
+ std::vector<T>&, std::vector<T> &a_source, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {
+ if (args.a_ld < args.n) { return; }
+ if (args.a_size <= 0 || args.x_size <= 0) { return; }
+
+ // Generates 'proper' input for the TRSV routine
+ // TODO: Improve this, currently loosely based on clBLAS's implementation
+ for (auto i = size_t{0}; i < args.n; ++i) {
+ auto diagonal = a_source[i*args.a_ld + i + args.a_offset];
+ diagonal = static_cast<T>(AbsoluteValue(diagonal)) + static_cast<T>(args.n / size_t{4});
+ for (auto j = size_t{0}; j < args.n; ++j) {
+ a_source[j*args.a_ld + i + args.a_offset] /= Constant<T>(2.0);
+ }
+ a_source[i*args.a_ld + i + args.a_offset] = diagonal;
+ x_source[i * args.x_inc + args.x_offset] /= Constant<T>(2.0);
+ }
+ }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
auto queue_plain = queue();
auto event = cl_event{};
auto status = Trsv<T>(args.layout, args.triangle, args.a_transpose, args.diagonal,
@@ -116,7 +105,6 @@ class TestXtrsv {
// Describes how to run the clBLAS routine (for correctness/performance comparison)
#ifdef CLBLAST_REF_CLBLAS
static StatusCode RunReference1(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
auto queue_plain = queue();
auto event = cl_event{};
auto status = clblasXtrsv<T>(convertToCLBLAS(args.layout),
@@ -135,7 +123,6 @@ class TestXtrsv {
// Describes how to run the CPU BLAS routine (for correctness/performance comparison)
#ifdef CLBLAST_REF_CBLAS
static StatusCode RunReference2(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));
std::vector<T> x_vec_cpu(args.x_size, static_cast<T>(0));
buffers.a_mat.Read(queue, args.a_size, a_mat_cpu);
diff --git a/test/routines/level3/xgemm.hpp b/test/routines/level3/xgemm.hpp
index bca3c049..1b12fb1c 100644
--- a/test/routines/level3/xgemm.hpp
+++ b/test/routines/level3/xgemm.hpp
@@ -82,6 +82,11 @@ class TestXgemm {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &all) { return all; }
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xhemm.hpp b/test/routines/level3/xhemm.hpp
index 31c7695f..76550b15 100644
--- a/test/routines/level3/xhemm.hpp
+++ b/test/routines/level3/xhemm.hpp
@@ -82,6 +82,11 @@ class TestXhemm {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xher2k.hpp b/test/routines/level3/xher2k.hpp
index ff2bb6cb..5ca3aac6 100644
--- a/test/routines/level3/xher2k.hpp
+++ b/test/routines/level3/xher2k.hpp
@@ -80,6 +80,11 @@ class TestXher2k {
static Transposes GetATransposes(const Transposes &) { return {Transpose::kNo, Transpose::kConjugate}; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<U>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<U> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xherk.hpp b/test/routines/level3/xherk.hpp
index 26396fa9..e93d887a 100644
--- a/test/routines/level3/xherk.hpp
+++ b/test/routines/level3/xherk.hpp
@@ -73,6 +73,11 @@ class TestXherk {
static Transposes GetATransposes(const Transposes &) { return {Transpose::kNo, Transpose::kConjugate}; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<U>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<U> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xsymm.hpp b/test/routines/level3/xsymm.hpp
index c84c22b4..9d127e26 100644
--- a/test/routines/level3/xsymm.hpp
+++ b/test/routines/level3/xsymm.hpp
@@ -82,6 +82,11 @@ class TestXsymm {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xsyr2k.hpp b/test/routines/level3/xsyr2k.hpp
index 5c4976e2..d1bdac56 100644
--- a/test/routines/level3/xsyr2k.hpp
+++ b/test/routines/level3/xsyr2k.hpp
@@ -80,6 +80,11 @@ class TestXsyr2k {
static Transposes GetATransposes(const Transposes &) { return {Transpose::kNo, Transpose::kYes}; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xsyrk.hpp b/test/routines/level3/xsyrk.hpp
index 98c4f6a4..1330924e 100644
--- a/test/routines/level3/xsyrk.hpp
+++ b/test/routines/level3/xsyrk.hpp
@@ -73,6 +73,11 @@ class TestXsyrk {
static Transposes GetATransposes(const Transposes &) { return {Transpose::kNo, Transpose::kYes}; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xtrmm.hpp b/test/routines/level3/xtrmm.hpp
index 55b51e54..7c5bd842 100644
--- a/test/routines/level3/xtrmm.hpp
+++ b/test/routines/level3/xtrmm.hpp
@@ -73,6 +73,11 @@ class TestXtrmm {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();
diff --git a/test/routines/level3/xtrsm.hpp b/test/routines/level3/xtrsm.hpp
index 1ffaef35..0da4189d 100644
--- a/test/routines/level3/xtrsm.hpp
+++ b/test/routines/level3/xtrsm.hpp
@@ -19,6 +19,8 @@
#include <vector>
#include <string>
+#include "test/routines/level3/xtrsm_data.hpp"
+
#ifdef CLBLAST_REF_CLBLAS
#include "test/wrapper_clblas.hpp"
#endif
@@ -29,38 +31,6 @@
namespace clblast {
// =================================================================================================
-// Prepares the data
-template <typename T>
-void PrepareData(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- const auto k = (args.side == Side::kLeft) ? args.m : args.n;
- if (args.a_ld < k) { return; }
- if (args.a_size <= 0 || args.b_size <= 0) { return; }
-
- // Copies input buffers to the host
- std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));
- std::vector<T> b_mat_cpu(args.b_size, static_cast<T>(0));
- buffers.a_mat.Read(queue, args.a_size, a_mat_cpu);
- buffers.b_mat.Read(queue, args.b_size, b_mat_cpu);
-
- // Generates 'proper' input for the TRSM routine
- // TODO: Improve this
- for (auto i = size_t{0}; i < k; ++i) {
- for (auto j = size_t{0}; j < k; ++j) {
- auto value = a_mat_cpu[j*args.a_ld + i + args.a_offset];
- value *= ConstantTwo<T>();
- if (IsCloseToZero(value)) { value += ConstantOne<T>(); }
- a_mat_cpu[j*args.a_ld + i + args.a_offset] = value;
- }
- }
-
- // Copies input buffers back to the OpenCL device
- buffers.a_mat.Write(queue, args.a_size, a_mat_cpu);
- buffers.b_mat.Write(queue, args.b_size, b_mat_cpu);
- return;
-}
-
-// =================================================================================================
-
// See comment at top of file for a description of the class
template <typename T>
class TestXtrsm {
@@ -105,9 +75,23 @@ class TestXtrsm {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T> &args, Queue &queue, const int seed,
+ std::vector<T>&, std::vector<T>&,
+ std::vector<T>& a_source_, std::vector<T>& b_source_, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {
+ const auto k = (args.side == Side::kLeft) ? args.m : args.n;
+ const auto b_one = (args.layout == Layout::kRowMajor) ? args.n : args.m;
+ if (args.a_ld < k) { return; }
+ if (args.b_ld < b_one) { return; }
+ if (args.a_size <= 0 || args.b_size <= 0) { return; }
+
+ // TODO: This is a copy of the clBLAS random matrix generation, make it work properly
+ GenerateProperTrsmMatrices(args, seed, &a_source_[args.a_offset], &b_source_[args.b_offset]);
+ }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
auto queue_plain = queue();
auto event = cl_event{};
auto status = Trsm(args.layout, args.side, args.triangle, args.a_transpose, args.diagonal,
@@ -122,7 +106,6 @@ class TestXtrsm {
// Describes how to run the clBLAS routine (for correctness/performance comparison)
#ifdef CLBLAST_REF_CLBLAS
static StatusCode RunReference1(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
auto queue_plain = queue();
auto event = cl_event{};
auto status = clblasXtrsm(convertToCLBLAS(args.layout),
@@ -142,7 +125,6 @@ class TestXtrsm {
// Describes how to run the CPU BLAS routine (for correctness/performance comparison)
#ifdef CLBLAST_REF_CBLAS
static StatusCode RunReference2(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
- PrepareData(args, buffers, queue);
std::vector<T> a_mat_cpu(args.a_size, static_cast<T>(0));
std::vector<T> b_mat_cpu(args.b_size, static_cast<T>(0));
buffers.a_mat.Read(queue, args.a_size, a_mat_cpu);
diff --git a/test/routines/level3/xtrsm_data.hpp b/test/routines/level3/xtrsm_data.hpp
new file mode 100644
index 00000000..21083fe9
--- /dev/null
+++ b/test/routines/level3/xtrsm_data.hpp
@@ -0,0 +1,187 @@
+
+// =================================================================================================
+// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
+// project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max-
+// width of 100 characters per line.
+//
+// Author(s):
+// Cedric Nugteren <www.cedricnugteren.nl>
+//
+// This file implements data-prepration routines for proper input for the TRSM routine. Note: The
+// data-preparation routines are taken from clBLAS
+//
+// =================================================================================================
+
+#ifndef CLBLAST_TEST_ROUTINES_XTRSM_DATA_H_
+#define CLBLAST_TEST_ROUTINES_XTRSM_DATA_H_
+
+#include <vector>
+#include <string>
+
+#include "utilities/utilities.hpp"
+
+namespace clblast {
+// =================================================================================================
+
+// Limits to prepare proper input data
+template <typename T> double TrsmLimitMatA();
+template <> double TrsmLimitMatA<float>() { return pow(2.0, 7); }
+template <> double TrsmLimitMatA<double>() { return pow(2.0, 5); }
+template <> double TrsmLimitMatA<float2>() { return TrsmLimitMatA<float>(); }
+template <> double TrsmLimitMatA<double2>() { return TrsmLimitMatA<double>(); }
+template <typename T> double TrsmLimitMatB();
+template <> double TrsmLimitMatB<float>() { return pow(2.0, 16); }
+template <> double TrsmLimitMatB<double>() { return pow(2.0, 47); }
+template <> double TrsmLimitMatB<float2>() { return TrsmLimitMatB<float>(); }
+template <> double TrsmLimitMatB<double2>() { return TrsmLimitMatB<double>(); }
+
+// Matrix element setter
+template <typename T>
+void SetElement(const clblast::Layout layout,
+ const size_t row, const size_t column, T *mat, const size_t ld, const T value)
+{
+ if (layout == clblast::Layout::kRowMajor) { mat[column + ld * row] = value; }
+ else { mat[row + ld * column] = value; }
+}
+
+// Matrix element getter
+template <typename T>
+T GetElement(const clblast::Layout layout,
+ const size_t row, const size_t column, const T *mat, const size_t ld)
+{
+ if (layout == clblast::Layout::kRowMajor) { return mat[column + ld * row]; }
+ else { return mat[row + ld * column]; }
+}
+
+// Bounds a value between 'left' and 'right'. The random value is assumed to be between -1 and +1.
+template<typename T>
+T BoundRandom(const double rand_val, const double left, const double right)
+{
+ const auto value = Constant<T>(rand_val * (right - left));
+ if (AbsoluteValue<T>(value) < 0.0) {
+ return value - Constant<T>(left);
+ }
+ else {
+ return value + Constant<T>(left);
+ }
+}
+
+// The clBLAS function to generate proper input matrices for matrices A & B. Note that this routine
+// should remain deterministic. Random values are therefore taken from the existing input, which
+// is scaled between -1 and +1.
+template <typename T>
+void GenerateProperTrsmMatrices(const Arguments<T> &args, const int seed, T *mat_a, T *mat_b)
+{
+ // Random number generator
+ std::mt19937 mt(seed);
+ std::uniform_real_distribution<double> dist(-1.0, 1.0);
+
+ const auto k = (args.side == Side::kLeft) ? args.m : args.n;
+
+ // Determines: max(|a_{ii}|) and min(|a_{ii}|)
+ // Generates: a_{ii} which are constrainted by min/max
+ auto min = ConstantZero<T>();
+ if (args.diagonal == clblast::Diagonal::kUnit) {
+ for (auto i = size_t{0}; i < k; ++i) {
+ SetElement<T>(args.layout, i, i, mat_a, args.a_ld, ConstantOne<T>()); // must not be accessed
+ }
+ }
+ else {
+ auto max = Constant<T>(dist(mt) * TrsmLimitMatA<T>());
+ if (AbsoluteValue(max) < 1.0) { max += Constant<T>(3.0); } // no zero's on the diagonal
+ min = max / Constant<T>(100.0);
+ SetElement<T>(args.layout, 0, 0, mat_a, args.a_ld, max);
+ for (auto i = size_t{1}; i < k; ++i) {
+ auto value = BoundRandom<T>(dist(mt), AbsoluteValue(min), AbsoluteValue(max));
+ if (AbsoluteValue(value) == 0) {
+ value = max;
+ }
+ SetElement<T>(args.layout, i, i, mat_a, args.a_ld, value);
+ }
+ }
+
+ // Generates a_{ij} for all j <> i.
+ for (auto i = size_t{0}; i < k; ++i) {
+ auto sum = (args.diagonal == clblast::Diagonal::kUnit) ?
+ AbsoluteValue(ConstantOne<T>()) :
+ AbsoluteValue(GetElement<T>(args.layout, i, i, mat_a, args.a_ld));
+ for (auto j = size_t{0}; j < k; ++j) {
+ if (j == i) { continue; }
+ auto value = ConstantZero<T>();
+ if (((args.triangle == clblast::Triangle::kUpper) && (j > i)) ||
+ ((args.triangle == clblast::Triangle::kLower) && (j < i))) {
+ if (sum >= 1.0) {
+ const auto limit = sum / std::sqrt(static_cast<double>(k) - static_cast<double>(j));
+ value = Constant<T>(dist(mt) * limit);
+ sum -= AbsoluteValue(value);
+ }
+ }
+ SetElement<T>(args.layout, i, j, mat_a, args.a_ld, value);
+ }
+ }
+
+ // Generate matrix B
+ if (args.side == clblast::Side::kLeft) {
+ for (auto j = size_t{0}; j < args.n; ++j) {
+ auto sum = TrsmLimitMatB<T>();
+ for (auto i = size_t{0}; i < args.m; ++i) {
+ const auto a_value = GetElement<T>(args.layout, i, i, mat_a, args.a_ld);
+ auto value = ConstantZero<T>();
+ if (sum >= 0.0) {
+ const auto limit = sum * AbsoluteValue(a_value) / std::sqrt(static_cast<double>(args.m) - static_cast<double>(i));
+ value = Constant<T>(dist(mt) * limit);
+ sum -= AbsoluteValue(value) / AbsoluteValue(a_value);
+ }
+ SetElement<T>(args.layout, i, j, mat_b, args.b_ld, value);
+ if ((i == 0 && j == 0) || (AbsoluteValue(value) < AbsoluteValue(min))) {
+ min = value;
+ }
+ }
+ }
+ }
+ else {
+ for (auto i = size_t{0}; i < args.m; ++i) {
+ auto sum = TrsmLimitMatB<T>();
+ for (auto j = size_t{0}; j < args.n; ++j) {
+ const auto a_value = GetElement<T>(args.layout, j, j, mat_a, args.a_ld);
+ auto value = ConstantZero<T>();
+ if (sum >= 0.0) {
+ const auto limit = sum * AbsoluteValue(a_value) / std::sqrt(static_cast<double>(args.n) - static_cast<double>(j));
+ value = Constant<T>(dist(mt) * limit);
+ sum -= AbsoluteValue(value) / AbsoluteValue(a_value);
+ }
+ SetElement<T>(args.layout, i, j, mat_b, args.b_ld, value);
+ if ((i == 0 && j == 0) || (AbsoluteValue(value) < AbsoluteValue(min))) {
+ min = value;
+ }
+ }
+ }
+ }
+ if (args.diagonal == clblast::Diagonal::kUnit) {
+ for (auto i = size_t{0}; i < k; ++i) {
+ SetElement<T>(args.layout, i, i, mat_a, args.a_ld, ConstantOne<T>()); // must not be accessed
+ }
+ }
+
+ // Calculate a proper alpha
+ if (AbsoluteValue(min) > AbsoluteValue(args.alpha)) {
+ // Not implemented
+ }
+
+ // Adjust matrix B according to the value of alpha
+ if (AbsoluteValue(args.alpha) != 1.0 && AbsoluteValue(args.alpha) != 0.0) {
+ for (auto i = size_t{0}; i < args.m; ++i) {
+ for (auto j = size_t{0}; j < args.n; ++j) {
+ auto value = GetElement<T>(args.layout, i, j, mat_b, args.b_ld);
+ value /= args.alpha;
+ SetElement<T>(args.layout, i, j, mat_b, args.b_ld, value);
+ }
+ }
+ }
+}
+
+// =================================================================================================
+} // namespace clblast
+
+// CLBLAST_TEST_ROUTINES_XTRSM_DATA_H_
+#endif
diff --git a/test/routines/levelx/xinvert.hpp b/test/routines/levelx/xinvert.hpp
index c6ce4b07..05bea9aa 100644
--- a/test/routines/levelx/xinvert.hpp
+++ b/test/routines/levelx/xinvert.hpp
@@ -167,6 +167,11 @@ class TestXinvert {
static Transposes GetATransposes(const Transposes &) { return {}; } // N/A for this routine
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
try {
diff --git a/test/routines/levelx/xomatcopy.hpp b/test/routines/levelx/xomatcopy.hpp
index f0739c6a..d1064d0c 100644
--- a/test/routines/levelx/xomatcopy.hpp
+++ b/test/routines/levelx/xomatcopy.hpp
@@ -127,6 +127,11 @@ class TestXomatcopy {
static Transposes GetATransposes(const Transposes &all) { return all; }
static Transposes GetBTransposes(const Transposes &) { return {}; } // N/A for this routine
+ // Describes how to prepare the input data
+ static void PrepareData(const Arguments<T>&, Queue&, const int, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&, std::vector<T>&, std::vector<T>&,
+ std::vector<T>&, std::vector<T>&) {} // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, Buffers<T> &buffers, Queue &queue) {
auto queue_plain = queue();