From b46de2243390d3f773b8a66da41d3d0bf61dbcee Mon Sep 17 00:00:00 2001 From: CNugteren Date: Wed, 19 Aug 2015 19:34:29 +0200 Subject: Moved precision tester to utilities --- include/internal/utilities.h | 6 ++++++ src/utilities.cc | 14 ++++++++++++++ test/correctness/tester.cc | 14 -------------- test/correctness/tester.h | 4 ---- 4 files changed, 20 insertions(+), 18 deletions(-) diff --git a/include/internal/utilities.h b/include/internal/utilities.h index 6dba24e1..d9fdb9ab 100644 --- a/include/internal/utilities.h +++ b/include/internal/utilities.h @@ -197,6 +197,12 @@ bool IsMultiple(const size_t a, const size_t b); // Convert the precision enum into bytes, e.g. a double takes up 8 bytes size_t GetBytes(const Precision precision); +// ================================================================================================= + +// Returns false is this precision is not supported by the device +template +bool PrecisionSupported(const Device &device); + // ================================================================================================= } // namespace clblast diff --git a/src/utilities.cc b/src/utilities.cc index 62abbb91..042b3116 100644 --- a/src/utilities.cc +++ b/src/utilities.cc @@ -270,5 +270,19 @@ size_t GetBytes(const Precision precision) { } } +// ================================================================================================= + +// Returns false is this precision is not supported by the device +template <> bool PrecisionSupported(const Device &) { return true; } +template <> bool PrecisionSupported(const Device &) { return true; } +template <> bool PrecisionSupported(const Device &device) { + auto extensions = device.Capabilities(); + return (extensions.find(kKhronosDoublePrecision) == std::string::npos) ? false : true; +} +template <> bool PrecisionSupported(const Device &device) { + auto extensions = device.Capabilities(); + return (extensions.find(kKhronosDoublePrecision) == std::string::npos) ? false : true; +} + // ================================================================================================= } // namespace clblast diff --git a/test/correctness/tester.cc b/test/correctness/tester.cc index 002cb1a6..a52142c4 100644 --- a/test/correctness/tester.cc +++ b/test/correctness/tester.cc @@ -335,20 +335,6 @@ template <> const std::vector GetExampleScalars(const bool full_test) { // ================================================================================================= -// Returns false is this precision is not supported by the device -template <> bool PrecisionSupported(const Device &) { return true; } -template <> bool PrecisionSupported(const Device &) { return true; } -template <> bool PrecisionSupported(const Device &device) { - auto extensions = device.Capabilities(); - return (extensions.find(kKhronosDoublePrecision) == std::string::npos) ? false : true; -} -template <> bool PrecisionSupported(const Device &device) { - auto extensions = device.Capabilities(); - return (extensions.find(kKhronosDoublePrecision) == std::string::npos) ? false : true; -} - -// ================================================================================================= - // Compiles the templated class template class Tester; template class Tester; diff --git a/test/correctness/tester.h b/test/correctness/tester.h index 06f4afbe..db714f3d 100644 --- a/test/correctness/tester.h +++ b/test/correctness/tester.h @@ -140,10 +140,6 @@ bool TestSimilarity(const T val1, const T val2); template const std::vector GetExampleScalars(const bool full_test); -// Returns false is this precision is not supported by the device -template -bool PrecisionSupported(const Device &device); - // ================================================================================================= } // namespace clblast -- cgit v1.2.3