This contains my bachelors thesis and associated tex files, code snippets and maybe more. Topic: Data Movement in Heterogeneous Memories with Intel Data Streaming Accelerator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.8 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include "json/single_include/nlohmann/json.hpp"
  4. #include "dml-helper.hpp"
  5. struct TaskData {
  6. // thread placement / engine selection
  7. uint8_t numa_node;
  8. // region size and source+destination for move
  9. size_t size;
  10. uint8_t nnode_src;
  11. uint8_t nnode_dst;
  12. // repetition
  13. uint32_t rep_count;
  14. uint32_t batch_size;
  15. // thread output
  16. dml::status_code status;
  17. // completed iterations
  18. uint32_t rep_completed;
  19. };
  20. inline void to_json(nlohmann::json& j, const TaskData& a) {
  21. j["task"]["size"] = a.size;
  22. j["task"]["batch_size"] = a.batch_size;
  23. j["affinity"]["node"] = a.numa_node;
  24. j["affinity"]["nnode_src"] = a.nnode_src;
  25. j["affinity"]["nnode_dst"] = a.nnode_dst;
  26. j["report"]["status"] = StatusCodeToString(a.status);
  27. }
  28. inline void from_json(const nlohmann::json& j, TaskData& a) {
  29. j["task"]["size"].get_to(a.size);
  30. j["task"]["batch_size"].get_to(a.batch_size);
  31. j["affinity"]["node"].get_to(a.numa_node);
  32. j["affinity"]["nnode_src"].get_to(a.nnode_src);
  33. j["affinity"]["nnode_dst"].get_to(a.nnode_dst);
  34. }
  35. inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, const std::vector<uint64_t>& times, std::ostream& os) {
  36. nlohmann::json json;
  37. json["count"] = args.size();
  38. json["timings"] = times;
  39. json["path"] = path;
  40. json["list"] = args;
  41. os << json;
  42. }
  43. inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, uint64_t& repetitions, std::istream& is) {
  44. nlohmann::json json;
  45. is >> json;
  46. const uint32_t count = json.at("count");
  47. args.resize(count);
  48. path = json.at("path");
  49. repetitions = json.at("repetitions");
  50. for (uint32_t i = 0; i < count; i++) {
  51. args[i] = json["list"][i].template get<TaskData>();
  52. }
  53. }