diff options
author | Cedric Nugteren <web@cedricnugteren.nl> | 2017-11-17 20:58:36 +0100 |
---|---|---|
committer | Cedric Nugteren <web@cedricnugteren.nl> | 2017-11-17 20:58:36 +0100 |
commit | 8a5a5e031e3552ef36d7b3a16ecf5cef6cdb4614 (patch) | |
tree | adfbde6be733ad4e96b836479f2dfc057745d4c0 /src/tuning/tuning.hpp | |
parent | f94d498a3773f838bcffb90fd56993a1583ad8ae (diff) |
Moved some tuning functions from .hpp to .cpp
Diffstat (limited to 'src/tuning/tuning.hpp')
-rw-r--r-- | src/tuning/tuning.hpp | 52 |
1 files changed, 2 insertions, 50 deletions
diff --git a/src/tuning/tuning.hpp b/src/tuning/tuning.hpp index c8a12b5b..41f394c1 100644 --- a/src/tuning/tuning.hpp +++ b/src/tuning/tuning.hpp @@ -109,57 +109,9 @@ struct TuningResult { std::string name; double score; Configuration config; }; void PrintTimingsToFileAsJSON(const std::string &filename, const Device& device, const Platform& platform, const std::vector<std::pair<std::string,std::string>> &metadata, - const std::vector<TuningResult>& tuning_results) { - auto num_results = tuning_results.size(); - printf("* Writing a total of %zu results to '%s'\n", num_results, filename.c_str()); - - auto file = fopen(filename.c_str(), "w"); - fprintf(file, "{\n"); - for (auto &datum: metadata) { - fprintf(file, " \"%s\": \"%s\",\n", datum.first.c_str(), datum.second.c_str()); - } - fprintf(file, " \"platform_version\": \"%s\",\n", platform.Version().c_str()); - fprintf(file, " \"clblast_device_name\": \"%s\",\n", GetDeviceName(device).c_str()); - fprintf(file, " \"clblast_device_vendor\": \"%s\",\n", platform.Vendor().c_str()); - fprintf(file, " \"clblast_device_type\": \"%s\",\n", device.Type().c_str()); - fprintf(file, " \"clblast_device_architecture\": \"%s\",\n", GetDeviceArchitecture(device).c_str()); - fprintf(file, " \"device_core_clock\": \"%zu\",\n", device.CoreClock()); - fprintf(file, " \"device_compute_units\": \"%zu\",\n", device.ComputeUnits()); - fprintf(file, " \"results\": [\n"); - - // Loops over all results - for (auto r = size_t{0}; r < num_results; ++r) { - auto result = tuning_results[r]; - fprintf(file, " {\n"); - fprintf(file, " \"kernel\": \"%s\",\n", result.name.c_str()); - fprintf(file, " \"time\": %.3lf,\n", result.score); - - // Loops over all the parameters for this result - fprintf(file, " \"parameters\": {"); - auto num_configs = result.config.size(); - auto p = size_t{0}; - for (const auto parameter : result.config) { - fprintf(file, "\"%s\": %zu", parameter.first.c_str(), parameter.second); - if (p < num_configs -1 ) { fprintf(file, ","); } - ++p; - } - fprintf(file, "}\n"); - - // The footer - fprintf(file, " }"); - if (r < num_results - 1) { fprintf(file, ","); } - fprintf(file, "\n"); - } - fprintf(file, " ]\n"); - fprintf(file, "}\n"); - fclose(file); -} + const std::vector<TuningResult>& tuning_results); -void print_separator(const size_t parameters_size) { - printf("x------x-------x"); - for (auto i = size_t{0}; i < parameters_size; ++i) { printf("-----"); } - printf("-x----------x------------x--------x-------------------x\n"); -} +void print_separator(const size_t parameters_size); // ================================================================================================= |