// ================================================================================================= // This file is part of the CLBlast project. The project is licensed under the MIT license. This // 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 // // 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. // // ================================================================================================= #ifndef CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_ #define CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_ #include #include #include "correctness/tester.h" namespace clblast { // ================================================================================================= // See comment at top of file for a description of the class template class TestBlas: public Tester { public: // Uses several variables from the Tester class using Tester::context_; using Tester::queue_; // Uses several helper functions from the Tester class using Tester::TestStart; using Tester::TestEnd; using Tester::TestSimilarity; using Tester::TestErrorCount; using Tester::TestErrorCodes; using Tester::GetExampleScalars; using Tester::GetOffsets; using Tester::PrecisionSupported; // Test settings for the regular test. Append to these lists in case more tests are required. const std::vector kVectorDims = { 7, 93, 4096 }; const std::vector kIncrements = { 1, 2, 7 }; const std::vector kMatrixDims = { 7, 64 }; const std::vector kMatrixVectorDims = { 61, 512 }; const std::vector kOffsets = GetOffsets(); const std::vector kAlphaValues = GetExampleScalars(); const std::vector kBetaValues = GetExampleScalars(); // Test settings for the invalid tests const std::vector kInvalidIncrements = { 0, 1 }; const size_t kBufferSize = 64; const std::vector kMatSizes = {0, kBufferSize*kBufferSize-1, kBufferSize*kBufferSize}; const std::vector kVecSizes = {0, kBufferSize - 1, kBufferSize}; // The layout/transpose/triangle options to test with const std::vector kLayouts = {Layout::kRowMajor, Layout::kColMajor}; const std::vector kTriangles = {Triangle::kUpper, Triangle::kLower}; const std::vector kSides = {Side::kLeft, Side::kRight}; static const std::vector kTransposes; // Data-type dependent, see .cc-file // Shorthand for the routine-specific functions passed to the tester using Routine = std::function&, const Buffers&, CommandQueue&)>; using ResultGet = std::function(const Arguments&, Buffers&, CommandQueue&)>; using ResultIndex = std::function&, const size_t, const size_t)>; using ResultIterator = std::function&)>; // Constructor, initializes the base class tester and input data TestBlas(int argc, char *argv[], const bool silent, const std::string &name, const std::vector &options, const Routine run_routine, const Routine run_reference, const ResultGet get_result, const ResultIndex get_index, const ResultIterator get_id1, const ResultIterator get_id2); // The test functions, taking no inputs void TestRegular(std::vector> &test_vector, const std::string &name); void TestInvalid(std::vector> &test_vector, const std::string &name); private: // Source data to test with std::vector x_source_; std::vector y_source_; std::vector a_source_; std::vector b_source_; std::vector c_source_; // The routine-specific functions passed to the tester Routine run_routine_; Routine run_reference_; ResultGet get_result_; ResultIndex get_index_; ResultIterator get_id1_; ResultIterator get_id2_; }; // ================================================================================================= } // namespace clblast // CLBLAST_TEST_CORRECTNESS_TESTBLAS_H_ #endif