From 52ccaf5b25e14c9ce032315e5e96b1f27886d481 Mon Sep 17 00:00:00 2001 From: Cedric Nugteren Date: Thu, 16 Jun 2016 18:07:46 +0200 Subject: Added XOMATCOPY routines to perform out-of-place matrix scaling, copying, and/or transposing --- test/correctness/routines/levelx/xomatcopy.cc | 30 +++++++++++++++++++++++++++ test/correctness/testblas.cc | 4 ++-- test/correctness/testblas.h | 16 +++++++++++--- 3 files changed, 45 insertions(+), 5 deletions(-) create mode 100644 test/correctness/routines/levelx/xomatcopy.cc (limited to 'test/correctness') diff --git a/test/correctness/routines/levelx/xomatcopy.cc b/test/correctness/routines/levelx/xomatcopy.cc new file mode 100644 index 00000000..43021bc9 --- /dev/null +++ b/test/correctness/routines/levelx/xomatcopy.cc @@ -0,0 +1,30 @@ + +// ================================================================================================= +// This file is part of the CLBlast project. The project is licensed under Apache Version 2.0. 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 +// +// ================================================================================================= + +#include "correctness/testblas.h" +#include "routines/levelx/xomatcopy.h" + +// 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[]) { + auto errors = size_t{0}; + errors += clblast::RunTests, float, float>(argc, argv, false, "SOMATCOPY"); + errors += clblast::RunTests, double, double>(argc, argv, true, "DOMATCOPY"); + errors += clblast::RunTests, float2, float2>(argc, argv, true, "COMATCOPY"); + errors += clblast::RunTests, double2, double2>(argc, argv, true, "ZOMATCOPY"); + errors += clblast::RunTests, half, half>(argc, argv, true, "HOMATCOPY"); + if (errors > 0) { return 1; } else { return 0; } +} + +// ================================================================================================= diff --git a/test/correctness/testblas.cc b/test/correctness/testblas.cc index e5addc48..9f842d91 100644 --- a/test/correctness/testblas.cc +++ b/test/correctness/testblas.cc @@ -174,8 +174,8 @@ void TestBlas::TestRegular(std::vector> &test_vector, const st template void TestBlas::TestInvalid(std::vector> &test_vector, const std::string &name) { if (!PrecisionSupported(device_)) { return; } - if (!compare_clblas_) { return; } - if (std::is_same::value) { return; } + if (!compare_clblas_) { return; } // not supported for CPU BLAS routines + if (std::is_same::value) { return; } // not supported for half-precision TestStart("invalid buffer sizes", name); // Iterates over all the to-be-tested combinations of arguments diff --git a/test/correctness/testblas.h b/test/correctness/testblas.h index cce10751..e849466a 100644 --- a/test/correctness/testblas.h +++ b/test/correctness/testblas.h @@ -129,6 +129,13 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na const auto reference_routine2 = C::RunReference2; // CBLAS #endif + // Non-BLAS routines cannot be fully tested + if (!silent && C::BLASLevel() == 4) { + fprintf(stdout, "\n* NOTE: This non-BLAS routine is tested against a custom implementation,\n"); + fprintf(stdout, " not against clBLAS or a CPU BLAS library. Thus, the arguments '-clblas'\n"); + fprintf(stdout, " and '-cblas' have no effect.\n"); + } + // Creates a tester auto options = C::GetOptions(); TestBlas tester{argc, argv, silent, name, options, @@ -176,8 +183,9 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na auto ap_sizes = std::vector{args.ap_size}; // Sets the dimensions of the matrices or vectors depending on the BLAS level - auto dimensions = (C::BLASLevel() == 3) ? tester.kMatrixDims : - (C::BLASLevel() == 2) ? tester.kMatrixVectorDims : + auto dimensions = (C::BLASLevel() == 4) ? tester.kMatrixDims : // non-BLAS extra routines + (C::BLASLevel() == 3) ? tester.kMatrixDims : // level 3 + (C::BLASLevel() == 2) ? tester.kMatrixVectorDims : // level 2 tester.kVectorDims; // else: level 1 // For the options relevant to this routine, sets the vectors to proper values @@ -318,7 +326,9 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na // Runs the tests tester.TestRegular(regular_test_vector, case_name); #ifdef CLBLAST_REF_CLBLAS - tester.TestInvalid(invalid_test_vector, case_name); + if (C::BLASLevel() != 4) { + tester.TestInvalid(invalid_test_vector, case_name); + } #endif } } -- cgit v1.2.3