2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// =================================================================================================
|
2015-06-29 20:39:51 +02:00
|
|
|
// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. This
|
2015-06-28 15:52:57 +02:00
|
|
|
// 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 tests any CLBlast routine. It contains two types of tests: one testing all sorts of
|
|
|
|
// input combinations, and one deliberatly testing with invalid values.
|
2015-07-08 07:21:44 +02:00
|
|
|
// Typename T: the data-type of the routine's memory buffers (==precision)
|
|
|
|
// Typename U: the data-type of the alpha and beta arguments
|
2015-06-28 15:52:57 +02:00
|
|
|
//
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
#ifndef CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_
|
|
|
|
#define CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
2015-07-31 15:52:13 +02:00
|
|
|
#include <algorithm>
|
2015-06-28 15:52:57 +02:00
|
|
|
|
2016-06-18 20:20:13 +02:00
|
|
|
#include "test/correctness/tester.hpp"
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
namespace clblast {
|
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
// See comment at top of file for a description of the class
|
2015-07-08 07:21:44 +02:00
|
|
|
template <typename T, typename U>
|
|
|
|
class TestBlas: public Tester<T,U> {
|
2015-06-28 15:52:57 +02:00
|
|
|
public:
|
2017-03-12 10:41:18 +01:00
|
|
|
static const int kSeed;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// Uses several variables from the Tester class
|
2015-07-08 07:21:44 +02:00
|
|
|
using Tester<T,U>::context_;
|
|
|
|
using Tester<T,U>::queue_;
|
|
|
|
using Tester<T,U>::full_test_;
|
2016-04-27 14:38:30 +02:00
|
|
|
using Tester<T,U>::verbose_;
|
2015-07-08 07:21:44 +02:00
|
|
|
using Tester<T,U>::device_;
|
2016-05-07 12:22:06 +02:00
|
|
|
using Tester<T,U>::compare_clblas_;
|
|
|
|
using Tester<T,U>::compare_cblas_;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// Uses several helper functions from the Tester class
|
2015-07-08 07:21:44 +02:00
|
|
|
using Tester<T,U>::TestStart;
|
|
|
|
using Tester<T,U>::TestEnd;
|
|
|
|
using Tester<T,U>::TestErrorCount;
|
|
|
|
using Tester<T,U>::TestErrorCodes;
|
|
|
|
using Tester<T,U>::GetOffsets;
|
2016-05-30 20:07:09 +02:00
|
|
|
using Tester<T,U>::GetOptionsString;
|
2016-06-06 12:20:42 +02:00
|
|
|
using Tester<T,U>::GetSizesString;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// Test settings for the regular test. Append to these lists in case more tests are required.
|
2016-10-18 10:19:03 +02:00
|
|
|
static const std::vector<size_t> kVectorDims;
|
|
|
|
static const std::vector<size_t> kIncrements;
|
|
|
|
static const std::vector<size_t> kMatrixDims;
|
|
|
|
static const std::vector<size_t> kMatrixVectorDims;
|
|
|
|
static const std::vector<size_t> kBandSizes;
|
2017-03-05 15:04:16 +01:00
|
|
|
static const std::vector<size_t> kBatchCounts;
|
2016-10-18 10:19:03 +02:00
|
|
|
const std::vector<size_t> kOffsets;
|
|
|
|
const std::vector<U> kAlphaValues;
|
|
|
|
const std::vector<U> kBetaValues;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// Test settings for the invalid tests
|
2016-10-18 10:19:03 +02:00
|
|
|
static const std::vector<size_t> kInvalidIncrements;
|
|
|
|
static const size_t kBufferSize;
|
|
|
|
static const std::vector<size_t> kMatSizes;
|
|
|
|
static const std::vector<size_t> kVecSizes;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// The layout/transpose/triangle options to test with
|
2016-10-18 10:19:03 +02:00
|
|
|
static const std::vector<Layout> kLayouts;
|
|
|
|
static const std::vector<Triangle> kTriangles;
|
|
|
|
static const std::vector<Side> kSides;
|
|
|
|
static const std::vector<Diagonal> kDiagonals;
|
2015-06-28 15:52:57 +02:00
|
|
|
static const std::vector<Transpose> kTransposes; // Data-type dependent, see .cc-file
|
|
|
|
|
|
|
|
// Shorthand for the routine-specific functions passed to the tester
|
2017-03-04 15:21:33 +01:00
|
|
|
using DataPrepare = std::function<void(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>&)>;
|
2017-03-08 20:10:20 +01:00
|
|
|
using Routine = std::function<StatusCode(const Arguments<U>&, Buffers<T>&, Queue&)>;
|
2015-07-27 07:18:06 +02:00
|
|
|
using ResultGet = std::function<std::vector<T>(const Arguments<U>&, Buffers<T>&, Queue&)>;
|
2015-07-08 07:21:44 +02:00
|
|
|
using ResultIndex = std::function<size_t(const Arguments<U>&, const size_t, const size_t)>;
|
|
|
|
using ResultIterator = std::function<size_t(const Arguments<U>&)>;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// Constructor, initializes the base class tester and input data
|
2016-11-27 11:00:29 +01:00
|
|
|
TestBlas(const std::vector<std::string> &arguments, const bool silent,
|
2015-06-28 15:52:57 +02:00
|
|
|
const std::string &name, const std::vector<std::string> &options,
|
2017-03-04 15:21:33 +01:00
|
|
|
const DataPrepare prepare_data,
|
2016-05-07 12:22:06 +02:00
|
|
|
const Routine run_routine,
|
|
|
|
const Routine run_reference1, const Routine run_reference2,
|
2016-04-02 20:58:00 +02:00
|
|
|
const ResultGet get_result, const ResultIndex get_index,
|
|
|
|
const ResultIterator get_id1, const ResultIterator get_id2);
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// The test functions, taking no inputs
|
2015-07-08 07:21:44 +02:00
|
|
|
void TestRegular(std::vector<Arguments<U>> &test_vector, const std::string &name);
|
|
|
|
void TestInvalid(std::vector<Arguments<U>> &test_vector, const std::string &name);
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
// Source data to test with
|
|
|
|
std::vector<T> x_source_;
|
|
|
|
std::vector<T> y_source_;
|
|
|
|
std::vector<T> a_source_;
|
|
|
|
std::vector<T> b_source_;
|
|
|
|
std::vector<T> c_source_;
|
2015-09-19 17:37:42 +02:00
|
|
|
std::vector<T> ap_source_;
|
2016-03-28 23:00:44 +02:00
|
|
|
std::vector<T> scalar_source_;
|
2015-06-28 15:52:57 +02:00
|
|
|
|
|
|
|
// The routine-specific functions passed to the tester
|
2017-03-04 15:21:33 +01:00
|
|
|
DataPrepare prepare_data_;
|
2015-06-28 15:52:57 +02:00
|
|
|
Routine run_routine_;
|
|
|
|
Routine run_reference_;
|
|
|
|
ResultGet get_result_;
|
|
|
|
ResultIndex get_index_;
|
|
|
|
ResultIterator get_id1_;
|
|
|
|
ResultIterator get_id2_;
|
|
|
|
};
|
|
|
|
|
2015-07-31 15:52:13 +02:00
|
|
|
// =================================================================================================
|
|
|
|
|
|
|
|
// The interface to the correctness tester. This is a separate function in the header such that it
|
|
|
|
// is automatically compiled for each routine, templated by the parameter "C".
|
|
|
|
template <typename C, typename T, typename U>
|
2016-06-02 16:24:22 +02:00
|
|
|
size_t RunTests(int argc, char *argv[], const bool silent, const std::string &name) {
|
2016-11-27 11:00:29 +01:00
|
|
|
auto command_line_args = RetrieveCommandLineArguments(argc, argv);
|
2015-07-31 15:52:13 +02:00
|
|
|
|
2016-04-02 20:58:00 +02:00
|
|
|
// Sets the reference to test against
|
2016-05-07 12:22:06 +02:00
|
|
|
#if defined(CLBLAST_REF_CLBLAS) && defined(CLBLAST_REF_CBLAS)
|
|
|
|
const auto reference_routine1 = C::RunReference1; // clBLAS
|
|
|
|
const auto reference_routine2 = C::RunReference2; // CBLAS
|
|
|
|
#elif CLBLAST_REF_CLBLAS
|
|
|
|
const auto reference_routine1 = C::RunReference1; // clBLAS
|
|
|
|
const auto reference_routine2 = C::RunReference1; // not used, dummy
|
|
|
|
#elif CLBLAST_REF_CBLAS
|
|
|
|
const auto reference_routine1 = C::RunReference2; // not used, dummy
|
|
|
|
const auto reference_routine2 = C::RunReference2; // CBLAS
|
2016-04-02 20:58:00 +02:00
|
|
|
#endif
|
|
|
|
|
2016-06-16 18:07:46 +02:00
|
|
|
// Non-BLAS routines cannot be fully tested
|
|
|
|
if (!silent && C::BLASLevel() == 4) {
|
|
|
|
fprintf(stdout, "\n* NOTE: This non-BLAS routine is tested against a custom implementation,\n");
|
|
|
|
fprintf(stdout, " not against clBLAS or a CPU BLAS library. Thus, the arguments '-clblas'\n");
|
|
|
|
fprintf(stdout, " and '-cblas' have no effect.\n");
|
|
|
|
}
|
|
|
|
|
2015-07-31 15:52:13 +02:00
|
|
|
// Creates a tester
|
|
|
|
auto options = C::GetOptions();
|
2016-11-27 11:00:29 +01:00
|
|
|
TestBlas<T,U> tester{command_line_args, silent, name, options,
|
2017-03-04 15:21:33 +01:00
|
|
|
C::PrepareData, C::RunRoutine, reference_routine1, reference_routine2,
|
2015-07-31 15:52:13 +02:00
|
|
|
C::DownloadResult, C::GetResultIndex, C::ResultID1, C::ResultID2};
|
|
|
|
|
|
|
|
// This variable holds the arguments relevant for this routine
|
|
|
|
auto args = Arguments<U>{};
|
|
|
|
|
|
|
|
// Initializes the vectors with a single element. If this particular option is relevant for this
|
|
|
|
// routine, this vector is overridden. Otherwise, it is unused - the value here does not matter.
|
|
|
|
auto ms = std::vector<size_t>{args.m};
|
|
|
|
auto ns = std::vector<size_t>{args.n};
|
|
|
|
auto ks = std::vector<size_t>{args.k};
|
2015-09-18 15:25:20 +02:00
|
|
|
auto kus = std::vector<size_t>{args.ku};
|
|
|
|
auto kls = std::vector<size_t>{args.kl};
|
2015-07-31 15:52:13 +02:00
|
|
|
auto layouts = std::vector<Layout>{args.layout};
|
|
|
|
auto a_transposes = std::vector<Transpose>{args.a_transpose};
|
|
|
|
auto b_transposes = std::vector<Transpose>{args.b_transpose};
|
|
|
|
auto sides = std::vector<Side>{args.side};
|
|
|
|
auto triangles = std::vector<Triangle>{args.triangle};
|
|
|
|
auto diagonals = std::vector<Diagonal>{args.diagonal};
|
|
|
|
auto x_incs = std::vector<size_t>{args.x_inc};
|
|
|
|
auto y_incs = std::vector<size_t>{args.y_inc};
|
|
|
|
auto x_offsets = std::vector<size_t>{args.x_offset};
|
|
|
|
auto y_offsets = std::vector<size_t>{args.y_offset};
|
|
|
|
auto a_lds = std::vector<size_t>{args.a_ld};
|
|
|
|
auto b_lds = std::vector<size_t>{args.b_ld};
|
|
|
|
auto c_lds = std::vector<size_t>{args.c_ld};
|
|
|
|
auto a_offsets = std::vector<size_t>{args.a_offset};
|
|
|
|
auto b_offsets = std::vector<size_t>{args.b_offset};
|
|
|
|
auto c_offsets = std::vector<size_t>{args.c_offset};
|
2015-09-19 17:37:42 +02:00
|
|
|
auto ap_offsets = std::vector<size_t>{args.ap_offset};
|
2015-09-14 12:28:50 +02:00
|
|
|
auto dot_offsets = std::vector<size_t>{args.dot_offset};
|
2016-03-28 23:00:44 +02:00
|
|
|
auto nrm2_offsets = std::vector<size_t>{args.nrm2_offset};
|
2016-04-15 03:58:26 +02:00
|
|
|
auto asum_offsets = std::vector<size_t>{args.asum_offset};
|
2016-04-21 06:12:51 +02:00
|
|
|
auto imax_offsets = std::vector<size_t>{args.imax_offset};
|
2015-07-31 15:52:13 +02:00
|
|
|
auto alphas = std::vector<U>{args.alpha};
|
|
|
|
auto betas = std::vector<U>{args.beta};
|
2017-03-05 15:04:16 +01:00
|
|
|
auto batch_counts = std::vector<size_t>{args.batch_count};
|
2015-07-31 15:52:13 +02:00
|
|
|
auto x_sizes = std::vector<size_t>{args.x_size};
|
|
|
|
auto y_sizes = std::vector<size_t>{args.y_size};
|
|
|
|
auto a_sizes = std::vector<size_t>{args.a_size};
|
|
|
|
auto b_sizes = std::vector<size_t>{args.b_size};
|
|
|
|
auto c_sizes = std::vector<size_t>{args.c_size};
|
2015-09-19 17:37:42 +02:00
|
|
|
auto ap_sizes = std::vector<size_t>{args.ap_size};
|
2015-07-31 15:52:13 +02:00
|
|
|
|
|
|
|
// Sets the dimensions of the matrices or vectors depending on the BLAS level
|
2016-06-16 18:07:46 +02:00
|
|
|
auto dimensions = (C::BLASLevel() == 4) ? tester.kMatrixDims : // non-BLAS extra routines
|
|
|
|
(C::BLASLevel() == 3) ? tester.kMatrixDims : // level 3
|
|
|
|
(C::BLASLevel() == 2) ? tester.kMatrixVectorDims : // level 2
|
2015-07-31 15:52:13 +02:00
|
|
|
tester.kVectorDims; // else: level 1
|
|
|
|
|
|
|
|
// For the options relevant to this routine, sets the vectors to proper values
|
|
|
|
for (auto &option: options) {
|
|
|
|
if (option == kArgM) { ms = dimensions; }
|
|
|
|
if (option == kArgN) { ns = dimensions; }
|
|
|
|
if (option == kArgK) { ks = dimensions; }
|
2015-09-18 15:25:20 +02:00
|
|
|
if (option == kArgKU) { kus = tester.kBandSizes; }
|
|
|
|
if (option == kArgKL) { kls = tester.kBandSizes; }
|
2015-07-31 15:52:13 +02:00
|
|
|
if (option == kArgLayout) { layouts = tester.kLayouts; }
|
|
|
|
if (option == kArgATransp) { a_transposes = C::GetATransposes(tester.kTransposes); }
|
|
|
|
if (option == kArgBTransp) { b_transposes = C::GetBTransposes(tester.kTransposes); }
|
|
|
|
if (option == kArgSide) { sides = tester.kSides; }
|
|
|
|
if (option == kArgTriangle) { triangles = tester.kTriangles; }
|
|
|
|
if (option == kArgDiagonal) { diagonals = tester.kDiagonals; }
|
|
|
|
if (option == kArgXInc) { x_incs = tester.kIncrements; }
|
|
|
|
if (option == kArgYInc) { y_incs = tester.kIncrements; }
|
|
|
|
if (option == kArgXOffset) { x_offsets = tester.kOffsets; }
|
|
|
|
if (option == kArgYOffset) { y_offsets = tester.kOffsets; }
|
|
|
|
if (option == kArgALeadDim) { a_lds = dimensions; }
|
|
|
|
if (option == kArgBLeadDim) { b_lds = dimensions; }
|
|
|
|
if (option == kArgCLeadDim) { c_lds = dimensions; }
|
|
|
|
if (option == kArgAOffset) { a_offsets = tester.kOffsets; }
|
|
|
|
if (option == kArgBOffset) { b_offsets = tester.kOffsets; }
|
|
|
|
if (option == kArgCOffset) { c_offsets = tester.kOffsets; }
|
2015-09-19 17:37:42 +02:00
|
|
|
if (option == kArgAPOffset) { ap_offsets = tester.kOffsets; }
|
2015-09-14 12:28:50 +02:00
|
|
|
if (option == kArgDotOffset) { dot_offsets = tester.kOffsets; }
|
2016-03-28 23:00:44 +02:00
|
|
|
if (option == kArgNrm2Offset) { nrm2_offsets = tester.kOffsets; }
|
2016-04-15 03:58:26 +02:00
|
|
|
if (option == kArgAsumOffset) { asum_offsets = tester.kOffsets; }
|
2016-04-21 06:12:51 +02:00
|
|
|
if (option == kArgImaxOffset) { imax_offsets = tester.kOffsets; }
|
2015-07-31 15:52:13 +02:00
|
|
|
if (option == kArgAlpha) { alphas = tester.kAlphaValues; }
|
|
|
|
if (option == kArgBeta) { betas = tester.kBetaValues; }
|
2017-03-05 15:04:16 +01:00
|
|
|
if (option == kArgBatchCount) { batch_counts = tester.kBatchCounts; }
|
2015-07-31 15:52:13 +02:00
|
|
|
|
|
|
|
if (option == kArgXOffset) { x_sizes = tester.kVecSizes; }
|
|
|
|
if (option == kArgYOffset) { y_sizes = tester.kVecSizes; }
|
|
|
|
if (option == kArgAOffset) { a_sizes = tester.kMatSizes; }
|
|
|
|
if (option == kArgBOffset) { b_sizes = tester.kMatSizes; }
|
|
|
|
if (option == kArgCOffset) { c_sizes = tester.kMatSizes; }
|
2015-09-19 17:37:42 +02:00
|
|
|
if (option == kArgAPOffset) { ap_sizes = tester.kMatSizes; }
|
2015-07-31 15:52:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Loops over the test-cases from a data-layout point of view
|
|
|
|
for (auto &layout: layouts) { args.layout = layout;
|
|
|
|
for (auto &a_transpose: a_transposes) { args.a_transpose = a_transpose;
|
|
|
|
for (auto &b_transpose: b_transposes) { args.b_transpose = b_transpose;
|
|
|
|
for (auto &side: sides) { args.side = side;
|
|
|
|
for (auto &triangle: triangles) { args.triangle = triangle;
|
|
|
|
for (auto &diagonal: diagonals) { args.diagonal = diagonal;
|
|
|
|
|
|
|
|
// Creates the arguments vector for the regular tests
|
|
|
|
auto regular_test_vector = std::vector<Arguments<U>>{};
|
|
|
|
auto r_args = args;
|
|
|
|
for (auto &m: ms) { r_args.m = m;
|
|
|
|
for (auto &n: ns) { r_args.n = n;
|
|
|
|
for (auto &k: ks) { r_args.k = k;
|
2015-09-18 15:25:20 +02:00
|
|
|
for (auto &ku: kus) { r_args.ku = ku;
|
|
|
|
for (auto &kl: kls) { r_args.kl = kl;
|
|
|
|
for (auto &x_inc: x_incs) { r_args.x_inc = x_inc;
|
|
|
|
for (auto &x_offset: x_offsets) { r_args.x_offset = x_offset;
|
|
|
|
for (auto &y_inc: y_incs) { r_args.y_inc = y_inc;
|
|
|
|
for (auto &y_offset: y_offsets) { r_args.y_offset = y_offset;
|
|
|
|
for (auto &a_ld: a_lds) { r_args.a_ld = a_ld;
|
|
|
|
for (auto &a_offset: a_offsets) { r_args.a_offset = a_offset;
|
|
|
|
for (auto &b_ld: b_lds) { r_args.b_ld = b_ld;
|
|
|
|
for (auto &b_offset: b_offsets) { r_args.b_offset = b_offset;
|
|
|
|
for (auto &c_ld: c_lds) { r_args.c_ld = c_ld;
|
|
|
|
for (auto &c_offset: c_offsets) { r_args.c_offset = c_offset;
|
2015-09-19 17:37:42 +02:00
|
|
|
for (auto &ap_offset: ap_offsets) { r_args.ap_offset = ap_offset;
|
|
|
|
for (auto &dot_offset: dot_offsets) { r_args.dot_offset = dot_offset;
|
2016-03-28 23:00:44 +02:00
|
|
|
for (auto &nrm2_offset: nrm2_offsets) { r_args.nrm2_offset = nrm2_offset;
|
2016-04-15 03:58:26 +02:00
|
|
|
for (auto &asum_offset: asum_offsets) { r_args.asum_offset = asum_offset;
|
2016-04-21 06:12:51 +02:00
|
|
|
for (auto &imax_offset: imax_offsets) { r_args.imax_offset = imax_offset;
|
|
|
|
for (auto &alpha: alphas) { r_args.alpha = alpha;
|
|
|
|
for (auto &beta: betas) { r_args.beta = beta;
|
2017-03-05 15:04:16 +01:00
|
|
|
for (auto &batch_count: batch_counts) { r_args.batch_count = batch_count;
|
|
|
|
C::SetSizes(r_args);
|
|
|
|
regular_test_vector.push_back(r_args);
|
|
|
|
}
|
2016-04-21 06:12:51 +02:00
|
|
|
}
|
2016-04-15 03:58:26 +02:00
|
|
|
}
|
2016-03-28 23:00:44 +02:00
|
|
|
}
|
2015-09-19 17:37:42 +02:00
|
|
|
}
|
2015-09-18 15:25:20 +02:00
|
|
|
}
|
|
|
|
}
|
2015-09-14 12:28:50 +02:00
|
|
|
}
|
2015-07-31 15:52:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Creates the arguments vector for the invalid-buffer tests
|
2016-04-02 20:58:00 +02:00
|
|
|
#ifdef CLBLAST_REF_CLBLAS
|
|
|
|
auto invalid_test_vector = std::vector<Arguments<U>>{};
|
|
|
|
auto i_args = args;
|
|
|
|
i_args.m = i_args.n = i_args.k = i_args.kl = i_args.ku = tester.kBufferSize;
|
|
|
|
i_args.a_ld = i_args.b_ld = i_args.c_ld = tester.kBufferSize;
|
|
|
|
for (auto &x_size: x_sizes) { i_args.x_size = x_size;
|
|
|
|
for (auto &y_size: y_sizes) { i_args.y_size = y_size;
|
|
|
|
for (auto &a_size: a_sizes) { i_args.a_size = a_size;
|
|
|
|
for (auto &b_size: b_sizes) { i_args.b_size = b_size;
|
|
|
|
for (auto &c_size: c_sizes) { i_args.c_size = c_size;
|
|
|
|
for (auto &ap_size: ap_sizes) { i_args.ap_size = ap_size;
|
|
|
|
invalid_test_vector.push_back(i_args);
|
|
|
|
}
|
2015-09-19 17:37:42 +02:00
|
|
|
}
|
2015-07-31 15:52:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-02 20:58:00 +02:00
|
|
|
#endif
|
2015-07-31 15:52:13 +02:00
|
|
|
|
|
|
|
// Sets the name of this test-case
|
|
|
|
auto names = std::vector<std::string>{};
|
|
|
|
for (auto &option: options) {
|
|
|
|
if (option == kArgLayout) { names.push_back(ToString(layout)); }
|
|
|
|
if (option == kArgATransp) { names.push_back(ToString(a_transpose)); }
|
|
|
|
if (option == kArgBTransp) { names.push_back(ToString(b_transpose)); }
|
|
|
|
if (option == kArgSide) { names.push_back(ToString(side)); }
|
|
|
|
if (option == kArgTriangle) { names.push_back(ToString(triangle)); }
|
|
|
|
if (option == kArgDiagonal) { names.push_back(ToString(diagonal)); }
|
|
|
|
}
|
|
|
|
if (names.size() == 0) { names.push_back("default"); }
|
|
|
|
auto case_name = std::string{};
|
|
|
|
for (auto i=size_t{0}; i<names.size(); ++i) {
|
|
|
|
case_name += names[i];
|
|
|
|
if (i != names.size()-1) { case_name += " "; }
|
|
|
|
}
|
|
|
|
|
|
|
|
// Runs the tests
|
|
|
|
tester.TestRegular(regular_test_vector, case_name);
|
2016-04-02 20:58:00 +02:00
|
|
|
#ifdef CLBLAST_REF_CLBLAS
|
2016-06-16 18:07:46 +02:00
|
|
|
if (C::BLASLevel() != 4) {
|
|
|
|
tester.TestInvalid(invalid_test_vector, case_name);
|
|
|
|
}
|
2016-04-02 20:58:00 +02:00
|
|
|
#endif
|
2015-07-31 15:52:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-06-02 16:24:22 +02:00
|
|
|
return tester.NumFailedTests();
|
2015-07-31 15:52:13 +02:00
|
|
|
}
|
|
|
|
|
2015-06-28 15:52:57 +02:00
|
|
|
// =================================================================================================
|
|
|
|
} // namespace clblast
|
|
|
|
|
|
|
|
// CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_
|
|
|
|
#endif
|