summaryrefslogtreecommitdiff
path: root/test/test_utilities.hpp
diff options
context:
space:
mode:
authorCedric Nugteren <web@cedricnugteren.nl>2017-11-21 22:05:08 +0100
committerCedric Nugteren <web@cedricnugteren.nl>2017-11-21 22:05:08 +0100
commit8c9ecd97366980200a58a4b8cd77bd7f8b859abc (patch)
tree6f94e48ac0736aed2c9d594b5e4e10199fa97e52 /test/test_utilities.hpp
parent606990af6f7297528dcc44f67ce777e1ba56d2d0 (diff)
Implemented first version of reading JSON files from disk in the client to override parameters
Diffstat (limited to 'test/test_utilities.hpp')
-rw-r--r--test/test_utilities.hpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/test_utilities.hpp b/test/test_utilities.hpp
index d03c55fc..c91e9d1b 100644
--- a/test/test_utilities.hpp
+++ b/test/test_utilities.hpp
@@ -15,7 +15,10 @@
#ifndef CLBLAST_TEST_UTILITIES_H_
#define CLBLAST_TEST_UTILITIES_H_
+#include <cstdlib>
#include <string>
+#include <fstream>
+#include <sstream>
#include "utilities/utilities.hpp"
@@ -110,6 +113,29 @@ Buffer<T> CreateInvalidBuffer(const Context& context, const size_t size) {
}
// =================================================================================================
+
+template<typename Out>
+void split(const std::string &s, char delimiter, Out result) {
+ std::stringstream ss(s);
+ std::string item;
+ while (std::getline(ss, item, delimiter)) {
+ *(result++) = item;
+ }
+}
+
+inline std::vector<std::string> split(const std::string &s, char delimiter) {
+ std::vector<std::string> elements;
+ split(s, delimiter, std::back_inserter(elements));
+ return elements;
+}
+
+// =================================================================================================
+
+void OverrideParametersFromJSONFiles(const cl_device_id device, const Precision precision);
+void OverrideParametersFromJSONFile(const std::string& file_name,
+ const cl_device_id device, const Precision precision);
+
+// =================================================================================================
} // namespace clblast
// CLBLAST_TEST_UTILITIES_H_