diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2016-06-16 18:07:46 +0200 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2016-06-16 18:07:46 +0200 |
commit | 52ccaf5b25e14c9ce032315e5e96b1f27886d481 (patch) | |
tree | 087288b7aebf2a06ffc4e7dcbcd4353f7a3be6a7 /test/correctness | |
parent | 39b7dbc5e37829abfbcfb77852b9138b31540b42 (diff) |
Added XOMATCOPY routines to perform out-of-place matrix scaling, copying, and/or transposing
Diffstat (limited to 'test/correctness')
-rw-r--r-- | test/correctness/routines/levelx/xomatcopy.cc | 30 | ||||
-rw-r--r-- | test/correctness/testblas.cc | 4 | ||||
-rw-r--r-- | test/correctness/testblas.h | 16 |
3 files changed, 45 insertions, 5 deletions
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 <www.cedricnugteren.nl> +// +// ================================================================================================= + +#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<clblast::TestXomatcopy<float>, float, float>(argc, argv, false, "SOMATCOPY"); + errors += clblast::RunTests<clblast::TestXomatcopy<double>, double, double>(argc, argv, true, "DOMATCOPY"); + errors += clblast::RunTests<clblast::TestXomatcopy<float2>, float2, float2>(argc, argv, true, "COMATCOPY"); + errors += clblast::RunTests<clblast::TestXomatcopy<double2>, double2, double2>(argc, argv, true, "ZOMATCOPY"); + errors += clblast::RunTests<clblast::TestXomatcopy<half>, 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<T,U>::TestRegular(std::vector<Arguments<U>> &test_vector, const st template <typename T, typename U> void TestBlas<T,U>::TestInvalid(std::vector<Arguments<U>> &test_vector, const std::string &name) { if (!PrecisionSupported<T>(device_)) { return; } - if (!compare_clblas_) { return; } - if (std::is_same<T, half>::value) { return; } + if (!compare_clblas_) { return; } // not supported for CPU BLAS routines + if (std::is_same<T, half>::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<T,U> 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<size_t>{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 } } |