summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2016-11-27 11:00:29 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2016-11-27 11:00:29 +0100
commit39c49bf4f977427de42fdfe27e8a2ed41ae4923e (patch)
treec07f81151ec42d7fc7bf9a4944f1de2db78c588d
parent8cfcda52a8c7a9e3f570b0c7ee43b007968ab6ab (diff)
Made it possible to use the command-line environmental variables for each executable and without re-running CMake
-rw-r--r--CHANGELOG1
-rw-r--r--CMakeLists.txt23
-rw-r--r--README.md4
-rw-r--r--scripts/generator/generator/cpp.py3
-rw-r--r--src/tuning/kernels/copy_fast.cpp3
-rw-r--r--src/tuning/kernels/copy_pad.cpp3
-rw-r--r--src/tuning/kernels/transpose_fast.cpp3
-rw-r--r--src/tuning/kernels/transpose_pad.cpp3
-rw-r--r--src/tuning/kernels/xaxpy.cpp3
-rw-r--r--src/tuning/kernels/xdot.cpp3
-rw-r--r--src/tuning/kernels/xgemm.cpp3
-rw-r--r--src/tuning/kernels/xgemm_direct.cpp3
-rw-r--r--src/tuning/kernels/xgemv.cpp3
-rw-r--r--src/tuning/kernels/xger.cpp3
-rw-r--r--src/tuning/tuning.hpp21
-rw-r--r--src/utilities/utilities.cpp69
-rw-r--r--src/utilities/utilities.hpp9
-rw-r--r--test/correctness/testblas.cpp4
-rw-r--r--test/correctness/testblas.hpp5
-rw-r--r--test/correctness/tester.cpp18
-rw-r--r--test/correctness/tester.hpp2
-rw-r--r--test/performance/client.cpp81
-rw-r--r--test/performance/routines/level1/xamax.cpp3
-rw-r--r--test/performance/routines/level1/xasum.cpp3
-rw-r--r--test/performance/routines/level1/xaxpy.cpp3
-rw-r--r--test/performance/routines/level1/xcopy.cpp3
-rw-r--r--test/performance/routines/level1/xdot.cpp3
-rw-r--r--test/performance/routines/level1/xdotc.cpp3
-rw-r--r--test/performance/routines/level1/xdotu.cpp3
-rw-r--r--test/performance/routines/level1/xnrm2.cpp3
-rw-r--r--test/performance/routines/level1/xrot.cpp3
-rw-r--r--test/performance/routines/level1/xrotg.cpp3
-rw-r--r--test/performance/routines/level1/xrotm.cpp3
-rw-r--r--test/performance/routines/level1/xrotmg.cpp3
-rw-r--r--test/performance/routines/level1/xscal.cpp3
-rw-r--r--test/performance/routines/level1/xswap.cpp3
-rw-r--r--test/performance/routines/level2/xgbmv.cpp3
-rw-r--r--test/performance/routines/level2/xgemv.cpp3
-rw-r--r--test/performance/routines/level2/xger.cpp3
-rw-r--r--test/performance/routines/level2/xgerc.cpp3
-rw-r--r--test/performance/routines/level2/xgeru.cpp3
-rw-r--r--test/performance/routines/level2/xhbmv.cpp3
-rw-r--r--test/performance/routines/level2/xhemv.cpp3
-rw-r--r--test/performance/routines/level2/xher.cpp3
-rw-r--r--test/performance/routines/level2/xher2.cpp3
-rw-r--r--test/performance/routines/level2/xhpmv.cpp3
-rw-r--r--test/performance/routines/level2/xhpr.cpp3
-rw-r--r--test/performance/routines/level2/xhpr2.cpp3
-rw-r--r--test/performance/routines/level2/xsbmv.cpp3
-rw-r--r--test/performance/routines/level2/xspmv.cpp3
-rw-r--r--test/performance/routines/level2/xspr.cpp3
-rw-r--r--test/performance/routines/level2/xspr2.cpp3
-rw-r--r--test/performance/routines/level2/xsymv.cpp3
-rw-r--r--test/performance/routines/level2/xsyr.cpp3
-rw-r--r--test/performance/routines/level2/xsyr2.cpp3
-rw-r--r--test/performance/routines/level2/xtbmv.cpp3
-rw-r--r--test/performance/routines/level2/xtbsv.cpp3
-rw-r--r--test/performance/routines/level2/xtpmv.cpp3
-rw-r--r--test/performance/routines/level2/xtpsv.cpp3
-rw-r--r--test/performance/routines/level2/xtrmv.cpp3
-rw-r--r--test/performance/routines/level2/xtrsv.cpp3
-rw-r--r--test/performance/routines/level3/xgemm.cpp3
-rw-r--r--test/performance/routines/level3/xhemm.cpp3
-rw-r--r--test/performance/routines/level3/xher2k.cpp3
-rw-r--r--test/performance/routines/level3/xherk.cpp3
-rw-r--r--test/performance/routines/level3/xsymm.cpp3
-rw-r--r--test/performance/routines/level3/xsyr2k.cpp3
-rw-r--r--test/performance/routines/level3/xsyrk.cpp3
-rw-r--r--test/performance/routines/level3/xtrmm.cpp3
-rw-r--r--test/performance/routines/level3/xtrsm.cpp3
-rw-r--r--test/performance/routines/levelx/xomatcopy.cpp3
71 files changed, 246 insertions, 171 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 0e25d1f5..aeb5f5bc 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ Development version (next release)
- Added an option to set OpenCL compiler options through the env variable CLBLAST_BUILD_OPTIONS
- Added an option to run tuned kernels multiple times to average execution times
- Added an option to build a static version of the library
+- Made it possible to use the command-line environmental vars everywhere and without re-running CMake
- Various minor fixes and enhancements
- Added tuned parameters for various devices (see README)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 246d006c..e5feab03 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -237,23 +237,6 @@ endif()
# ==================================================================================================
-# Sets a default platform ($CLBLAST_PLATFORM) and device ($CLBLAST_DEVICE) to run tuners and tests
-set(DEVICEPLATFORM )
-if(DEFINED ENV{CLBLAST_DEVICE})
- set(DEVICEPLATFORM ${DEVICEPLATFORM} -device $ENV{CLBLAST_DEVICE})
-endif()
-if(DEFINED ENV{CLBLAST_PLATFORM})
- set(DEVICEPLATFORM ${DEVICEPLATFORM} -platform $ENV{CLBLAST_PLATFORM})
-endif()
-
-# Optionally also provides other options to the tests such as -full_test ($CLBLAST_TEST_ARGUMENTS)
-set(TEST_ARGUMENTS )
-if(DEFINED ENV{CLBLAST_TEST_ARGUMENTS})
- set(TEST_ARGUMENTS $ENV{CLBLAST_TEST_ARGUMENTS})
-endif()
-
-# ==================================================================================================
-
# This section contains all the code related to the examples
if(SAMPLES)
@@ -301,7 +284,7 @@ if(TUNERS)
set(ALLTUNERSDEPENDS )
foreach(KERNEL ${KERNELS})
foreach(PRECISION ${PRECISIONS})
- set(ALLTUNERS ${ALLTUNERS} COMMAND clblast_tuner_${KERNEL} -precision ${PRECISION} ${DEVICEPLATFORM})
+ set(ALLTUNERS ${ALLTUNERS} COMMAND clblast_tuner_${KERNEL} -precision ${PRECISION})
endforeach()
set(ALLTUNERSDEPENDS clblast_tuner_${KERNEL})
endforeach()
@@ -428,14 +411,14 @@ if(TESTS)
target_link_libraries(clblast_test_${ROUTINE} clblast ${REF_LIBRARIES} ${OPENCL_LIBRARIES})
install(TARGETS clblast_test_${ROUTINE} DESTINATION bin)
target_include_directories(clblast_test_${ROUTINE} PUBLIC ${clblast_SOURCE_DIR} ${REF_INCLUDES})
- add_test(clblast_test_${ROUTINE} clblast_test_${ROUTINE} ${DEVICEPLATFORM} ${TEST_ARGUMENTS})
+ add_test(clblast_test_${ROUTINE} clblast_test_${ROUTINE})
endforeach()
# Adds 'alltests' target: runs all tests
set(ALLTESTS )
set(ALLTESTSDEPENDS )
foreach(ROUTINE ${ROUTINES})
- set(ALLTESTS ${ALLTESTS} COMMAND clblast_test_${ROUTINE} ${DEVICEPLATFORM} ${TEST_ARGUMENTS})
+ set(ALLTESTS ${ALLTESTS} COMMAND clblast_test_${ROUTINE})
set(ALLTESTSDEPENDS clblast_test_${ROUTINE})
endforeach()
add_custom_target(alltests ${ALLTESTS} DEPENDS ${ALLTESTSDEPENDS})
diff --git a/README.md b/README.md
index 15b65c06..65b08f7a 100644
--- a/README.md
+++ b/README.md
@@ -149,7 +149,7 @@ If your device is not (yet) among this list or if you want to tune CLBlast for s
Note that CLBlast's tuners are based on the [CLTune auto-tuning library](https://github.com/CNugteren/CLTune), which has to be installed separately (requires version 2.5.0 or higher).
-Compiling with `-DTUNERS=ON` will generate a number of tuners, each named `clblast_tuner_xxxxx`, in which `xxxxx` corresponds to a `.opencl` kernel file as found in `src/kernels`. These kernels corresponds to routines (e.g. `xgemm`) or to common pre-processing or post-processing kernels (`copy` and `transpose`). Running such a tuner will test a number of parameter-value combinations on your device and report which one gave the best performance. Running `make alltuners` runs all tuners for all precisions in one go. You can set the default device and platform for `alltuners` by setting the `CLBLAST_DEVICE` and `CLBLAST_PLATFORM` environmental variables before running CMake.
+Compiling with `-DTUNERS=ON` will generate a number of tuners, each named `clblast_tuner_xxxxx`, in which `xxxxx` corresponds to a `.opencl` kernel file as found in `src/kernels`. These kernels corresponds to routines (e.g. `xgemm`) or to common pre-processing or post-processing kernels (`copy` and `transpose`). Running such a tuner will test a number of parameter-value combinations on your device and report which one gave the best performance. Running `make alltuners` runs all tuners for all precisions in one go. You can set the default device and platform for `alltuners` by setting the `CLBLAST_DEVICE` and `CLBLAST_PLATFORM` environmental variables.
The tuners output a JSON-file with the results. The best results need to be added to `src/database/kernels/xxxxx.hpp` in the appropriate section. However, this can be done automatically based on the JSON-data using a Python script in `scripts/database/database.py`. If you want the found parameters to be included in future releases of CLBlast, please attach the JSON files to the corresponding issue on GitHub or [email the main author](http://www.cedricnugteren.nl).
@@ -181,7 +181,7 @@ To build these tests, another BLAS library is needed to serve as a reference. Th
Afterwards, executables in the form of `clblast_test_xxxxx` are available, in which `xxxxx` is the name of a routine (e.g. `xgemm`). Note that CLBlast is tested for correctness against [clBLAS](http://github.com/clMathLibraries/clBLAS) and/or a regular CPU BLAS library. If both are installed on your system, setting the command-line option `-clblas 1` or `-cblas 1` will select the library to test against for the `clblast_test_xxxxx` executables. All tests have a `-verbose` option to enable additional diagnostic output. They also have a `-full_test` option to increase coverage further.
-All tests can be run directly together in one go through the `make alltests` target or using CTest (`make test` or `ctest`). In the latter case the output is less verbose. Both cases allow you to set the default device and platform to non-zero by setting the `CLBLAST_DEVICE` and `CLBLAST_PLATFORM` environmental variables before running CMake. Further options (e.g. `-full_test`) can be supplied through the `CLBLAST_TEST_ARGUMENTS` environmental variable.
+All tests can be run directly together in one go through the `make alltests` target or using CTest (`make test` or `ctest`). In the latter case the output is less verbose. Both cases allow you to set the default device and platform to non-zero by setting the `CLBLAST_DEVICE` and `CLBLAST_PLATFORM` environmental variables. Further options can be supplied through the `CLBLAST_ARGUMENTS` environmental variable (e.g. export CLBLAST_ARGUMENTS="-full_test -cblas 1 -clblas 0" on a UNIX system).
Compiling the performance tests/clients (optional)
diff --git a/scripts/generator/generator/cpp.py b/scripts/generator/generator/cpp.py
index 6bb3080f..c14d00a1 100644
--- a/scripts/generator/generator/cpp.py
+++ b/scripts/generator/generator/cpp.py
@@ -296,8 +296,9 @@ def performance_test(routine, level_string):
result += "using double2 = clblast::double2;" + NL + NL
result += "// Main function (not within the clblast namespace)" + NL
result += "int main(int argc, char *argv[]) {" + NL
+ result += " const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);" + NL
default = convert.precision_to_full_name(routine.flavours[0].precision_name)
- result += " switch(clblast::GetPrecision(argc, argv, clblast::Precision::k" + default + ")) {" + NL
+ result += " switch(clblast::GetPrecision(command_line_args, clblast::Precision::k" + default + ")) {" + NL
for precision in ["H", "S", "D", "C", "Z"]:
result += " case clblast::Precision::k" + convert.precision_to_full_name(precision) + ":"
found = False
diff --git a/src/tuning/kernels/copy_fast.cpp b/src/tuning/kernels/copy_fast.cpp
index 1651d299..7a434513 100644
--- a/src/tuning/kernels/copy_fast.cpp
+++ b/src/tuning/kernels/copy_fast.cpp
@@ -109,7 +109,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneCopy<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneCopy<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneCopy<double>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/copy_pad.cpp b/src/tuning/kernels/copy_pad.cpp
index 5be58369..94d9c303 100644
--- a/src/tuning/kernels/copy_pad.cpp
+++ b/src/tuning/kernels/copy_pad.cpp
@@ -117,7 +117,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TunePad<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TunePad<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TunePad<double>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/transpose_fast.cpp b/src/tuning/kernels/transpose_fast.cpp
index 01d9b46a..e16ab235 100644
--- a/src/tuning/kernels/transpose_fast.cpp
+++ b/src/tuning/kernels/transpose_fast.cpp
@@ -114,7 +114,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneTranspose<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneTranspose<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneTranspose<double>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/transpose_pad.cpp b/src/tuning/kernels/transpose_pad.cpp
index 4e830faa..c01298bf 100644
--- a/src/tuning/kernels/transpose_pad.cpp
+++ b/src/tuning/kernels/transpose_pad.cpp
@@ -121,7 +121,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TunePadTranspose<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TunePadTranspose<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TunePadTranspose<double>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xaxpy.cpp b/src/tuning/kernels/xaxpy.cpp
index 44538b4b..824ab29e 100644
--- a/src/tuning/kernels/xaxpy.cpp
+++ b/src/tuning/kernels/xaxpy.cpp
@@ -112,7 +112,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXaxpy<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXaxpy<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXaxpy<double>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xdot.cpp b/src/tuning/kernels/xdot.cpp
index 2ba7d91d..f871d42a 100644
--- a/src/tuning/kernels/xdot.cpp
+++ b/src/tuning/kernels/xdot.cpp
@@ -119,7 +119,8 @@ using double2 = clblast::double2;
// Function to tune a specific variation V (not within the clblast namespace)
template <int V>
void StartVariation(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXdot<half, V>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXdot<float, V>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXdot<double, V>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xgemm.cpp b/src/tuning/kernels/xgemm.cpp
index dc9040b0..f55eadd8 100644
--- a/src/tuning/kernels/xgemm.cpp
+++ b/src/tuning/kernels/xgemm.cpp
@@ -178,7 +178,8 @@ using double2 = clblast::double2;
// Function to tune a specific variation V (not within the clblast namespace)
template <int V>
void StartVariation(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXgemm<half,V>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXgemm<float,V>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXgemm<double,V>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xgemm_direct.cpp b/src/tuning/kernels/xgemm_direct.cpp
index b1d5fbc4..ee5bcb7e 100644
--- a/src/tuning/kernels/xgemm_direct.cpp
+++ b/src/tuning/kernels/xgemm_direct.cpp
@@ -177,7 +177,8 @@ using double2 = clblast::double2;
// Function to tune a specific variation V (not within the clblast namespace)
template <int V>
void StartVariation(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXgemmDirect<half,V>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXgemmDirect<float,V>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXgemmDirect<double,V>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xgemv.cpp b/src/tuning/kernels/xgemv.cpp
index 1ae641a7..97a45225 100644
--- a/src/tuning/kernels/xgemv.cpp
+++ b/src/tuning/kernels/xgemv.cpp
@@ -159,7 +159,8 @@ using double2 = clblast::double2;
// Function to tune a specific variation V (not within the clblast namespace)
template <int V>
void StartVariation(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXgemv<half,V>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXgemv<float,V>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXgemv<double,V>, double>(argc, argv); break;
diff --git a/src/tuning/kernels/xger.cpp b/src/tuning/kernels/xger.cpp
index 8a3ede98..5057492f 100644
--- a/src/tuning/kernels/xger.cpp
+++ b/src/tuning/kernels/xger.cpp
@@ -117,7 +117,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args)) {
case clblast::Precision::kHalf: clblast::Tuner<clblast::TuneXger<half>, half>(argc, argv); break;
case clblast::Precision::kSingle: clblast::Tuner<clblast::TuneXger<float>, float>(argc, argv); break;
case clblast::Precision::kDouble: clblast::Tuner<clblast::TuneXger<double>, double>(argc, argv); break;
diff --git a/src/tuning/tuning.hpp b/src/tuning/tuning.hpp
index c4ee0da0..1dd76894 100644
--- a/src/tuning/tuning.hpp
+++ b/src/tuning/tuning.hpp
@@ -33,20 +33,21 @@ void Tuner(int argc, char* argv[]) {
constexpr auto kSeed = 42; // fixed seed for reproducibility
// Sets the parameters and platform/device for which to tune (command-line options)
+ auto command_line_args = RetrieveCommandLineArguments(argc, argv);
auto help = std::string{"* Options given/available:\n"};
auto args = Arguments<T>{};
- args.platform_id = GetArgument(argc, argv, help, kArgPlatform, size_t{0});
- args.device_id = GetArgument(argc, argv, help, kArgDevice, size_t{0});
- args.precision = GetArgument(argc, argv, help, kArgPrecision, Precision::kSingle);
+ args.platform_id = GetArgument(command_line_args, help, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0}));
+ args.device_id = GetArgument(command_line_args, help, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0}));
+ args.precision = GetArgument(command_line_args, help, kArgPrecision, Precision::kSingle);
for (auto &o: C::GetOptions()) {
- if (o == kArgM) { args.m = GetArgument(argc, argv, help, kArgM, C::DefaultM()); }
- if (o == kArgN) { args.n = GetArgument(argc, argv, help, kArgN, C::DefaultN()); }
- if (o == kArgK) { args.k = GetArgument(argc, argv, help, kArgK, C::DefaultK()); }
- if (o == kArgAlpha) { args.alpha = GetArgument(argc, argv, help, kArgAlpha, GetScalar<T>()); }
- if (o == kArgBeta) { args.beta = GetArgument(argc, argv, help, kArgBeta, GetScalar<T>()); }
- if (o == kArgFraction) { args.fraction = GetArgument(argc, argv, help, kArgFraction, C::DefaultFraction()); }
+ if (o == kArgM) { args.m = GetArgument(command_line_args, help, kArgM, C::DefaultM()); }
+ if (o == kArgN) { args.n = GetArgument(command_line_args, help, kArgN, C::DefaultN()); }
+ if (o == kArgK) { args.k = GetArgument(command_line_args, help, kArgK, C::DefaultK()); }
+ if (o == kArgAlpha) { args.alpha = GetArgument(command_line_args, help, kArgAlpha, GetScalar<T>()); }
+ if (o == kArgBeta) { args.beta = GetArgument(command_line_args, help, kArgBeta, GetScalar<T>()); }
+ if (o == kArgFraction) { args.fraction = GetArgument(command_line_args, help, kArgFraction, C::DefaultFraction()); }
}
- const auto num_runs = GetArgument(argc, argv, help, kArgNumRuns, C::DefaultNumRuns());
+ const auto num_runs = GetArgument(command_line_args, help, kArgNumRuns, C::DefaultNumRuns());
fprintf(stdout, "%s\n", help.c_str());
diff --git a/src/utilities/utilities.cpp b/src/utilities/utilities.cpp
index 24456252..5e445bb9 100644
--- a/src/utilities/utilities.cpp
+++ b/src/utilities/utilities.cpp
@@ -158,6 +158,27 @@ std::string ToString(StatusCode value) {
// =================================================================================================
+// Retrieves the command-line arguments in a C++ fashion. Also adds command-line arguments from
+// pre-defined environmental variables
+std::vector<std::string> RetrieveCommandLineArguments(int argc, char *argv[]) {
+
+ // Regular command-line arguments
+ auto command_line_args = std::vector<std::string>();
+ for (auto i=0; i<argc; ++i) {
+ command_line_args.push_back(std::string{argv[i]});
+ }
+
+ // Extra CLBlast arguments
+ const auto extra_args = ConvertArgument(std::getenv("CLBLAST_ARGUMENTS"), std::string{""});
+ std::stringstream extra_args_stream;
+ extra_args_stream.str(extra_args);
+ std::string extra_arg;
+ while (std::getline(extra_args_stream, extra_arg, ' ')) {
+ command_line_args.push_back(extra_arg);
+ }
+ return command_line_args;
+}
+
// Helper for the below function to convert the argument to the value type. Adds specialization for
// complex data-types. Note that complex arguments are accepted as regular values and are copied to
// both the real and imaginary parts.
@@ -167,6 +188,9 @@ T ConvertArgument(const char* value) {
}
template size_t ConvertArgument(const char* value);
+template <> std::string ConvertArgument(const char* value) {
+ return std::string{value};
+}
template <> half ConvertArgument(const char* value) {
return FloatToHalf(static_cast<float>(std::stod(value)));
}
@@ -193,21 +217,22 @@ T ConvertArgument(const char* value, T default_value) {
return default_value;
}
template size_t ConvertArgument(const char* value, size_t default_value);
+template std::string ConvertArgument(const char* value, std::string default_value);
// This function matches patterns in the form of "-option value" or "--option value". It returns a
// default value in case the option is not found in the argument string.
template <typename T>
-T GetArgument(const int argc, char **argv, std::string &help,
+T GetArgument(const std::vector<std::string> &arguments, std::string &help,
const std::string &option, const T default_value) {
// 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 = static_cast<T>(default_value);
- for (int c=0; c<argc; ++c) {
- auto item = std::string{argv[c]};
+ for (auto c=size_t{0}; c<arguments.size(); ++c) {
+ auto item = arguments[c];
if (item.compare("-"+option) == 0 || item.compare("--"+option) == 0) {
++c;
- return_value = ConvertArgument<T>(argv[c]);
+ return_value = ConvertArgument<T>(arguments[c].c_str());
break;
}
}
@@ -219,39 +244,39 @@ T GetArgument(const int argc, char **argv, std::string &help,
}
// Compiles the above function
-template int GetArgument<int>(const int, char **, std::string&, const std::string&, const int);
-template size_t GetArgument<size_t>(const int, char **, std::string&, const std::string&, const size_t);
-template half GetArgument<half>(const int, char **, std::string&, const std::string&, const half);
-template float GetArgument<float>(const int, char **, std::string&, const std::string&, const float);
-template double GetArgument<double>(const int, char **, std::string&, const std::string&, const double);
-template float2 GetArgument<float2>(const int, char **, std::string&, const std::string&, const float2);
-template double2 GetArgument<double2>(const int, char **, std::string&, const std::string&, const double2);
-template Layout GetArgument<Layout>(const int, char **, std::string&, const std::string&, const Layout);
-template Transpose GetArgument<Transpose>(const int, char **, std::string&, const std::string&, const Transpose);
-template Side GetArgument<Side>(const int, char **, std::string&, const std::string&, const Side);
-template Triangle GetArgument<Triangle>(const int, char **, std::string&, const std::string&, const Triangle);
-template Diagonal GetArgument<Diagonal>(const int, char **, std::string&, const std::string&, const Diagonal);
-template Precision GetArgument<Precision>(const int, char **, std::string&, const std::string&, const Precision);
+template int GetArgument<int>(const std::vector<std::string>&, std::string&, const std::string&, const int);
+template size_t GetArgument<size_t>(const std::vector<std::string>&, std::string&, const std::string&, const size_t);
+template half GetArgument<half>(const std::vector<std::string>&, std::string&, const std::string&, const half);
+template float GetArgument<float>(const std::vector<std::string>&, std::string&, const std::string&, const float);
+template double GetArgument<double>(const std::vector<std::string>&, std::string&, const std::string&, const double);
+template float2 GetArgument<float2>(const std::vector<std::string>&, std::string&, const std::string&, const float2);
+template double2 GetArgument<double2>(const std::vector<std::string>&, std::string&, const std::string&, const double2);
+template Layout GetArgument<Layout>(const std::vector<std::string>&, std::string&, const std::string&, const Layout);
+template Transpose GetArgument<Transpose>(const std::vector<std::string>&, std::string&, const std::string&, const Transpose);
+template Side GetArgument<Side>(const std::vector<std::string>&, std::string&, const std::string&, const Side);
+template Triangle GetArgument<Triangle>(const std::vector<std::string>&, std::string&, const std::string&, const Triangle);
+template Diagonal GetArgument<Diagonal>(const std::vector<std::string>&, std::string&, const std::string&, const Diagonal);
+template Precision GetArgument<Precision>(const std::vector<std::string>&, std::string&, const std::string&, const Precision);
// =================================================================================================
// Returns only the precision argument
-Precision GetPrecision(const int argc, char *argv[], const Precision default_precision) {
+Precision GetPrecision(const std::vector<std::string> &arguments, const Precision default_precision) {
auto dummy = std::string{};
- return GetArgument(argc, argv, dummy, kArgPrecision, default_precision);
+ return GetArgument(arguments, dummy, kArgPrecision, default_precision);
}
// =================================================================================================
// Checks whether an argument is given. Returns true or false.
-bool CheckArgument(const int argc, char *argv[], std::string &help,
+bool CheckArgument(const std::vector<std::string> &arguments, std::string &help,
const std::string &option) {
// 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]};
+ for (auto c=size_t{0}; c<arguments.size(); ++c) {
+ auto item = arguments[c];
if (item.compare("-"+option) == 0 || item.compare("--"+option) == 0) {
++c;
return_value = true;
diff --git a/src/utilities/utilities.hpp b/src/utilities/utilities.hpp
index 9bc7401a..20587bd4 100644
--- a/src/utilities/utilities.hpp
+++ b/src/utilities/utilities.hpp
@@ -185,6 +185,9 @@ std::string ToString(T value);
// =================================================================================================
+// Parses command-line and environmental-variable arguments into a std::vector of strings
+std::vector<std::string> RetrieveCommandLineArguments(int argc, char *argv[]);
+
// Helper for the function "GetArgument"
template <typename T>
T ConvertArgument(const char* value);
@@ -195,15 +198,15 @@ T ConvertArgument(const char* value, T default_value);
// Basic argument parser, matching patterns in the form of "-option value" and "--option value"
template <typename T>
-T GetArgument(const int argc, char **argv, std::string &help,
+T GetArgument(const std::vector<std::string> &arguments, std::string &help,
const std::string &option, const T default_value);
// Returns the precision only
-Precision GetPrecision(const int argc, char *argv[],
+Precision GetPrecision(const std::vector<std::string> &arguments,
const Precision default_precision = Precision::kSingle);
// As in "GetArgument", but now only checks whether an argument is given or not
-bool CheckArgument(const int argc, char *argv[], std::string &help, const std::string &option);
+bool CheckArgument(const std::vector<std::string> &arguments, std::string &help, const std::string &option);
// =================================================================================================
diff --git a/test/correctness/testblas.cpp b/test/correctness/testblas.cpp
index ce3b0e07..5fddb37b 100644
--- a/test/correctness/testblas.cpp
+++ b/test/correctness/testblas.cpp
@@ -49,13 +49,13 @@ template <> const std::vector<Transpose> TestBlas<double2,double>::kTransposes =
// Constructor, initializes the base class tester and input data
template <typename T, typename U>
-TestBlas<T,U>::TestBlas(int argc, char *argv[], const bool silent,
+TestBlas<T,U>::TestBlas(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options,
const Routine run_routine,
const Routine run_reference1, const Routine run_reference2,
const ResultGet get_result, const ResultIndex get_index,
const ResultIterator get_id1, const ResultIterator get_id2):
- Tester<T,U>(argc, argv, silent, name, options),
+ Tester<T,U>(arguments, silent, name, options),
kOffsets(GetOffsets()),
kAlphaValues(GetExampleScalars<U>(full_test_)),
kBetaValues(GetExampleScalars<U>(full_test_)),
diff --git a/test/correctness/testblas.hpp b/test/correctness/testblas.hpp
index da572e01..27fd84c3 100644
--- a/test/correctness/testblas.hpp
+++ b/test/correctness/testblas.hpp
@@ -80,7 +80,7 @@ class TestBlas: public Tester<T,U> {
using ResultIterator = std::function<size_t(const Arguments<U>&)>;
// Constructor, initializes the base class tester and input data
- TestBlas(int argc, char *argv[], const bool silent,
+ TestBlas(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options,
const Routine run_routine,
const Routine run_reference1, const Routine run_reference2,
@@ -117,6 +117,7 @@ class TestBlas: public Tester<T,U> {
// is automatically compiled for each routine, templated by the parameter "C".
template <typename C, typename T, typename U>
size_t RunTests(int argc, char *argv[], const bool silent, const std::string &name) {
+ auto command_line_args = RetrieveCommandLineArguments(argc, argv);
// Sets the reference to test against
#if defined(CLBLAST_REF_CLBLAS) && defined(CLBLAST_REF_CBLAS)
@@ -139,7 +140,7 @@ size_t RunTests(int argc, char *argv[], const bool silent, const std::string &na
// Creates a tester
auto options = C::GetOptions();
- TestBlas<T,U> tester{argc, argv, silent, name, options,
+ TestBlas<T,U> tester{command_line_args, silent, name, options,
C::RunRoutine, reference_routine1, reference_routine2,
C::DownloadResult, C::GetResultIndex, C::ResultID1, C::ResultID2};
diff --git a/test/correctness/tester.cpp b/test/correctness/tester.cpp
index 481640fc..c449b09d 100644
--- a/test/correctness/tester.cpp
+++ b/test/correctness/tester.cpp
@@ -67,15 +67,15 @@ template <typename T, typename U> const std::string Tester<T,U>::kUnsupportedRef
// General constructor for all CLBlast testers. It prints out the test header to stdout and sets-up
// the clBLAS library for reference.
template <typename T, typename U>
-Tester<T,U>::Tester(int argc, char *argv[], const bool silent,
+Tester<T,U>::Tester(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options):
help_("Options given/available:\n"),
- platform_(Platform(GetArgument(argc, argv, help_, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0})))),
- device_(Device(platform_, GetArgument(argc, argv, help_, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0})))),
+ platform_(Platform(GetArgument(arguments, help_, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0})))),
+ device_(Device(platform_, GetArgument(arguments, help_, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0})))),
context_(Context(device_)),
queue_(Queue(context_, device_)),
- full_test_(CheckArgument(argc, argv, help_, kArgFullTest)),
- verbose_(CheckArgument(argc, argv, help_, kArgVerbose)),
+ full_test_(CheckArgument(arguments, help_, kArgFullTest)),
+ verbose_(CheckArgument(arguments, help_, kArgVerbose)),
error_log_{},
num_passed_{0},
num_skipped_{0},
@@ -88,14 +88,14 @@ Tester<T,U>::Tester(int argc, char *argv[], const bool silent,
// Determines which reference to test against
#if defined(CLBLAST_REF_CLBLAS) && defined(CLBLAST_REF_CBLAS)
- compare_clblas_ = GetArgument(argc, argv, help_, kArgCompareclblas, 0);
- compare_cblas_ = GetArgument(argc, argv, help_, kArgComparecblas, 1);
+ compare_clblas_ = GetArgument(arguments, help_, kArgCompareclblas, 0);
+ compare_cblas_ = GetArgument(arguments, help_, kArgComparecblas, 1);
#elif CLBLAST_REF_CLBLAS
- compare_clblas_ = GetArgument(argc, argv, help_, kArgCompareclblas, 1);
+ compare_clblas_ = GetArgument(arguments, help_, kArgCompareclblas, 1);
compare_cblas_ = 0;
#elif CLBLAST_REF_CBLAS
compare_clblas_ = 0;
- compare_cblas_ = GetArgument(argc, argv, help_, kArgComparecblas, 1);
+ compare_cblas_ = GetArgument(arguments, help_, kArgComparecblas, 1);
#else
compare_clblas_ = 0;
compare_cblas_ = 0;
diff --git a/test/correctness/tester.hpp b/test/correctness/tester.hpp
index c7fb4407..d8462cef 100644
--- a/test/correctness/tester.hpp
+++ b/test/correctness/tester.hpp
@@ -70,7 +70,7 @@ class Tester {
// Creates an instance of the tester, running on a particular OpenCL platform and device. It
// takes the routine's names as an additional parameter.
- explicit Tester(int argc, char *argv[], const bool silent,
+ explicit Tester(const std::vector<std::string> &arguments, const bool silent,
const std::string &name, const std::vector<std::string> &options);
~Tester();
diff --git a/test/performance/client.cpp b/test/performance/client.cpp
index cbb10d10..2c45b35e 100644
--- a/test/performance/client.cpp
+++ b/test/performance/client.cpp
@@ -46,6 +46,7 @@ Arguments<U> Client<T,U>::ParseArguments(int argc, char *argv[], const size_t le
const GetMetric default_a_ld,
const GetMetric default_b_ld,
const GetMetric default_c_ld) {
+ const auto command_line_args = RetrieveCommandLineArguments(argc, argv);
auto args = Arguments<U>{};
auto help = std::string{"\n* Options given/available:\n"};
@@ -53,67 +54,67 @@ Arguments<U> Client<T,U>::ParseArguments(int argc, char *argv[], const size_t le
for (auto &o: options_) {
// Data-sizes
- if (o == kArgM) { args.m = GetArgument(argc, argv, help, kArgM, size_t{512}); }
- if (o == kArgN) { args.n = GetArgument(argc, argv, help, kArgN, size_t{512}); }
- if (o == kArgK) { args.k = GetArgument(argc, argv, help, kArgK, size_t{512}); }
- if (o == kArgKU) { args.ku = GetArgument(argc, argv, help, kArgKU, size_t{128}); }
- if (o == kArgKL) { args.kl = GetArgument(argc, argv, help, kArgKL, size_t{128}); }
+ if (o == kArgM) { args.m = GetArgument(command_line_args, help, kArgM, size_t{512}); }
+ if (o == kArgN) { args.n = GetArgument(command_line_args, help, kArgN, size_t{512}); }
+ if (o == kArgK) { args.k = GetArgument(command_line_args, help, kArgK, size_t{512}); }
+ if (o == kArgKU) { args.ku = GetArgument(command_line_args, help, kArgKU, size_t{128}); }
+ if (o == kArgKL) { args.kl = GetArgument(command_line_args, help, kArgKL, size_t{128}); }
// Data-layouts
- if (o == kArgLayout) { args.layout = GetArgument(argc, argv, help, kArgLayout, Layout::kRowMajor); }
- if (o == kArgATransp) { args.a_transpose = GetArgument(argc, argv, help, kArgATransp, Transpose::kNo); }
- if (o == kArgBTransp) { args.b_transpose = GetArgument(argc, argv, help, kArgBTransp, Transpose::kNo); }
- if (o == kArgSide) { args.side = GetArgument(argc, argv, help, kArgSide, Side::kLeft); }
- if (o == kArgTriangle) { args.triangle = GetArgument(argc, argv, help, kArgTriangle, Triangle::kUpper); }
- if (o == kArgDiagonal) { args.diagonal = GetArgument(argc, argv, help, kArgDiagonal, Diagonal::kUnit); }
+ if (o == kArgLayout) { args.layout = GetArgument(command_line_args, help, kArgLayout, Layout::kRowMajor); }
+ if (o == kArgATransp) { args.a_transpose = GetArgument(command_line_args, help, kArgATransp, Transpose::kNo); }
+ if (o == kArgBTransp) { args.b_transpose = GetArgument(command_line_args, help, kArgBTransp, Transpose::kNo); }
+ if (o == kArgSide) { args.side = GetArgument(command_line_args, help, kArgSide, Side::kLeft); }
+ if (o == kArgTriangle) { args.triangle = GetArgument(command_line_args, help, kArgTriangle, Triangle::kUpper); }
+ if (o == kArgDiagonal) { args.diagonal = GetArgument(command_line_args, help, kArgDiagonal, Diagonal::kUnit); }
// Vector arguments
- if (o == kArgXInc) { args.x_inc = GetArgument(argc, argv, help, kArgXInc, size_t{1}); }
- if (o == kArgYInc) { args.y_inc = GetArgument(argc, argv, help, kArgYInc, size_t{1}); }
- if (o == kArgXOffset) { args.x_offset = GetArgument(argc, argv, help, kArgXOffset, size_t{0}); }
- if (o == kArgYOffset) { args.y_offset = GetArgument(argc, argv, help, kArgYOffset, size_t{0}); }
+ if (o == kArgXInc) { args.x_inc = GetArgument(command_line_args, help, kArgXInc, size_t{1}); }
+ if (o == kArgYInc) { args.y_inc = GetArgument(command_line_args, help, kArgYInc, size_t{1}); }
+ if (o == kArgXOffset) { args.x_offset = GetArgument(command_line_args, help, kArgXOffset, size_t{0}); }
+ if (o == kArgYOffset) { args.y_offset = GetArgument(command_line_args, help, kArgYOffset, size_t{0}); }
// Matrix arguments
- if (o == kArgALeadDim) { args.a_ld = GetArgument(argc, argv, help, kArgALeadDim, default_a_ld(args)); }
- if (o == kArgBLeadDim) { args.b_ld = GetArgument(argc, argv, help, kArgBLeadDim, default_b_ld(args)); }
- if (o == kArgCLeadDim) { args.c_ld = GetArgument(argc, argv, help, kArgCLeadDim, default_c_ld(args)); }
- if (o == kArgAOffset) { args.a_offset = GetArgument(argc, argv, help, kArgAOffset, size_t{0}); }
- if (o == kArgBOffset) { args.b_offset = GetArgument(argc, argv, help, kArgBOffset, size_t{0}); }
- if (o == kArgCOffset) { args.c_offset = GetArgument(argc, argv, help, kArgCOffset, size_t{0}); }
- if (o == kArgAPOffset) { args.ap_offset= GetArgument(argc, argv, help, kArgAPOffset, size_t{0}); }
+ if (o == kArgALeadDim) { args.a_ld = GetArgument(command_line_args, help, kArgALeadDim, default_a_ld(args)); }
+ if (o == kArgBLeadDim) { args.b_ld = GetArgument(command_line_args, help, kArgBLeadDim, default_b_ld(args)); }
+ if (o == kArgCLeadDim) { args.c_ld = GetArgument(command_line_args, help, kArgCLeadDim, default_c_ld(args)); }
+ if (o == kArgAOffset) { args.a_offset = GetArgument(command_line_args, help, kArgAOffset, size_t{0}); }
+ if (o == kArgBOffset) { args.b_offset = GetArgument(command_line_args, help, kArgBOffset, size_t{0}); }
+ if (o == kArgCOffset) { args.c_offset = GetArgument(command_line_args, help, kArgCOffset, size_t{0}); }
+ if (o == kArgAPOffset) { args.ap_offset= GetArgument(command_line_args, help, kArgAPOffset, size_t{0}); }
// Scalar result arguments
- if (o == kArgDotOffset) { args.dot_offset = GetArgument(argc, argv, help, kArgDotOffset, size_t{0}); }
- if (o == kArgNrm2Offset) { args.nrm2_offset = GetArgument(argc, argv, help, kArgNrm2Offset, size_t{0}); }
- if (o == kArgAsumOffset) { args.asum_offset = GetArgument(argc, argv, help, kArgAsumOffset, size_t{0}); }
- if (o == kArgImaxOffset) { args.imax_offset = GetArgument(argc, argv, help, kArgImaxOffset, size_t{0}); }
+ if (o == kArgDotOffset) { args.dot_offset = GetArgument(command_line_args, help, kArgDotOffset, size_t{0}); }
+ if (o == kArgNrm2Offset) { args.nrm2_offset = GetArgument(command_line_args, help, kArgNrm2Offset, size_t{0}); }
+ if (o == kArgAsumOffset) { args.asum_offset = GetArgument(command_line_args, help, kArgAsumOffset, size_t{0}); }
+ if (o == kArgImaxOffset) { args.imax_offset = GetArgument(command_line_args, help, kArgImaxOffset, size_t{0}); }
// Scalar values
- if (o == kArgAlpha) { args.alpha = GetArgument(argc, argv, help, kArgAlpha, GetScalar<U>()); }
- if (o == kArgBeta) { args.beta = GetArgument(argc, argv, help, kArgBeta, GetScalar<U>()); }
+ if (o == kArgAlpha) { args.alpha = GetArgument(command_line_args, help, kArgAlpha, GetScalar<U>()); }
+ if (o == kArgBeta) { args.beta = GetArgument(command_line_args, help, kArgBeta, GetScalar<U>()); }
}
// These are the options common to all routines
- args.platform_id = GetArgument(argc, argv, help, kArgPlatform, size_t{0});
- args.device_id = GetArgument(argc, argv, help, kArgDevice, size_t{0});
- args.precision = GetArgument(argc, argv, help, kArgPrecision, Precision::kSingle);
+ args.platform_id = GetArgument(command_line_args, help, kArgPlatform, ConvertArgument(std::getenv("CLBLAST_PLATFORM"), size_t{0}));
+ args.device_id = GetArgument(command_line_args, help, kArgDevice, ConvertArgument(std::getenv("CLBLAST_DEVICE"), size_t{0}));
+ args.precision = GetArgument(command_line_args, help, kArgPrecision, Precision::kSingle);
#ifdef CLBLAST_REF_CLBLAS
- args.compare_clblas = GetArgument(argc, argv, help, kArgCompareclblas, 1);
+ args.compare_clblas = GetArgument(command_line_args, help, kArgCompareclblas, 1);
#else
args.compare_clblas = 0;
#endif
#ifdef CLBLAST_REF_CBLAS
- args.compare_cblas = GetArgument(argc, argv, help, kArgComparecblas, 1);
+ args.compare_cblas = GetArgument(command_line_args, help, kArgComparecblas, 1);
#else
args.compare_cblas = 0;
#endif
- args.step = GetArgument(argc, argv, help, kArgStepSize, size_t{1});
- args.num_steps = GetArgument(argc, argv, help, kArgNumSteps, size_t{0});
- args.num_runs = GetArgument(argc, argv, help, kArgNumRuns, size_t{10});
- args.print_help = CheckArgument(argc, argv, help, kArgHelp);
- args.silent = CheckArgument(argc, argv, help, kArgQuiet);
- args.no_abbrv = CheckArgument(argc, argv, help, kArgNoAbbreviations);
- warm_up_ = CheckArgument(argc, argv, help, kArgWarmUp);
+ args.step = GetArgument(command_line_args, help, kArgStepSize, size_t{1});
+ args.num_steps = GetArgument(command_line_args, help, kArgNumSteps, size_t{0});
+ args.num_runs = GetArgument(command_line_args, help, kArgNumRuns, size_t{10});
+ args.print_help = CheckArgument(command_line_args, help, kArgHelp);
+ args.silent = CheckArgument(command_line_args, help, kArgQuiet);
+ args.no_abbrv = CheckArgument(command_line_args, help, kArgNoAbbreviations);
+ warm_up_ = CheckArgument(command_line_args, help, kArgWarmUp);
// Prints the chosen (or defaulted) arguments to screen. This also serves as the help message,
// which is thus always displayed (unless silence is specified).
diff --git a/test/performance/routines/level1/xamax.cpp b/test/performance/routines/level1/xamax.cpp
index 450678e0..5dc7b3d9 100644
--- a/test/performance/routines/level1/xamax.cpp
+++ b/test/performance/routines/level1/xamax.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXamax<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xasum.cpp b/test/performance/routines/level1/xasum.cpp
index c21102f5..bf5b2fa9 100644
--- a/test/performance/routines/level1/xasum.cpp
+++ b/test/performance/routines/level1/xasum.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXasum<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xaxpy.cpp b/test/performance/routines/level1/xaxpy.cpp
index e1c4935e..faccc089 100644
--- a/test/performance/routines/level1/xaxpy.cpp
+++ b/test/performance/routines/level1/xaxpy.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXaxpy<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xcopy.cpp b/test/performance/routines/level1/xcopy.cpp
index ea3531a0..8aa536af 100644
--- a/test/performance/routines/level1/xcopy.cpp
+++ b/test/performance/routines/level1/xcopy.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXcopy<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xdot.cpp b/test/performance/routines/level1/xdot.cpp
index 09fe9258..9a570e1e 100644
--- a/test/performance/routines/level1/xdot.cpp
+++ b/test/performance/routines/level1/xdot.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXdot<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xdotc.cpp b/test/performance/routines/level1/xdotc.cpp
index 6e716ebb..426b81ae 100644
--- a/test/performance/routines/level1/xdotc.cpp
+++ b/test/performance/routines/level1/xdotc.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level1/xdotu.cpp b/test/performance/routines/level1/xdotu.cpp
index d011d558..4fbe167d 100644
--- a/test/performance/routines/level1/xdotu.cpp
+++ b/test/performance/routines/level1/xdotu.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level1/xnrm2.cpp b/test/performance/routines/level1/xnrm2.cpp
index 1d6e177d..6a1cdcc7 100644
--- a/test/performance/routines/level1/xnrm2.cpp
+++ b/test/performance/routines/level1/xnrm2.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXnrm2<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xrot.cpp b/test/performance/routines/level1/xrot.cpp
index 4b543f1b..2b94ca39 100644
--- a/test/performance/routines/level1/xrot.cpp
+++ b/test/performance/routines/level1/xrot.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXrot<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level1/xrotg.cpp b/test/performance/routines/level1/xrotg.cpp
index e52704b0..ee6fc44b 100644
--- a/test/performance/routines/level1/xrotg.cpp
+++ b/test/performance/routines/level1/xrotg.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXrotg<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level1/xrotm.cpp b/test/performance/routines/level1/xrotm.cpp
index 83ee1d9d..e8d73311 100644
--- a/test/performance/routines/level1/xrotm.cpp
+++ b/test/performance/routines/level1/xrotm.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXrotm<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level1/xrotmg.cpp b/test/performance/routines/level1/xrotmg.cpp
index ee1539d9..a5266b14 100644
--- a/test/performance/routines/level1/xrotmg.cpp
+++ b/test/performance/routines/level1/xrotmg.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXrotmg<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level1/xscal.cpp b/test/performance/routines/level1/xscal.cpp
index adb83a90..6fefc5d0 100644
--- a/test/performance/routines/level1/xscal.cpp
+++ b/test/performance/routines/level1/xscal.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXscal<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level1/xswap.cpp b/test/performance/routines/level1/xswap.cpp
index 7f591d19..b728b8f4 100644
--- a/test/performance/routines/level1/xswap.cpp
+++ b/test/performance/routines/level1/xswap.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXswap<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xgbmv.cpp b/test/performance/routines/level2/xgbmv.cpp
index 6aa72ded..6a4b01f8 100644
--- a/test/performance/routines/level2/xgbmv.cpp
+++ b/test/performance/routines/level2/xgbmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXgbmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xgemv.cpp b/test/performance/routines/level2/xgemv.cpp
index fdcef95d..335d5ef1 100644
--- a/test/performance/routines/level2/xgemv.cpp
+++ b/test/performance/routines/level2/xgemv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXgemv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xger.cpp b/test/performance/routines/level2/xger.cpp
index c4f3699d..50fdb9e6 100644
--- a/test/performance/routines/level2/xger.cpp
+++ b/test/performance/routines/level2/xger.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXger<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xgerc.cpp b/test/performance/routines/level2/xgerc.cpp
index f855dc11..67c72285 100644
--- a/test/performance/routines/level2/xgerc.cpp
+++ b/test/performance/routines/level2/xgerc.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xgeru.cpp b/test/performance/routines/level2/xgeru.cpp
index 2bf885e3..6e845bb8 100644
--- a/test/performance/routines/level2/xgeru.cpp
+++ b/test/performance/routines/level2/xgeru.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xhbmv.cpp b/test/performance/routines/level2/xhbmv.cpp
index b7f3b9ad..600317c1 100644
--- a/test/performance/routines/level2/xhbmv.cpp
+++ b/test/performance/routines/level2/xhbmv.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xhemv.cpp b/test/performance/routines/level2/xhemv.cpp
index e1168083..7700cf7b 100644
--- a/test/performance/routines/level2/xhemv.cpp
+++ b/test/performance/routines/level2/xhemv.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xher.cpp b/test/performance/routines/level2/xher.cpp
index 0d1bc1dd..e7276aee 100644
--- a/test/performance/routines/level2/xher.cpp
+++ b/test/performance/routines/level2/xher.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xher2.cpp b/test/performance/routines/level2/xher2.cpp
index 3d98c838..b4c53206 100644
--- a/test/performance/routines/level2/xher2.cpp
+++ b/test/performance/routines/level2/xher2.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xhpmv.cpp b/test/performance/routines/level2/xhpmv.cpp
index c3bc3d9c..d9683d2e 100644
--- a/test/performance/routines/level2/xhpmv.cpp
+++ b/test/performance/routines/level2/xhpmv.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xhpr.cpp b/test/performance/routines/level2/xhpr.cpp
index afc65b25..c4ffaf81 100644
--- a/test/performance/routines/level2/xhpr.cpp
+++ b/test/performance/routines/level2/xhpr.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xhpr2.cpp b/test/performance/routines/level2/xhpr2.cpp
index c543dc90..3e5d4004 100644
--- a/test/performance/routines/level2/xhpr2.cpp
+++ b/test/performance/routines/level2/xhpr2.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level2/xsbmv.cpp b/test/performance/routines/level2/xsbmv.cpp
index 32899a74..9c0ab3b6 100644
--- a/test/performance/routines/level2/xsbmv.cpp
+++ b/test/performance/routines/level2/xsbmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsbmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xspmv.cpp b/test/performance/routines/level2/xspmv.cpp
index 0b0d2409..6cc4e3ba 100644
--- a/test/performance/routines/level2/xspmv.cpp
+++ b/test/performance/routines/level2/xspmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXspmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xspr.cpp b/test/performance/routines/level2/xspr.cpp
index 9c1c80a0..dc45ba6d 100644
--- a/test/performance/routines/level2/xspr.cpp
+++ b/test/performance/routines/level2/xspr.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXspr<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xspr2.cpp b/test/performance/routines/level2/xspr2.cpp
index 117e9c2f..3c9a769f 100644
--- a/test/performance/routines/level2/xspr2.cpp
+++ b/test/performance/routines/level2/xspr2.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXspr2<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xsymv.cpp b/test/performance/routines/level2/xsymv.cpp
index 60db1ae9..aaa98c8b 100644
--- a/test/performance/routines/level2/xsymv.cpp
+++ b/test/performance/routines/level2/xsymv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsymv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xsyr.cpp b/test/performance/routines/level2/xsyr.cpp
index d9ecd38a..d710bf63 100644
--- a/test/performance/routines/level2/xsyr.cpp
+++ b/test/performance/routines/level2/xsyr.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsyr<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xsyr2.cpp b/test/performance/routines/level2/xsyr2.cpp
index 24e0a517..39b46b6a 100644
--- a/test/performance/routines/level2/xsyr2.cpp
+++ b/test/performance/routines/level2/xsyr2.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsyr2<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xtbmv.cpp b/test/performance/routines/level2/xtbmv.cpp
index ed9d26a8..5fb3ea14 100644
--- a/test/performance/routines/level2/xtbmv.cpp
+++ b/test/performance/routines/level2/xtbmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXtbmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xtbsv.cpp b/test/performance/routines/level2/xtbsv.cpp
index f0b80330..7b88917c 100644
--- a/test/performance/routines/level2/xtbsv.cpp
+++ b/test/performance/routines/level2/xtbsv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXtbsv<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level2/xtpmv.cpp b/test/performance/routines/level2/xtpmv.cpp
index c5801205..907749a7 100644
--- a/test/performance/routines/level2/xtpmv.cpp
+++ b/test/performance/routines/level2/xtpmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXtpmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xtpsv.cpp b/test/performance/routines/level2/xtpsv.cpp
index db956c9d..0dab8ff6 100644
--- a/test/performance/routines/level2/xtpsv.cpp
+++ b/test/performance/routines/level2/xtpsv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXtpsv<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level2/xtrmv.cpp b/test/performance/routines/level2/xtrmv.cpp
index 629c773c..c2c6f232 100644
--- a/test/performance/routines/level2/xtrmv.cpp
+++ b/test/performance/routines/level2/xtrmv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXtrmv<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level2/xtrsv.cpp b/test/performance/routines/level2/xtrsv.cpp
index d6c2968c..49e477f7 100644
--- a/test/performance/routines/level2/xtrsv.cpp
+++ b/test/performance/routines/level2/xtrsv.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle:
clblast::RunClient<clblast::TestXtrsv<float>, float, float>(argc, argv); break;
diff --git a/test/performance/routines/level3/xgemm.cpp b/test/performance/routines/level3/xgemm.cpp
index 3f68096e..deb2493f 100644
--- a/test/performance/routines/level3/xgemm.cpp
+++ b/test/performance/routines/level3/xgemm.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXgemm<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level3/xhemm.cpp b/test/performance/routines/level3/xhemm.cpp
index ff6d0f71..975c672f 100644
--- a/test/performance/routines/level3/xhemm.cpp
+++ b/test/performance/routines/level3/xhemm.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level3/xher2k.cpp b/test/performance/routines/level3/xher2k.cpp
index 9636959e..d579d4f9 100644
--- a/test/performance/routines/level3/xher2k.cpp
+++ b/test/performance/routines/level3/xher2k.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level3/xherk.cpp b/test/performance/routines/level3/xherk.cpp
index d51400f0..94411e5a 100644
--- a/test/performance/routines/level3/xherk.cpp
+++ b/test/performance/routines/level3/xherk.cpp
@@ -18,7 +18,8 @@ using double2 = clblast::double2;
// Main function (not within the clblast namespace)
int main(int argc, char *argv[]) {
- switch(clblast::GetPrecision(argc, argv, clblast::Precision::kComplexSingle)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kComplexSingle)) {
case clblast::Precision::kHalf: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kSingle: throw std::runtime_error("Unsupported precision mode");
case clblast::Precision::kDouble: throw std::runtime_error("Unsupported precision mode");
diff --git a/test/performance/routines/level3/xsymm.cpp b/test/performance/routines/level3/xsymm.cpp
index 38c3dc9b..04ae8eb0 100644
--- a/test/performance/routines/level3/xsymm.cpp
+++ b/test/performance/routines/level3/xsymm.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsymm<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level3/xsyr2k.cpp b/test/performance/routines/level3/xsyr2k.cpp
index 5360e297..7b8b6f4f 100644
--- a/test/performance/routines/level3/xsyr2k.cpp
+++ b/test/performance/routines/level3/xsyr2k.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsyr2k<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level3/xsyrk.cpp b/test/performance/routines/level3/xsyrk.cpp
index 30612f99..ea0fc33b 100644
--- a/test/performance/routines/level3/xsyrk.cpp
+++ b/test/performance/routines/level3/xsyrk.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXsyrk<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level3/xtrmm.cpp b/test/performance/routines/level3/xtrmm.cpp
index 264a34e7..7a29e111 100644
--- a/test/performance/routines/level3/xtrmm.cpp
+++ b/test/performance/routines/level3/xtrmm.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXtrmm<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/level3/xtrsm.cpp b/test/performance/routines/level3/xtrsm.cpp
index 80c46d91..ef094891 100644
--- a/test/performance/routines/level3/xtrsm.cpp
+++ b/test/performance/routines/level3/xtrsm.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXtrsm<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle:
diff --git a/test/performance/routines/levelx/xomatcopy.cpp b/test/performance/routines/levelx/xomatcopy.cpp
index 0bd5773e..5821c3b8 100644
--- a/test/performance/routines/levelx/xomatcopy.cpp
+++ b/test/performance/routines/levelx/xomatcopy.cpp
@@ -18,7 +18,8 @@ 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)) {
+ const auto command_line_args = clblast::RetrieveCommandLineArguments(argc, argv);
+ switch(clblast::GetPrecision(command_line_args, clblast::Precision::kSingle)) {
case clblast::Precision::kHalf:
clblast::RunClient<clblast::TestXomatcopy<half>, half, half>(argc, argv); break;
case clblast::Precision::kSingle: