summaryrefslogtreecommitdiff
path: root/test/routines
diff options
context:
space:
mode:
authorCNugteren <web@cedricnugteren.nl>2015-06-29 20:38:34 +0200
committerCNugteren <web@cedricnugteren.nl>2015-06-29 20:38:34 +0200
commit2914a285d43cac7e3a9d4885684229fbf82babb0 (patch)
tree01c740740d81fe893e88f40d8385d5c6325fabc0 /test/routines
parente5c0edbfd7dcfe96af6cca6c25ca8b346871b014 (diff)
Re-organized the performance-client infrastructure to avoid code duplication
Diffstat (limited to 'test/routines')
-rw-r--r--test/routines/xaxpy.h25
-rw-r--r--test/routines/xgemm.h22
-rw-r--r--test/routines/xgemv.h26
-rw-r--r--test/routines/xsymm.h22
-rw-r--r--test/routines/xsyr2k.h24
-rw-r--r--test/routines/xsyrk.h21
6 files changed, 129 insertions, 11 deletions
diff --git a/test/routines/xaxpy.h b/test/routines/xaxpy.h
index b61dd3b5..6ce5d7e2 100644
--- a/test/routines/xaxpy.h
+++ b/test/routines/xaxpy.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -45,6 +45,17 @@ class TestXaxpy {
return args.n * args.y_inc + args.y_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.x_size = GetSizeX(args);
+ args.y_size = GetSizeY(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t DefaultLDB(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t DefaultLDC(const Arguments<T> &) { return 1; } // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -81,10 +92,18 @@ class TestXaxpy {
// Describes how to compute the indices of the result buffer
static size_t ResultID1(const Arguments<T> &args) { return args.n; }
- static size_t ResultID2(const Arguments<T> &args) { return 1; } // N/A for this routine
- static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t id2) {
+ static size_t ResultID2(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t) {
return id1*args.y_inc + args.y_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return 2 * args.n;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (3 * args.n) * sizeof(T);
+ }
};
// =================================================================================================
diff --git a/test/routines/xgemm.h b/test/routines/xgemm.h
index c93fa774..86a304d1 100644
--- a/test/routines/xgemm.h
+++ b/test/routines/xgemm.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -57,6 +57,18 @@ class TestXgemm {
return c_two * args.c_ld + args.c_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.a_size = GetSizeA(args);
+ args.b_size = GetSizeB(args);
+ args.c_size = GetSizeC(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &args) { return args.k; }
+ static size_t DefaultLDB(const Arguments<T> &args) { return args.n; }
+ static size_t DefaultLDC(const Arguments<T> &args) { return args.n; }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -105,6 +117,14 @@ class TestXgemm {
id1*args.c_ld + id2 + args.c_offset:
id2*args.c_ld + id1 + args.c_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return 2 * args.m * args.n * args.m;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (args.m*args.m + args.m*args.n + 2*args.m*args.n) * sizeof(T);
+ }
};
// =================================================================================================
diff --git a/test/routines/xgemv.h b/test/routines/xgemv.h
index ada3d6f4..73f7d76e 100644
--- a/test/routines/xgemv.h
+++ b/test/routines/xgemv.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -55,6 +55,18 @@ class TestXgemv {
return m_real * args.y_inc + args.y_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.a_size = GetSizeA(args);
+ args.x_size = GetSizeX(args);
+ args.y_size = GetSizeY(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &args) { return args.n; }
+ static size_t DefaultLDB(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t DefaultLDC(const Arguments<T> &) { return 1; } // N/A for this routine
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -99,10 +111,18 @@ class TestXgemv {
auto a_transposed = (args.a_transpose != Transpose::kNo);
return (a_transposed) ? args.n : args.m;
}
- static size_t ResultID2(const Arguments<T> &args) { return 1; } // N/A for this routine
- static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t id2) {
+ static size_t ResultID2(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t) {
return id1*args.y_inc + args.y_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return 2 * args.m * args.n;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (args.m*args.n + 2*args.m + args.n) * sizeof(T);
+ }
};
// =================================================================================================
diff --git a/test/routines/xsymm.h b/test/routines/xsymm.h
index 93b4d30c..10476349 100644
--- a/test/routines/xsymm.h
+++ b/test/routines/xsymm.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -57,6 +57,18 @@ class TestXsymm {
return c_two * args.c_ld + args.c_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.a_size = GetSizeA(args);
+ args.b_size = GetSizeB(args);
+ args.c_size = GetSizeC(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &args) { return args.m; }
+ static size_t DefaultLDB(const Arguments<T> &args) { return args.n; }
+ static size_t DefaultLDC(const Arguments<T> &args) { return args.n; }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -105,6 +117,14 @@ class TestXsymm {
id1*args.c_ld + id2 + args.c_offset:
id2*args.c_ld + id1 + args.c_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return 2 * args.m * args.n * args.m;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (args.m*args.m + args.m*args.n + 2*args.m*args.n) * sizeof(T);
+ }
};
// =================================================================================================
diff --git a/test/routines/xsyr2k.h b/test/routines/xsyr2k.h
index 4f2def74..f3b1b542 100644
--- a/test/routines/xsyr2k.h
+++ b/test/routines/xsyr2k.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -48,13 +48,25 @@ class TestXsyr2k {
static size_t GetSizeB(const Arguments<T> &args) {
auto b_rotated = (args.layout == Layout::kColMajor && args.b_transpose != Transpose::kNo) ||
(args.layout == Layout::kRowMajor && args.b_transpose == Transpose::kNo);
- auto b_two = (b_rotated) ? args.k : args.n;
+ auto b_two = (b_rotated) ? args.n : args.k;
return b_two * args.b_ld + args.b_offset;
}
static size_t GetSizeC(const Arguments<T> &args) {
return args.n * args.c_ld + args.c_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.a_size = GetSizeA(args);
+ args.b_size = GetSizeB(args);
+ args.c_size = GetSizeC(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &args) { return args.k; }
+ static size_t DefaultLDB(const Arguments<T> &args) { return args.k; }
+ static size_t DefaultLDC(const Arguments<T> &args) { return args.n; }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -101,6 +113,14 @@ class TestXsyr2k {
static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t id2) {
return id1*args.c_ld + id2 + args.c_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return 2 * args.n * args.n * args.k;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (args.n*args.k + args.n*args.n) * sizeof(T);
+ }
};
// =================================================================================================
diff --git a/test/routines/xsyrk.h b/test/routines/xsyrk.h
index 19a77749..2ec9fb65 100644
--- a/test/routines/xsyrk.h
+++ b/test/routines/xsyrk.h
@@ -1,6 +1,6 @@
// =================================================================================================
-// This file is part of the CLBlast project. The project is licensed under the MIT license. This
+// 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.
//
@@ -49,6 +49,17 @@ class TestXsyrk {
return args.n * args.c_ld + args.c_offset;
}
+ // Describes how to set the sizes of all the buffers
+ static void SetSizes(Arguments<T> &args) {
+ args.a_size = GetSizeA(args);
+ args.c_size = GetSizeC(args);
+ }
+
+ // Describes what the default values of the leading dimensions of the matrices are
+ static size_t DefaultLDA(const Arguments<T> &args) { return args.k; }
+ static size_t DefaultLDB(const Arguments<T> &) { return 1; } // N/A for this routine
+ static size_t DefaultLDC(const Arguments<T> &args) { return args.n; }
+
// Describes how to run the CLBlast routine
static StatusCode RunRoutine(const Arguments<T> &args, const Buffers &buffers,
CommandQueue &queue) {
@@ -93,6 +104,14 @@ class TestXsyrk {
static size_t GetResultIndex(const Arguments<T> &args, const size_t id1, const size_t id2) {
return id1*args.c_ld + id2 + args.c_offset;
}
+
+ // Describes how to compute performance metrics
+ static size_t GetFlops(const Arguments<T> &args) {
+ return args.n * args.n * args.k;
+ }
+ static size_t GetBytes(const Arguments<T> &args) {
+ return (args.n*args.k + args.n*args.n) * sizeof(T);
+ }
};
// =================================================================================================