summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-03-05 11:13:47 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-03-05 11:13:47 +0100
commit7f14b11f1e240f12f5f6bf93cbbeab26001e9a5c (patch)
tree1ef26380cac190c11a8eea68b90d05f0593c2738 /test
parentf9a520b3aff7b4eec99d9e11a03f9467e7ab351c (diff)
Changed the way the test-data is generated: now using a single MT generator and distribution for all data
Diffstat (limited to 'test')
-rw-r--r--test/correctness/misc/override_parameters.cpp15
-rw-r--r--test/correctness/testblas.cpp18
-rw-r--r--test/performance/client.cpp22
-rw-r--r--test/routines/levelx/xinvert.hpp2
4 files changed, 35 insertions, 22 deletions
diff --git a/test/correctness/misc/override_parameters.cpp b/test/correctness/misc/override_parameters.cpp
index a4cecf0d..e6eebef7 100644
--- a/test/correctness/misc/override_parameters.cpp
+++ b/test/correctness/misc/override_parameters.cpp
@@ -11,11 +11,14 @@
//
// =================================================================================================
+#include <string>
+#include <vector>
+#include <unordered_map>
+#include <random>
+
#include "utilities/utilities.hpp"
#include "test/routines/level3/xgemm.hpp"
-#include <unordered_map>
-
namespace clblast {
// =================================================================================================
@@ -71,9 +74,11 @@ size_t RunOverrideTests(int argc, char *argv[], const bool silent, const std::st
auto host_a = std::vector<T>(args.m * args.k);
auto host_b = std::vector<T>(args.n * args.k);
auto host_c = std::vector<T>(args.m * args.n);
- PopulateVector(host_a, kSeed);
- PopulateVector(host_b, kSeed);
- PopulateVector(host_c, kSeed);
+ std::mt19937 mt(kSeed);
+ std::uniform_real_distribution<double> dist(kTestDataLowerLimit, kTestDataUpperLimit);
+ PopulateVector(host_a, mt, dist);
+ PopulateVector(host_b, mt, dist);
+ PopulateVector(host_c, mt, dist);
// Copy the matrices to the device
auto device_a = Buffer<T>(context, host_a.size());
diff --git a/test/correctness/testblas.cpp b/test/correctness/testblas.cpp
index d959ce18..505b3b36 100644
--- a/test/correctness/testblas.cpp
+++ b/test/correctness/testblas.cpp
@@ -13,7 +13,9 @@
#include <algorithm>
#include <iostream>
+#include <random>
+#include "utilities/utilities.hpp"
#include "test/correctness/testblas.hpp"
namespace clblast {
@@ -88,13 +90,15 @@ TestBlas<T,U>::TestBlas(const std::vector<std::string> &arguments, const bool si
c_source_.resize(std::max(max_mat, max_matvec)*std::max(max_ld, max_matvec) + max_offset);
ap_source_.resize(std::max(max_mat, max_matvec)*std::max(max_mat, max_matvec) + max_offset);
scalar_source_.resize(std::max(max_mat, max_matvec) + max_offset);
- PopulateVector(x_source_, kSeed);
- PopulateVector(y_source_, kSeed);
- PopulateVector(a_source_, kSeed);
- PopulateVector(b_source_, kSeed);
- PopulateVector(c_source_, kSeed);
- PopulateVector(ap_source_, kSeed);
- PopulateVector(scalar_source_, kSeed);
+ std::mt19937 mt(kSeed);
+ std::uniform_real_distribution<double> dist(kTestDataLowerLimit, kTestDataUpperLimit);
+ PopulateVector(x_source_, mt, dist);
+ PopulateVector(y_source_, mt, dist);
+ PopulateVector(a_source_, mt, dist);
+ PopulateVector(b_source_, mt, dist);
+ PopulateVector(c_source_, mt, dist);
+ PopulateVector(ap_source_, mt, dist);
+ PopulateVector(scalar_source_, mt, dist);
}
// ===============================================================================================
diff --git a/test/performance/client.cpp b/test/performance/client.cpp
index 2c45b35e..16b44b5a 100644
--- a/test/performance/client.cpp
+++ b/test/performance/client.cpp
@@ -11,13 +11,15 @@
//
// =================================================================================================
-#include "test/performance/client.hpp"
-
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <chrono>
+#include <random>
+
+#include "utilities/utilities.hpp"
+#include "test/performance/client.hpp"
namespace clblast {
// =================================================================================================
@@ -179,13 +181,15 @@ void Client<T,U>::PerformanceTest(Arguments<U> &args, const SetMetric set_sizes)
std::vector<T> c_source(args.c_size);
std::vector<T> ap_source(args.ap_size);
std::vector<T> scalar_source(args.scalar_size);
- PopulateVector(x_source, kSeed);
- PopulateVector(y_source, kSeed);
- PopulateVector(a_source, kSeed);
- PopulateVector(b_source, kSeed);
- PopulateVector(c_source, kSeed);
- PopulateVector(ap_source, kSeed);
- PopulateVector(scalar_source, kSeed);
+ std::mt19937 mt(kSeed);
+ std::uniform_real_distribution<double> dist(kTestDataLowerLimit, kTestDataUpperLimit);
+ PopulateVector(x_source, mt, dist);
+ PopulateVector(y_source, mt, dist);
+ PopulateVector(a_source, mt, dist);
+ PopulateVector(b_source, mt, dist);
+ PopulateVector(c_source, mt, dist);
+ PopulateVector(ap_source, mt, dist);
+ PopulateVector(scalar_source, mt, dist);
// Creates the matrices on the device
auto x_vec = Buffer<T>(context, args.x_size);
diff --git a/test/routines/levelx/xinvert.hpp b/test/routines/levelx/xinvert.hpp
index 05bea9aa..b470dbf3 100644
--- a/test/routines/levelx/xinvert.hpp
+++ b/test/routines/levelx/xinvert.hpp
@@ -19,7 +19,7 @@
#include <vector>
#include <string>
-#include "routines/levelx/xinvert.hpp"
+#include "utilities/utilities.hpp"
namespace clblast {
// =================================================================================================