diff options
author | CNugteren <web@cedricnugteren.nl> | 2015-07-31 15:52:13 +0200 |
---|---|---|
committer | CNugteren <web@cedricnugteren.nl> | 2015-07-31 15:52:13 +0200 |
commit | c5d5adbddd9a7e1816e7666a2f287f8266ca2c19 (patch) | |
tree | e243248d73c3c46b0902c886cbe51599d8ec8c87 /test/correctness/routines/level3/xherk.cc | |
parent | 6e1e7fdcaf9f544c98c3f8867d0f0f60bed252dd (diff) |
Refactored the correctness tests
Diffstat (limited to 'test/correctness/routines/level3/xherk.cc')
-rw-r--r-- | test/correctness/routines/level3/xherk.cc | 72 |
1 files changed, 5 insertions, 67 deletions
diff --git a/test/correctness/routines/level3/xherk.cc b/test/correctness/routines/level3/xherk.cc index 7a4a7278..32b8aa2c 100644 --- a/test/correctness/routines/level3/xherk.cc +++ b/test/correctness/routines/level3/xherk.cc @@ -14,78 +14,16 @@ #include "correctness/testblas.h" #include "routines/level3/xherk.h" -namespace clblast { // ================================================================================================= -// The correctness tester -template <typename T, typename U> -void RunTest(int argc, char *argv[], const bool silent, const std::string &name) { - - // Creates a tester - TestBlas<T,U> tester{argc, argv, silent, name, TestXherk<T,U>::GetOptions(), - TestXherk<T,U>::RunRoutine, TestXherk<T,U>::RunReference, - TestXherk<T,U>::DownloadResult, TestXherk<T,U>::GetResultIndex, - TestXherk<T,U>::ResultID1, TestXherk<T,U>::ResultID2}; - - // This variable holds the arguments relevant for this routine - auto args = Arguments<U>{}; - - // Loops over the test-cases from a data-layout point of view - for (auto &layout: tester.kLayouts) { args.layout = layout; - for (auto &triangle: tester.kTriangles) { args.triangle = triangle; - for (auto &a_transpose: {Transpose::kNo, Transpose::kConjugate}) { // Regular transpose not a - args.a_transpose = a_transpose; // valid BLAS option - - // Creates the arguments vector for the regular tests - auto regular_test_vector = std::vector<Arguments<U>>{}; - for (auto &n: tester.kMatrixDims) { args.n = n; - for (auto &k: tester.kMatrixDims) { args.k = k; - for (auto &a_ld: tester.kMatrixDims) { args.a_ld = a_ld; - for (auto &a_offset: tester.kOffsets) { args.a_offset = a_offset; - for (auto &c_ld: tester.kMatrixDims) { args.c_ld = c_ld; - for (auto &c_offset: tester.kOffsets) { args.c_offset = c_offset; - for (auto &alpha: tester.kAlphaValues) { args.alpha = alpha; - for (auto &beta: tester.kBetaValues) { args.beta = beta; - args.a_size = TestXherk<T,U>::GetSizeA(args); - args.c_size = TestXherk<T,U>::GetSizeC(args); - if (args.a_size<1 || args.c_size<1) { continue; } - regular_test_vector.push_back(args); - } - } - } - } - } - } - } - } - - // Creates the arguments vector for the invalid-buffer tests - auto invalid_test_vector = std::vector<Arguments<U>>{}; - args.n = args.k = tester.kBufferSize; - args.a_ld = args.c_ld = tester.kBufferSize; - args.a_offset = args.c_offset = 0; - for (auto &a_size: tester.kMatSizes) { args.a_size = a_size; - for (auto &c_size: tester.kMatSizes) { args.c_size = c_size; - invalid_test_vector.push_back(args); - } - } - - // Runs the tests - const auto case_name = ToString(layout)+" "+ToString(triangle)+" "+ToString(a_transpose); - tester.TestRegular(regular_test_vector, case_name); - tester.TestInvalid(invalid_test_vector, case_name); - } - } - } -} - -// ================================================================================================= -} // namespace clblast +// Shortcuts to the clblast namespace +using float2 = clblast::float2; +using double2 = clblast::double2; // Main function (not within the clblast namespace) int main(int argc, char *argv[]) { - clblast::RunTest<clblast::float2,float>(argc, argv, false, "CHERK"); - clblast::RunTest<clblast::double2,double>(argc, argv, true, "ZHERK"); + clblast::RunTests<clblast::TestXherk<float2,float>, float2, float>(argc, argv, false, "CHERK"); + clblast::RunTests<clblast::TestXherk<double2,double>, double2, double>(argc, argv, true, "ZHERK"); return 0; } |