|
@ -4,10 +4,34 @@ |
|
|
|
|
|
|
|
|
#include "json/single_include/nlohmann/json.hpp"
|
|
|
#include "json/single_include/nlohmann/json.hpp"
|
|
|
|
|
|
|
|
|
#include "execute-move.hpp"
|
|
|
|
|
|
#include "statuscode-tostring.hpp"
|
|
|
#include "statuscode-tostring.hpp"
|
|
|
|
|
|
|
|
|
inline void to_json(nlohmann::json& j, const ThreadArgs& a) { |
|
|
|
|
|
|
|
|
struct TaskData { |
|
|
|
|
|
// thread placement / engine selection
|
|
|
|
|
|
uint8_t numa_node; |
|
|
|
|
|
uint8_t core; |
|
|
|
|
|
// region size and source+destination for move
|
|
|
|
|
|
size_t size; |
|
|
|
|
|
uint8_t nnode_src; |
|
|
|
|
|
uint8_t nnode_dst; |
|
|
|
|
|
// repetition
|
|
|
|
|
|
uint32_t rep_count; |
|
|
|
|
|
bool batch_submit; |
|
|
|
|
|
uint32_t batch_size; |
|
|
|
|
|
uint32_t barrier_after_n_operations; |
|
|
|
|
|
// thread output
|
|
|
|
|
|
dml::status_code status; |
|
|
|
|
|
// average run duration in microseconds
|
|
|
|
|
|
double combined_duration; |
|
|
|
|
|
double submit_duration; |
|
|
|
|
|
double complete_duration; |
|
|
|
|
|
// completed iterations
|
|
|
|
|
|
uint32_t rep_completed; |
|
|
|
|
|
// set by execution
|
|
|
|
|
|
sem_t* sig; |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
inline void to_json(nlohmann::json& j, const TaskData& a) { |
|
|
j["task"]["size"] = a.size; |
|
|
j["task"]["size"] = a.size; |
|
|
j["task"]["iterations"]["desired"] = a.rep_count; |
|
|
j["task"]["iterations"]["desired"] = a.rep_count; |
|
|
j["task"]["iterations"]["actual"] = a.rep_completed; |
|
|
j["task"]["iterations"]["actual"] = a.rep_completed; |
|
@ -26,7 +50,7 @@ inline void to_json(nlohmann::json& j, const ThreadArgs& a) { |
|
|
j["report"]["status"] = StatusCodeToString(a.status); |
|
|
j["report"]["status"] = StatusCodeToString(a.status); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
inline void from_json(const nlohmann::json& j, ThreadArgs& a) { |
|
|
|
|
|
|
|
|
inline void from_json(const nlohmann::json& j, TaskData& a) { |
|
|
j["task"]["size"].get_to(a.size); |
|
|
j["task"]["size"].get_to(a.size); |
|
|
j["task"]["iterations"]["desired"].get_to(a.rep_count); |
|
|
j["task"]["iterations"]["desired"].get_to(a.rep_count); |
|
|
j["task"]["batching"]["enabled"].get_to(a.batch_submit); |
|
|
j["task"]["batching"]["enabled"].get_to(a.batch_submit); |
|
@ -38,7 +62,7 @@ inline void from_json(const nlohmann::json& j, ThreadArgs& a) { |
|
|
j["affinity"]["nnode_dst"].get_to(a.nnode_dst); |
|
|
j["affinity"]["nnode_dst"].get_to(a.nnode_dst); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
inline void WriteResultLog(const std::vector<ThreadArgs>& args, const std::string& path, std::ostream& os) { |
|
|
|
|
|
|
|
|
inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, std::ostream& os) { |
|
|
nlohmann::json json; |
|
|
nlohmann::json json; |
|
|
|
|
|
|
|
|
json["count"] = args.size(); |
|
|
json["count"] = args.size(); |
|
@ -48,7 +72,7 @@ inline void WriteResultLog(const std::vector<ThreadArgs>& args, const std::strin |
|
|
os << std::setw(4) << json; |
|
|
os << std::setw(4) << json; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
inline void ReadWorkDescription(std::vector<ThreadArgs>& args, std::string& path, std::istream& is) { |
|
|
|
|
|
|
|
|
inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, std::istream& is) { |
|
|
nlohmann::json json; |
|
|
nlohmann::json json; |
|
|
is >> json; |
|
|
is >> json; |
|
|
|
|
|
|
|
@ -57,6 +81,6 @@ inline void ReadWorkDescription(std::vector<ThreadArgs>& args, std::string& path |
|
|
path = json.at("path"); |
|
|
path = json.at("path"); |
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < count; i++) { |
|
|
for (uint32_t i = 0; i < count; i++) { |
|
|
args[i] = json["list"][i].template get<ThreadArgs>(); |
|
|
|
|
|
|
|
|
args[i] = json["list"][i].template get<TaskData>(); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |