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.

81 lines
2.5 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include "json/single_include/nlohmann/json.hpp"
  4. #include "barrier.hpp"
  5. #include "dml-helper.hpp"
  6. struct TaskData {
  7. // thread placement / engine selection
  8. uint8_t numa_node;
  9. // region size and source+destination for move
  10. size_t size;
  11. uint8_t nnode_src;
  12. uint8_t nnode_dst;
  13. // repetition
  14. uint32_t rep_count;
  15. bool batch_submit;
  16. uint32_t batch_size;
  17. // thread output
  18. dml::status_code status;
  19. // timing measurements in nanoseconds
  20. uint64_t total_time;
  21. std::vector<uint64_t> combined_duration;
  22. std::vector<uint64_t> submit_duration;
  23. std::vector<uint64_t> complete_duration;
  24. // completed iterations
  25. uint32_t rep_completed;
  26. // set by execution
  27. barrier* barrier_;
  28. };
  29. inline void to_json(nlohmann::json& j, const TaskData& a) {
  30. j["task"]["size"] = a.size;
  31. j["task"]["iterations"] = a.rep_count;
  32. j["task"]["batching"]["batch_submit"] = a.batch_submit;
  33. j["task"]["batching"]["batch_size"] = a.batch_size;
  34. j["affinity"]["node"] = a.numa_node;
  35. j["affinity"]["nnode_src"] = a.nnode_src;
  36. j["affinity"]["nnode_dst"] = a.nnode_dst;
  37. j["report"]["time"]["unit"] = "nanoseconds";
  38. j["report"]["time"]["total"] = a.total_time;
  39. j["report"]["time"]["completion"] = a.complete_duration;
  40. j["report"]["time"]["submission"] = a.submit_duration;
  41. j["report"]["time"]["combined"] = a.combined_duration;
  42. j["report"]["iterations_completed"] = a.rep_completed;
  43. j["report"]["status"] = StatusCodeToString(a.status);
  44. }
  45. inline void from_json(const nlohmann::json& j, TaskData& a) {
  46. j["task"]["size"].get_to(a.size);
  47. j["task"]["iterations"].get_to(a.rep_count);
  48. j["task"]["batching"]["batch_submit"].get_to(a.batch_submit);
  49. j["task"]["batching"]["batch_size"].get_to(a.batch_size);
  50. j["affinity"]["node"].get_to(a.numa_node);
  51. j["affinity"]["nnode_src"].get_to(a.nnode_src);
  52. j["affinity"]["nnode_dst"].get_to(a.nnode_dst);
  53. }
  54. inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, std::ostream& os) {
  55. nlohmann::json json;
  56. json["count"] = args.size();
  57. json["path"] = path;
  58. json["list"] = args;
  59. os << json;
  60. }
  61. inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, std::istream& is) {
  62. nlohmann::json json;
  63. is >> json;
  64. const uint32_t count = json.at("count");
  65. args.resize(count);
  66. path = json.at("path");
  67. for (uint32_t i = 0; i < count; i++) {
  68. args[i] = json["list"][i].template get<TaskData>();
  69. }
  70. }