summaryrefslogtreecommitdiff
path: root/test/performance
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-06-16 18:07:46 +0200
committerCedric Nugteren <web@cedricnugteren.nl>2016-06-16 18:07:46 +0200
commit52ccaf5b25e14c9ce032315e5e96b1f27886d481 (patch)
tree087288b7aebf2a06ffc4e7dcbcd4353f7a3be6a7 /test/performance
parent39b7dbc5e37829abfbcfb77852b9138b31540b42 (diff)
Added XOMATCOPY routines to perform out-of-place matrix scaling, copying, and/or transposing
Diffstat (limited to 'test/performance')
-rw-r--r--test/performance/client.cc17
-rw-r--r--test/performance/client.h17
-rw-r--r--test/performance/routines/levelx/xomatcopy.cc36
3 files changed, 61 insertions, 9 deletions
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<T,U>::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 <typename T, typename U>
-Arguments<U> Client<T,U>::ParseArguments(int argc, char *argv[], const GetMetric default_a_ld,
- const GetMetric default_b_ld, const GetMetric default_c_ld) {
+Arguments<U> Client<T,U>::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<U>{};
auto help = std::string{"\n* Options given/available:\n"};
@@ -116,6 +118,17 @@ Arguments<U> Client<T,U>::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<U> ParseArguments(int argc, char *argv[], const GetMetric default_a_ld,
- const GetMetric default_b_ld, const GetMetric default_c_ld);
+ Arguments<U> 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<T,U>;
+ auto reference1 = ReferenceNotAvailable<T,U>;
#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<T,U>;
+ auto reference2 = ReferenceNotAvailable<T,U>;
#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 <www.cedricnugteren.nl>
+//
+// =================================================================================================
+
+#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<clblast::TestXomatcopy<half>, half, half>(argc, argv); break;
+ case clblast::Precision::kSingle:
+ clblast::RunClient<clblast::TestXomatcopy<float>, float, float>(argc, argv); break;
+ case clblast::Precision::kDouble:
+ clblast::RunClient<clblast::TestXomatcopy<double>, double, double>(argc, argv); break;
+ case clblast::Precision::kComplexSingle:
+ clblast::RunClient<clblast::TestXomatcopy<float2>, float2, float2>(argc, argv); break;
+ case clblast::Precision::kComplexDouble:
+ clblast::RunClient<clblast::TestXomatcopy<double2>, double2, double2>(argc, argv); break;
+ }
+ return 0;
+}
+
+// =================================================================================================