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/performance/client.cc | 17 +++++++++++-- test/performance/client.h | 17 +++++++------ test/performance/routines/levelx/xomatcopy.cc | 36 +++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 9 deletions(-) create mode 100644 test/performance/routines/levelx/xomatcopy.cc (limited to 'test/performance') diff --git a/test/performance/client.cc b/test/performance/client.cc index 5a7226df..4c0c79a6 100644 --- a/test/performance/client.cc +++ b/test/performance/client.cc @@ -42,8 +42,10 @@ Client::Client(const Routine run_routine, // applicable, but are searched for anyway to be able to create one common argument parser. All // arguments have a default value in case they are not found. template -Arguments Client::ParseArguments(int argc, char *argv[], const GetMetric default_a_ld, - const GetMetric default_b_ld, const GetMetric default_c_ld) { +Arguments Client::ParseArguments(int argc, char *argv[], const size_t level, + const GetMetric default_a_ld, + const GetMetric default_b_ld, + const GetMetric default_c_ld) { auto args = Arguments{}; auto help = std::string{"\n* Options given/available:\n"}; @@ -116,6 +118,17 @@ Arguments Client::ParseArguments(int argc, char *argv[], const GetMetric // which is thus always displayed (unless silence is specified). if (!args.silent) { fprintf(stdout, "%s\n", help.c_str()); } + // Comparison against a non-BLAS routine is not supported + if (level == 4) { // level-4 == level-X + if (args.compare_clblas != 0 || args.compare_cblas != 0) { + if (!args.silent) { + fprintf(stdout, "* Disabling clBLAS and CPU BLAS comparisons for this non-BLAS routine\n\n"); + } + } + args.compare_clblas = 0; + args.compare_cblas = 0; + } + // Comparison against clBLAS or a CPU BLAS library is not supported in case of half-precision if (args.precision == Precision::kHalf) { if (args.compare_clblas != 0 || args.compare_cblas != 0) { diff --git a/test/performance/client.h b/test/performance/client.h index 8d0597d7..493a7aed 100644 --- a/test/performance/client.h +++ b/test/performance/client.h @@ -53,8 +53,10 @@ class Client { // Parses all command-line arguments, filling in the arguments structure. If no command-line // argument is given for a particular argument, it is filled in with a default value. - Arguments ParseArguments(int argc, char *argv[], const GetMetric default_a_ld, - const GetMetric default_b_ld, const GetMetric default_c_ld); + Arguments ParseArguments(int argc, char *argv[], const size_t level, + const GetMetric default_a_ld, + const GetMetric default_b_ld, + const GetMetric default_c_ld); // The main client function, setting-up arguments, matrices, OpenCL buffers, etc. After set-up, it // calls the client routines. @@ -97,14 +99,14 @@ void RunClient(int argc, char *argv[]) { // Sets the reference to test against #ifdef CLBLAST_REF_CLBLAS - const auto reference1 = C::RunReference1; // clBLAS when available + auto reference1 = C::RunReference1; // clBLAS when available #else - const auto reference1 = ReferenceNotAvailable; + auto reference1 = ReferenceNotAvailable; #endif #ifdef CLBLAST_REF_CBLAS - const auto reference2 = C::RunReference2; // CBLAS when available + auto reference2 = C::RunReference2; // CBLAS when available #else - const auto reference2 = ReferenceNotAvailable; + auto reference2 = ReferenceNotAvailable; #endif // Creates a new client @@ -112,7 +114,8 @@ void RunClient(int argc, char *argv[]) { C::GetFlops, C::GetBytes); // Simple command line argument parser with defaults - auto args = client.ParseArguments(argc, argv, C::DefaultLDA, C::DefaultLDB, C::DefaultLDC); + auto args = client.ParseArguments(argc, argv, C::BLASLevel(), + C::DefaultLDA, C::DefaultLDB, C::DefaultLDC); if (args.print_help) { return; } // Runs the client diff --git a/test/performance/routines/levelx/xomatcopy.cc b/test/performance/routines/levelx/xomatcopy.cc new file mode 100644 index 00000000..851f6ee1 --- /dev/null +++ b/test/performance/routines/levelx/xomatcopy.cc @@ -0,0 +1,36 @@ + +// ================================================================================================= +// 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 "performance/client.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[]) { + switch(clblast::GetPrecision(argc, argv, clblast::Precision::kSingle)) { + case clblast::Precision::kHalf: + clblast::RunClient, half, half>(argc, argv); break; + case clblast::Precision::kSingle: + clblast::RunClient, float, float>(argc, argv); break; + case clblast::Precision::kDouble: + clblast::RunClient, double, double>(argc, argv); break; + case clblast::Precision::kComplexSingle: + clblast::RunClient, float2, float2>(argc, argv); break; + case clblast::Precision::kComplexDouble: + clblast::RunClient, double2, double2>(argc, argv); break; + } + return 0; +} + +// ================================================================================================= -- cgit v1.2.3