diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-03-05 11:13:47 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-03-05 11:13:47 +0100 |
commit | 7f14b11f1e240f12f5f6bf93cbbeab26001e9a5c (patch) | |
tree | 1ef26380cac190c11a8eea68b90d05f0593c2738 /test/correctness | |
parent | f9a520b3aff7b4eec99d9e11a03f9467e7ab351c (diff) |
Changed the way the test-data is generated: now using a single MT generator and distribution for all data
Diffstat (limited to 'test/correctness')
-rw-r--r-- | test/correctness/misc/override_parameters.cpp | 15 | ||||
-rw-r--r-- | test/correctness/testblas.cpp | 18 |
2 files changed, 21 insertions, 12 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); } // =============================================================================================== |