summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCNugteren <web@cedricnugteren.nl>2015-06-20 13:33:50 +0200
committerCNugteren <web@cedricnugteren.nl>2015-06-20 13:33:50 +0200
commit3ea3ba2beeab837e8d7c533746bd621daf1c09bd (patch)
tree8bce01e529f1ddca6a8af45b89a51f0e7f0935e6
parentdfbc3365312a8ee1c100d7659e5814548192b48d (diff)
Distinguish between a short smoke test and a full test
-rw-r--r--include/internal/utilities.h5
-rw-r--r--src/utilities.cc15
-rw-r--r--test/correctness/testabc.h3
-rw-r--r--test/correctness/testaxy.h3
-rw-r--r--test/correctness/tester.cc20
-rw-r--r--test/correctness/tester.h7
-rw-r--r--test/correctness/testxy.h3
7 files changed, 43 insertions, 13 deletions
diff --git a/include/internal/utilities.h b/include/internal/utilities.h
index 600605c7..4cefdc4a 100644
--- a/include/internal/utilities.h
+++ b/include/internal/utilities.h
@@ -64,6 +64,9 @@ constexpr auto kArgStepSize = "step";
constexpr auto kArgNumSteps = "num_steps";
constexpr auto kArgNumRuns = "runs";
+// The client-specific arguments in string form
+constexpr auto kArgFullTest = "full_test";
+
// The common arguments in string form
constexpr auto kArgPlatform = "platform";
constexpr auto kArgDevice = "device";
@@ -105,6 +108,8 @@ struct Arguments {
size_t step = 1;
size_t num_steps = 0;
size_t num_runs = 10;
+ // Tester-specific arguments
+ bool full_test = false;
// Common arguments
size_t platform_id = 0;
size_t device_id = 0;
diff --git a/src/utilities.cc b/src/utilities.cc
index 3fc33502..98570088 100644
--- a/src/utilities.cc
+++ b/src/utilities.cc
@@ -159,16 +159,21 @@ Precision GetPrecision(const int argc, char *argv[]) {
bool CheckArgument(const int argc, char *argv[], std::string &help,
const std::string &option) {
- // Updates the help message
- help += " -"+option+"\n";
-
// Parses the argument. Note that this supports both the given option (e.g. -device) and one with
// an extra dash in front (e.g. --device).
+ auto return_value = false;
for (int c=0; c<argc; ++c) {
auto item = std::string{argv[c]};
- if (item.compare("-"+option) == 0 || item.compare("--"+option) == 0) { ++c; return true; }
+ if (item.compare("-"+option) == 0 || item.compare("--"+option) == 0) {
+ ++c;
+ return_value = true;
+ }
}
- return false;
+
+ // Updates the help message and returns
+ help += " -"+option+" ";
+ help += (return_value) ? "[true]\n" : "[false]\n";
+ return return_value;
}
// =================================================================================================
diff --git a/test/correctness/testabc.h b/test/correctness/testabc.h
index 6472af42..b7601024 100644
--- a/test/correctness/testabc.h
+++ b/test/correctness/testabc.h
@@ -41,10 +41,11 @@ class TestABC: public Tester<T> {
using Tester<T>::TestErrorCount;
using Tester<T>::TestErrorCodes;
using Tester<T>::GetExampleScalars;
+ using Tester<T>::GetOffsets;
// Test settings for the regular test. Append to this list in case more tests are required.
const std::vector<size_t> kMatrixDims = { 7, 64 };
- const std::vector<size_t> kOffsets = { 0 };
+ const std::vector<size_t> kOffsets = GetOffsets();
const std::vector<T> kAlphaValues = GetExampleScalars();
const std::vector<T> kBetaValues = GetExampleScalars();
diff --git a/test/correctness/testaxy.h b/test/correctness/testaxy.h
index 9135e2ba..00d4f6ec 100644
--- a/test/correctness/testaxy.h
+++ b/test/correctness/testaxy.h
@@ -41,10 +41,11 @@ class TestAXY: public Tester<T> {
using Tester<T>::TestErrorCount;
using Tester<T>::TestErrorCodes;
using Tester<T>::GetExampleScalars;
+ using Tester<T>::GetOffsets;
// Test settings for the regular test. Append to this list in case more tests are required.
const std::vector<size_t> kMatrixVectorDims = { 61, 512 };
- const std::vector<size_t> kOffsets = { 0, 10 };
+ const std::vector<size_t> kOffsets = GetOffsets();
const std::vector<size_t> kIncrements = { 1, 2 };
const std::vector<T> kAlphaValues = GetExampleScalars();
const std::vector<T> kBetaValues = GetExampleScalars();
diff --git a/test/correctness/tester.cc b/test/correctness/tester.cc
index e6285f32..09b0b5bd 100644
--- a/test/correctness/tester.cc
+++ b/test/correctness/tester.cc
@@ -41,6 +41,7 @@ Tester<T>::Tester(int argc, char *argv[], const bool silent,
device_(Device(platform_, kDeviceType, GetArgument(argc, argv, help_, kArgDevice, size_t{0}))),
context_(Context(device_)),
queue_(CommandQueue(context_, device_)),
+ full_test_(CheckArgument(argc, argv, help_, kArgFullTest)),
error_log_{},
num_passed_{0},
num_skipped_{0},
@@ -261,19 +262,30 @@ void Tester<T>::TestErrorCodes(const StatusCode clblas_status, const StatusCode
// routines. This function is specialised for the different data-types.
template <>
const std::vector<float> Tester<float>::GetExampleScalars() {
- return {0.0f, 1.0f, 3.14f};
+ if (full_test_) { return {0.0f, 1.0f, 3.14f}; }
+ else { return {3.14f}; }
}
template <>
const std::vector<double> Tester<double>::GetExampleScalars() {
- return {0.0, 1.0, 3.14};
+ if (full_test_) { return {0.0, 1.0, 3.14}; }
+ else { return {3.14}; }
}
template <>
const std::vector<float2> Tester<float2>::GetExampleScalars() {
- return {{0.0f, 0.0f}, {1.0f, 1.3f}, {2.42f, 3.14f}};
+ if (full_test_) { return {{0.0f, 0.0f}, {1.0f, 1.3f}, {2.42f, 3.14f}}; }
+ else { return {{2.42f, 3.14f}}; }
}
template <>
const std::vector<double2> Tester<double2>::GetExampleScalars() {
- return {{0.0, 0.0}, {1.0, 1.3}, {2.42, 3.14}};
+ if (full_test_) { return {{0.0, 0.0}, {1.0, 1.3}, {2.42, 3.14}}; }
+ else { return {{2.42, 3.14}}; }
+}
+
+// Retrieves the offset values to test with
+template <typename T>
+const std::vector<size_t> Tester<T>::GetOffsets() {
+ if (full_test_) { return {0, 10}; }
+ else { return {0}; }
}
// =================================================================================================
diff --git a/test/correctness/tester.h b/test/correctness/tester.h
index ffc02bbf..1085c472 100644
--- a/test/correctness/tester.h
+++ b/test/correctness/tester.h
@@ -97,6 +97,9 @@ class Tester {
// Retrieves a list of example scalars of the right type
const std::vector<T> GetExampleScalars();
+ // Retrieves a list of offset values to test
+ const std::vector<size_t> GetOffsets();
+
// The help-message
std::string help_;
@@ -108,7 +111,6 @@ class Tester {
private:
-
// Internal methods to report a passed, skipped, or failed test
void ReportPass();
void ReportSkipped();
@@ -117,6 +119,9 @@ class Tester {
// Prints the error or success symbol to screen
void PrintTestResult(const std::string &message);
+ // Whether or not to run the full test-suite or just a smoke test
+ bool full_test_;
+
// Logging and counting occurrences of errors
std::vector<ErrorLogEntry> error_log_;
size_t num_passed_;
diff --git a/test/correctness/testxy.h b/test/correctness/testxy.h
index c806de14..8f2b6876 100644
--- a/test/correctness/testxy.h
+++ b/test/correctness/testxy.h
@@ -39,10 +39,11 @@ class TestXY: public Tester<T> {
using Tester<T>::TestErrorCount;
using Tester<T>::TestErrorCodes;
using Tester<T>::GetExampleScalars;
+ using Tester<T>::GetOffsets;
// Test settings for the regular test. Append to this list in case more tests are required.
const std::vector<size_t> kVectorDims = { 7, 93, 4096 };
- const std::vector<size_t> kOffsets = { 0, 10 };
+ const std::vector<size_t> kOffsets = GetOffsets();
const std::vector<size_t> kIncrements = { 1, 2 };
const std::vector<T> kAlphaValues = GetExampleScalars();