From 9b4d6cd7683b3b226e4925dd3d40aeb5a782903c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantin=20F=C3=BCrst?= Date: Sun, 26 Nov 2023 18:22:53 +0100 Subject: [PATCH] add all new parameters to the json-representation of ThreadArgs, update task-description.json to be current, add the StatusCodeToString()-fn to its own file --- benchmarks/logging-helper.hpp | 60 +++++++++++++----------------- benchmarks/statuscode-tostring.hpp | 26 +++++++++++++ benchmarks/task-description.json | 22 ++++++++--- 3 files changed, 69 insertions(+), 39 deletions(-) create mode 100644 benchmarks/statuscode-tostring.hpp diff --git a/benchmarks/logging-helper.hpp b/benchmarks/logging-helper.hpp index c98312d..0a73d87 100644 --- a/benchmarks/logging-helper.hpp +++ b/benchmarks/logging-helper.hpp @@ -5,45 +5,37 @@ #include "json/single_include/nlohmann/json.hpp" #include "execute-move.hpp" - -inline const std::string StatusCodeToString(const dml::status_code code) { - switch(code) { - case dml::status_code::ok: return "[ok]"; - case dml::status_code::false_predicate: return "[false predicate]"; - case dml::status_code::partial_completion: return "[partial completion]"; - case dml::status_code::nullptr_error: return "[nullptr error]"; - case dml::status_code::bad_size: return "[bad size]"; - case dml::status_code::bad_length: return "[bad length]"; - case dml::status_code::inconsistent_size: return "[inconsistent size]"; - case dml::status_code::dualcast_bad_padding: return "[dualcast bad padding]"; - case dml::status_code::bad_alignment: return "[bad alignment]"; - case dml::status_code::buffers_overlapping: return "[buffers overlapping]"; - case dml::status_code::delta_delta_empty: return "[delta delta empty]"; - case dml::status_code::batch_overflow: return "[batch overflow]"; - case dml::status_code::execution_failed: return "[execution failed]"; - case dml::status_code::unsupported_operation: return "[unsupported operation]"; - case dml::status_code::queue_busy: return "[queue busy]"; - case dml::status_code::error: return "[unknown error]"; - case dml::status_code::config_error: return "[config error]"; - default: return "[unhandled error]"; - } -} +#include "statuscode-tostring.hpp" inline void to_json(nlohmann::json& j, const ThreadArgs& a) { - j = nlohmann::json{ - {"node", a.numa_node}, {"core", a.core}, {"size", a.size}, - {"nnode_src", a.nnode_src}, {"nnode_dst", a.nnode_dst}, - {"time_us", a.duration.count()}, - {"status", StatusCodeToString(a.status)} - }; + j["task"]["size"] = a.size; + j["task"]["iterations"]["desired"] = a.rep_count; + j["task"]["iterations"]["actual"] = a.rep_completed; + j["task"]["batching"]["enabled"] = a.batch_submit; + j["task"]["batching"]["batch_size"] = a.batch_size; + j["task"]["batching"]["barrier_after_n_operations"] = a.barrier_after_n_operations; + j["affinity"]["cpu_core"] = a.core; + j["affinity"]["numa"] = a.numa_node; + j["affinity"]["nnode_src"] = a.nnode_src; + j["affinity"]["nnode_dst"] = a.nnode_dst; + j["time"]["unit"] = "microseconds"; + j["time"]["summation"] = "average"; + j["time"]["completion"] = a.complete_duration; + j["time"]["submission"] = a.submit_duration; + j["time"]["combined"] = a.combined_duration; + j["report"]["status"] = StatusCodeToString(a.status); } inline void from_json(const nlohmann::json& j, ThreadArgs& a) { - j.at("node").get_to(a.numa_node); - j.at("core").get_to(a.core); - j.at("size").get_to(a.size); - j.at("nnode_src").get_to(a.nnode_src); - j.at("nnode_dst").get_to(a.nnode_dst); + j["task"]["size"].get_to(a.size); + j["task"]["iterations"]["desired"].get_to(a.rep_count); + j["task"]["batching"]["enabled"].get_to(a.batch_submit); + j["task"]["batching"]["batch_size"].get_to(a.batch_size); + j["task"]["batching"]["barrier_after_n_operations"].get_to(a.barrier_after_n_operations); + j["affinity"]["numa"].get_to(a.numa_node); + j["affinity"]["core"].get_to(a.core); + j["affinity"]["nnode_src"].get_to(a.nnode_src); + j["affinity"]["nnode_dst"].get_to(a.nnode_dst); } inline void WriteResultLog(const std::vector& args, const std::string& path, std::ostream& os) { diff --git a/benchmarks/statuscode-tostring.hpp b/benchmarks/statuscode-tostring.hpp new file mode 100644 index 0000000..14a8b9f --- /dev/null +++ b/benchmarks/statuscode-tostring.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include + +inline const std::string StatusCodeToString(const dml::status_code code) { + switch(code) { + case dml::status_code::ok: return "[ok]"; + case dml::status_code::false_predicate: return "[false predicate]"; + case dml::status_code::partial_completion: return "[partial completion]"; + case dml::status_code::nullptr_error: return "[nullptr error]"; + case dml::status_code::bad_size: return "[bad size]"; + case dml::status_code::bad_length: return "[bad length]"; + case dml::status_code::inconsistent_size: return "[inconsistent size]"; + case dml::status_code::dualcast_bad_padding: return "[dualcast bad padding]"; + case dml::status_code::bad_alignment: return "[bad alignment]"; + case dml::status_code::buffers_overlapping: return "[buffers overlapping]"; + case dml::status_code::delta_delta_empty: return "[delta delta empty]"; + case dml::status_code::batch_overflow: return "[batch overflow]"; + case dml::status_code::execution_failed: return "[execution failed]"; + case dml::status_code::unsupported_operation: return "[unsupported operation]"; + case dml::status_code::queue_busy: return "[queue busy]"; + case dml::status_code::error: return "[unknown error]"; + case dml::status_code::config_error: return "[config error]"; + default: return "[unhandled error]"; + } +} \ No newline at end of file diff --git a/benchmarks/task-description.json b/benchmarks/task-description.json index ac6df86..0fd0ca5 100644 --- a/benchmarks/task-description.json +++ b/benchmarks/task-description.json @@ -3,11 +3,23 @@ "path" : "sw", "list": [ { - "core": 0, - "nnode_dst": 0, - "nnode_src": 0, - "node": 0, - "size": 4096 + "task": { + "size": 4096, + "iterations": { + "desired": 10000 + }, + "batching": { + "enabled": true, + "batch_size": 100, + "barrier_after_n_operations": 10 + } + }, + "affinity": { + "numa": 0, + "core": 0, + "nnode_src": 0, + "nnode_dst": 0 + } } ] } \ No newline at end of file