mirror of
https://github.com/CNugteren/CLBlast.git
synced 2024-08-21 04:22:27 +02:00
Merge pull request #172 from CNugteren/msvc_improvements
Windows & MSVC improvements
This commit is contained in:
commit
c71362b13d
|
@ -15,6 +15,7 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "utilities/utilities.hpp"
|
#include "utilities/utilities.hpp"
|
||||||
#include "test/routines/level3/xgemm.hpp"
|
#include "test/routines/level3/xgemm.hpp"
|
||||||
|
@ -120,9 +121,9 @@ size_t RunOverrideTests(int argc, char *argv[], const bool silent, const std::st
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prints and returns the statistics
|
// Prints and returns the statistics
|
||||||
fprintf(stdout, " %zu test(s) passed\n", passed);
|
std::cout << " " << passed << " test(s) passed" << std::endl;
|
||||||
fprintf(stdout, " %zu test(s) failed\n", errors);
|
std::cout << " " << errors << " test(s) failed" << std::endl;
|
||||||
fprintf(stdout, "\n");
|
std::cout << std::endl;
|
||||||
return errors;
|
return errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,12 +198,12 @@ void TestBlas<T,U>::TestRegular(std::vector<Arguments<U>> &test_vector, const st
|
||||||
if (!TestSimilarity(result1[index], result2[index])) {
|
if (!TestSimilarity(result1[index], result2[index])) {
|
||||||
if (l2error >= kErrorMarginL2) { errors++; }
|
if (l2error >= kErrorMarginL2) { errors++; }
|
||||||
if (verbose_) {
|
if (verbose_) {
|
||||||
if (get_id2_(args) == 1) { fprintf(stdout, "\n Error at index %zu: ", id1); }
|
if (get_id2_(args) == 1) { std::cout << std::endl << " Error at index " << id1 << ": "; }
|
||||||
else { fprintf(stdout, "\n Error at %zu,%zu: ", id1, id2); }
|
else { std::cout << std::endl << " Error at " << id1 << "," << id2 << ": "; }
|
||||||
fprintf(stdout, " %s (reference) versus ", ToString(result1[index]).c_str());
|
std::cout << " " << ToString(result1[index]) << " (reference) versus ";
|
||||||
fprintf(stdout, " %s (CLBlast)", ToString(result2[index]).c_str());
|
std::cout << " " << ToString(result2[index]) << " (CLBlast)";
|
||||||
if (l2error < kErrorMarginL2) {
|
if (l2error < kErrorMarginL2) {
|
||||||
fprintf(stdout, " - error suppressed by a low total L2 error\n");
|
std::cout << " - error suppressed by a low total L2 error" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -185,14 +185,14 @@ Tester<T,U>::Tester(const std::vector<std::string> &arguments, const bool silent
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
Tester<T,U>::~Tester() {
|
Tester<T,U>::~Tester() {
|
||||||
if (PrecisionSupported<T>(device_)) {
|
if (PrecisionSupported<T>(device_)) {
|
||||||
fprintf(stdout, "* Completed all test-cases for this routine. Results:\n");
|
std::cout << "* Completed all test-cases for this routine. Results:" << std::endl;
|
||||||
fprintf(stdout, " %zu test(s) passed\n", tests_passed_);
|
std::cout << " " << tests_passed_ << " test(s) passed" << std::endl;
|
||||||
if (tests_skipped_ > 0) { fprintf(stdout, "%s", kPrintWarning.c_str()); }
|
if (tests_skipped_ > 0) { std::cout << kPrintWarning; }
|
||||||
fprintf(stdout, " %zu test(s) skipped%s\n", tests_skipped_, kPrintEnd.c_str());
|
std::cout << " " << tests_skipped_ << " test(s) skipped" << kPrintEnd << std::endl;
|
||||||
if (tests_failed_ > 0) { fprintf(stdout, "%s", kPrintError.c_str()); }
|
if (tests_failed_ > 0) { std::cout << kPrintError; }
|
||||||
fprintf(stdout, " %zu test(s) failed%s\n", tests_failed_, kPrintEnd.c_str());
|
std::cout << " " << tests_failed_ << " test(s) failed" << kPrintEnd << std::endl;
|
||||||
}
|
}
|
||||||
fprintf(stdout, "\n");
|
std::cout << std::endl;
|
||||||
|
|
||||||
// Cleans-up clBLAS
|
// Cleans-up clBLAS
|
||||||
#ifdef CLBLAST_REF_CLBLAS
|
#ifdef CLBLAST_REF_CLBLAS
|
||||||
|
@ -238,18 +238,18 @@ void Tester<T,U>::TestEnd() {
|
||||||
// Prints a test summary
|
// Prints a test summary
|
||||||
auto pass_rate = 100*num_passed_ / static_cast<float>(num_passed_ + num_skipped_ + num_failed_);
|
auto pass_rate = 100*num_passed_ / static_cast<float>(num_passed_ + num_skipped_ + num_failed_);
|
||||||
fprintf(stdout, " Pass rate %s%5.1lf%%%s:", kPrintMessage.c_str(), pass_rate, kPrintEnd.c_str());
|
fprintf(stdout, " Pass rate %s%5.1lf%%%s:", kPrintMessage.c_str(), pass_rate, kPrintEnd.c_str());
|
||||||
fprintf(stdout, " %zu passed /", num_passed_);
|
std::cout << " " << num_passed_ << " passed /";
|
||||||
if (num_skipped_ != 0) {
|
if (num_skipped_ != 0) {
|
||||||
fprintf(stdout, " %s%zu skipped%s /", kPrintWarning.c_str(), num_skipped_, kPrintEnd.c_str());
|
std::cout << " " << kPrintWarning << num_skipped_ << " skipped" << kPrintEnd << " /";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stdout, " %zu skipped /", num_skipped_);
|
std::cout << " " << num_skipped_ << " skipped /";
|
||||||
}
|
}
|
||||||
if (num_failed_ != 0) {
|
if (num_failed_ != 0) {
|
||||||
fprintf(stdout, " %s%zu failed%s\n", kPrintError.c_str(), num_failed_, kPrintEnd.c_str());
|
std::cout << " " << kPrintError << num_failed_ << " failed" << kPrintEnd << std::endl;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(stdout, " %zu failed\n", num_failed_);
|
std::cout << " " << num_failed_ << " failed" << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,20 +153,38 @@ template <typename T, typename U> const size_t Tester<T,U>::kResultsPerLine = si
|
||||||
template <typename T, typename U> const float Tester<T,U>::kStatusError = -1.0f;
|
template <typename T, typename U> const float Tester<T,U>::kStatusError = -1.0f;
|
||||||
|
|
||||||
// Constants holding start and end strings for terminal-output in colour
|
// Constants holding start and end strings for terminal-output in colour
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kPrintError = "\x1b[31m";
|
#if defined(_WIN32)
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kPrintSuccess = "\x1b[32m";
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintError = "";
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kPrintWarning = "\x1b[35m";
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintSuccess = "";
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kPrintMessage = "\x1b[1m";
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintWarning = "";
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kPrintEnd = "\x1b[0m";
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintMessage = "";
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintEnd = "";
|
||||||
|
#else
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintError = "\x1b[31m";
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintSuccess = "\x1b[32m";
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintWarning = "\x1b[35m";
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintMessage = "\x1b[1m";
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kPrintEnd = "\x1b[0m";
|
||||||
|
#endif
|
||||||
|
|
||||||
// Sets the output error coding
|
// Sets the output error coding
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kSuccessData = "\x1b[32m:\x1b[0m"; // success
|
#if defined(_WIN32)
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kSuccessStatus = "\x1b[32m.\x1b[0m"; // success
|
template <typename T, typename U> const std::string Tester<T,U>::kSuccessData = ":"; // success
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kErrorData = "\x1b[31mX\x1b[0m"; // error
|
template <typename T, typename U> const std::string Tester<T,U>::kSuccessStatus = "."; // success
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kErrorStatus = "\x1b[31m/\x1b[0m"; // error
|
template <typename T, typename U> const std::string Tester<T,U>::kErrorData = "X"; // error
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kSkippedCompilation = "\x1b[35m\\\x1b[0m"; // warning
|
template <typename T, typename U> const std::string Tester<T,U>::kErrorStatus = "/"; // error
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedPrecision = "\x1b[35mo\x1b[0m"; // warning
|
template <typename T, typename U> const std::string Tester<T,U>::kSkippedCompilation = "\\"; // warning
|
||||||
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedReference = "\x1b[35m-\x1b[0m"; // warning
|
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedPrecision = "o"; // warning
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedReference = "-"; // warning
|
||||||
|
#else
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kSuccessData = "\x1b[32m:\x1b[0m"; // success
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kSuccessStatus = "\x1b[32m.\x1b[0m"; // success
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kErrorData = "\x1b[31mX\x1b[0m"; // error
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kErrorStatus = "\x1b[31m/\x1b[0m"; // error
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kSkippedCompilation = "\x1b[35m\\\x1b[0m"; // warning
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedPrecision = "\x1b[35mo\x1b[0m"; // warning
|
||||||
|
template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedReference = "\x1b[35m-\x1b[0m"; // warning
|
||||||
|
#endif
|
||||||
|
|
||||||
// =================================================================================================
|
// =================================================================================================
|
||||||
// Below are the non-member functions (separated because of otherwise required partial class
|
// Below are the non-member functions (separated because of otherwise required partial class
|
||||||
|
|
Loading…
Reference in a new issue