Distinguish between a short smoke test and a full test

pull/5/head
CNugteren 2015-06-20 13:33:50 +02:00
parent dfbc336531
commit 3ea3ba2bee
7 changed files with 43 additions and 13 deletions

View File

@ -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;

View File

@ -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;
}
// =================================================================================================

View File

@ -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();

View File

@ -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();

View File

@ -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}; }
}
// =================================================================================================

View File

@ -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_;

View File

@ -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();