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.

61 lines
1.7 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. };
  16. inline void to_json(nlohmann::json& j, const TaskData& a) {
  17. j["task"]["size"] = a.size;
  18. j["task"]["batch_size"] = a.batch_size;
  19. j["task"]["reps"] = a.rep_count;
  20. j["affinity"]["node"] = a.numa_node;
  21. j["affinity"]["nnode_src"] = a.nnode_src;
  22. j["affinity"]["nnode_dst"] = a.nnode_dst;
  23. }
  24. inline void from_json(const nlohmann::json& j, TaskData& a) {
  25. j["task"]["size"].get_to(a.size);
  26. j["task"]["batch_size"].get_to(a.batch_size);
  27. j["task"]["reps"].get_to(a.rep_count);
  28. j["affinity"]["node"].get_to(a.numa_node);
  29. j["affinity"]["nnode_src"].get_to(a.nnode_src);
  30. j["affinity"]["nnode_dst"].get_to(a.nnode_dst);
  31. }
  32. inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, const std::vector<uint64_t>& times, std::ostream& os) {
  33. nlohmann::json json;
  34. json["count"] = args.size();
  35. json["timings"] = times;
  36. json["path"] = path;
  37. json["list"] = args;
  38. os << json;
  39. }
  40. inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, uint64_t& repetitions, std::istream& is) {
  41. nlohmann::json json;
  42. is >> json;
  43. const uint32_t count = json.at("count");
  44. args.resize(count);
  45. path = json.at("path");
  46. repetitions = json.at("repetitions");
  47. for (uint32_t i = 0; i < count; i++) {
  48. args[i] = json["list"][i].template get<TaskData>();
  49. }
  50. }