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.

65 lines
1.9 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"]["iterations_completed"] = a.rep_completed;
  27. j["report"]["status"] = StatusCodeToString(a.status);
  28. }
  29. inline void from_json(const nlohmann::json& j, TaskData& a) {
  30. j["task"]["size"].get_to(a.size);
  31. j["task"]["batch_size"].get_to(a.batch_size);
  32. j["affinity"]["node"].get_to(a.numa_node);
  33. j["affinity"]["nnode_src"].get_to(a.nnode_src);
  34. j["affinity"]["nnode_dst"].get_to(a.nnode_dst);
  35. }
  36. inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, const std::vector<uint64_t>& times, std::ostream& os) {
  37. nlohmann::json json;
  38. json["count"] = args.size();
  39. json["timings"] = times;
  40. json["path"] = path;
  41. json["list"] = args;
  42. os << json;
  43. }
  44. inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, uint64_t& repetitions, std::istream& is) {
  45. nlohmann::json json;
  46. is >> json;
  47. const uint32_t count = json.at("count");
  48. args.resize(count);
  49. path = json.at("path");
  50. repetitions = json.at("repetitions");
  51. for (uint32_t i = 0; i < count; i++) {
  52. args[i] = json["list"][i].template get<TaskData>();
  53. }
  54. }