From f6b2cd95793f12a5d8e146fd99a7cdc4e76cb4a9 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Mon, 30 May 2016 20:07:09 +0200 Subject: Increased the verbosity of the -verbose option in the correctness tests --- CHANGELOG | 1 + test/correctness/testblas.cc | 5 +++ test/correctness/testblas.h | 1 + test/correctness/tester.cc | 72 ++++++++++++++++++++++++-------------------- test/correctness/tester.h | 3 ++ 5 files changed, 50 insertions(+), 32 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 5d3c6d99..4d4773c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,6 +2,7 @@ Development version (next release) - Made it possible to compile the performance tests (clients) separately from the correctness tests - Made a reference BLAS and head-to-head performance comparison optional in the clients +- Increased the verbosity of the "-verbose" option in the correctness tests - Added support for half-precision floating-point (fp16) in the library - Added half-precision routines: * Level-1: HSWAP/HSCAL/HCOPY/HAXPY/HDOT/HNRM2/HASUM/HSUM/iHAMAX/iHMAX/iHMIN diff --git a/test/correctness/testblas.cc b/test/correctness/testblas.cc index 50871402..04bd3aa3 100644 --- a/test/correctness/testblas.cc +++ b/test/correctness/testblas.cc @@ -86,6 +86,11 @@ void TestBlas::TestRegular(std::vector> &test_vector, const st // Iterates over all the to-be-tested combinations of arguments for (auto &args: test_vector) { + // Prints the current test configuration + if (verbose_) { + fprintf(stdout, " Config: %s-> ", GetOptionsString(args).c_str()); + } + // Runs the CLBlast code auto x_vec2 = Buffer(context_, args.x_size); auto y_vec2 = Buffer(context_, args.y_size); diff --git a/test/correctness/testblas.h b/test/correctness/testblas.h index 4ffc1558..44adab9f 100644 --- a/test/correctness/testblas.h +++ b/test/correctness/testblas.h @@ -46,6 +46,7 @@ class TestBlas: public Tester { using Tester::TestErrorCount; using Tester::TestErrorCodes; using Tester::GetOffsets; + using Tester::GetOptionsString; // Test settings for the regular test. Append to these lists in case more tests are required. const std::vector kVectorDims = { 7, 93, 4096 }; diff --git a/test/correctness/tester.cc b/test/correctness/tester.cc index 5b603585..c60193cb 100644 --- a/test/correctness/tester.cc +++ b/test/correctness/tester.cc @@ -137,7 +137,7 @@ void Tester::TestStart(const std::string &test_name, const std::string &tes fprintf(stdout, "* Testing %s'%s'%s for %s'%s'%s:\n", kPrintMessage.c_str(), test_name.c_str(), kPrintEnd.c_str(), kPrintMessage.c_str(), test_configuration.c_str(), kPrintEnd.c_str()); - fprintf(stdout, " "); + if (!verbose_) { fprintf(stdout, " "); } // Empties the error log and the error/pass counters error_log_.clear(); @@ -250,6 +250,33 @@ const std::vector Tester::GetOffsets() const { else { return {0}; } } +// Retrieves the options as a string for a specific test +template +std::string Tester::GetOptionsString(const Arguments &args) { + auto result = std::string(""); + const auto equals = std::string("="); + for (auto &o: options_) { + if (o == kArgM) { result += kArgM + equals + ToString(args.m) + " "; } + if (o == kArgN) { result += kArgN + equals + ToString(args.n) + " "; } + if (o == kArgK) { result += kArgK + equals + ToString(args.k) + " "; } + if (o == kArgKU) { result += kArgKU + equals + ToString(args.ku) + " "; } + if (o == kArgKL) { result += kArgKL + equals + ToString(args.kl) + " "; } + if (o == kArgXInc) { result += kArgXInc + equals + ToString(args.x_inc) + " "; } + if (o == kArgYInc) { result += kArgYInc + equals + ToString(args.y_inc) + " "; } + if (o == kArgXOffset) { result += kArgXOffset + equals + ToString(args.x_offset) + " "; } + if (o == kArgYOffset) { result += kArgYOffset + equals + ToString(args.y_offset) + " "; } + if (o == kArgALeadDim) { result += kArgALeadDim + equals + ToString(args.a_ld) + " "; } + if (o == kArgBLeadDim) { result += kArgBLeadDim + equals + ToString(args.b_ld) + " "; } + if (o == kArgCLeadDim) { result += kArgCLeadDim + equals + ToString(args.c_ld) + " "; } + if (o == kArgAOffset) { result += kArgAOffset + equals + ToString(args.a_offset) + " "; } + if (o == kArgBOffset) { result += kArgBOffset + equals + ToString(args.b_offset) + " "; } + if (o == kArgCOffset) { result += kArgCOffset + equals + ToString(args.c_offset) + " "; } + if (o == kArgAPOffset) { result += kArgAPOffset + equals + ToString(args.ap_offset) + " "; } + if (o == kArgDotOffset){ result += kArgDotOffset + equals + ToString(args.dot_offset) + " "; } + } + return result; +} + // ================================================================================================= // A test can either pass, be skipped, or fail @@ -273,13 +300,19 @@ void Tester::ReportError(const ErrorLogEntry &error_log_entry) { // line by printing newlines once every so many calls. template void Tester::PrintTestResult(const std::string &message) { - if (print_count_ == kResultsPerLine) { - print_count_ = 0; - fprintf(stdout, "\n "); + if (verbose_) { + fprintf(stdout, "%s\n", message.c_str()); + } + else + { + if (print_count_ == kResultsPerLine) { + print_count_ = 0; + fprintf(stdout, "\n "); + } + fprintf(stdout, "%s", message.c_str()); + print_count_++; } - fprintf(stdout, "%s", message.c_str()); std::cout << std::flush; - print_count_++; } // Prints details of errors occurred in a given error log @@ -292,32 +325,7 @@ void Tester::PrintErrorLog(const std::vector &error_log) { else { fprintf(stdout, " Status code %d (expected %d): ", entry.status_found, entry.status_expect); } - for (auto &o: options_) { - if (o == kArgM) { fprintf(stdout, "%s=%zu ", kArgM, entry.args.m); } - if (o == kArgN) { fprintf(stdout, "%s=%zu ", kArgN, entry.args.n); } - if (o == kArgK) { fprintf(stdout, "%s=%zu ", kArgK, entry.args.k); } - if (o == kArgKU) { fprintf(stdout, "%s=%zu ", kArgKU, entry.args.ku); } - if (o == kArgKL) { fprintf(stdout, "%s=%zu ", kArgKL, entry.args.kl); } - if (o == kArgLayout) { fprintf(stdout, "%s=%d ", kArgLayout, entry.args.layout);} - if (o == kArgATransp) { fprintf(stdout, "%s=%d ", kArgATransp, entry.args.a_transpose);} - if (o == kArgBTransp) { fprintf(stdout, "%s=%d ", kArgBTransp, entry.args.b_transpose);} - if (o == kArgSide) { fprintf(stdout, "%s=%d ", kArgSide, entry.args.side);} - if (o == kArgTriangle) { fprintf(stdout, "%s=%d ", kArgTriangle, entry.args.triangle);} - if (o == kArgDiagonal) { fprintf(stdout, "%s=%d ", kArgDiagonal, entry.args.diagonal);} - if (o == kArgXInc) { fprintf(stdout, "%s=%zu ", kArgXInc, entry.args.x_inc);} - if (o == kArgYInc) { fprintf(stdout, "%s=%zu ", kArgYInc, entry.args.y_inc);} - if (o == kArgXOffset) { fprintf(stdout, "%s=%zu ", kArgXOffset, entry.args.x_offset);} - if (o == kArgYOffset) { fprintf(stdout, "%s=%zu ", kArgYOffset, entry.args.y_offset);} - if (o == kArgALeadDim) { fprintf(stdout, "%s=%zu ", kArgALeadDim, entry.args.a_ld);} - if (o == kArgBLeadDim) { fprintf(stdout, "%s=%zu ", kArgBLeadDim, entry.args.b_ld);} - if (o == kArgCLeadDim) { fprintf(stdout, "%s=%zu ", kArgCLeadDim, entry.args.c_ld);} - if (o == kArgAOffset) { fprintf(stdout, "%s=%zu ", kArgAOffset, entry.args.a_offset);} - if (o == kArgBOffset) { fprintf(stdout, "%s=%zu ", kArgBOffset, entry.args.b_offset);} - if (o == kArgCOffset) { fprintf(stdout, "%s=%zu ", kArgCOffset, entry.args.c_offset);} - if (o == kArgAPOffset) { fprintf(stdout, "%s=%zu ", kArgAPOffset, entry.args.ap_offset);} - if (o == kArgDotOffset){ fprintf(stdout, "%s=%zu ", kArgDotOffset, entry.args.dot_offset);} - } - fprintf(stdout, "\n"); + fprintf(stdout, "%s\n", GetOptionsString(entry.args).c_str()); } } diff --git a/test/correctness/tester.h b/test/correctness/tester.h index 46d88caf..7c41505d 100644 --- a/test/correctness/tester.h +++ b/test/correctness/tester.h @@ -103,6 +103,9 @@ class Tester { // Retrieves the offset values to test with const std::vector GetOffsets() const; + // Retrieves the list of options as a string + std::string GetOptionsString(const Arguments &args); + // Testing against reference implementations int compare_cblas_; int compare_clblas_; -- cgit v1.2.3