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.

85 lines
2.8 KiB

  1. #pragma once
  2. #include <iostream>
  3. #include "json/single_include/nlohmann/json.hpp"
  4. #include "statuscode-tostring.hpp"
  5. #include "barrier.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. // average run duration in microseconds
  20. double combined_duration;
  21. double submit_duration;
  22. double complete_duration;
  23. double combined_duration_stdev;
  24. double submit_duration_stdev;
  25. double complete_duration_stdev;
  26. // completed iterations
  27. uint32_t rep_completed;
  28. // set by execution
  29. barrier* barrier_;
  30. };
  31. inline void to_json(nlohmann::json& j, const TaskData& a) {
  32. j["task"]["size"] = a.size;
  33. j["task"]["iterations"] = a.rep_count;
  34. j["task"]["batching"]["batch_submit"] = a.batch_submit;
  35. j["task"]["batching"]["batch_size"] = a.batch_size;
  36. j["affinity"]["node"] = a.numa_node;
  37. j["affinity"]["nnode_src"] = a.nnode_src;
  38. j["affinity"]["nnode_dst"] = a.nnode_dst;
  39. j["report"]["time"]["unit"] = "microseconds";
  40. j["report"]["time"]["completion_avg"] = a.complete_duration;
  41. j["report"]["time"]["submission_avg"] = a.submit_duration;
  42. j["report"]["time"]["combined_avg"] = a.combined_duration;
  43. j["report"]["time"]["completion_stdev"] = a.complete_duration_stdev;
  44. j["report"]["time"]["submission_stdev"] = a.submit_duration_stdev;
  45. j["report"]["time"]["combined_stdev"] = a.combined_duration_stdev;
  46. j["report"]["iterations_completed"] = a.rep_completed;
  47. j["report"]["status"] = StatusCodeToString(a.status);
  48. }
  49. inline void from_json(const nlohmann::json& j, TaskData& a) {
  50. j["task"]["size"].get_to(a.size);
  51. j["task"]["iterations"].get_to(a.rep_count);
  52. j["task"]["batching"]["batch_submit"].get_to(a.batch_submit);
  53. j["task"]["batching"]["batch_size"].get_to(a.batch_size);
  54. j["affinity"]["node"].get_to(a.numa_node);
  55. j["affinity"]["nnode_src"].get_to(a.nnode_src);
  56. j["affinity"]["nnode_dst"].get_to(a.nnode_dst);
  57. }
  58. inline void WriteResultLog(const std::vector<TaskData>& args, const std::string& path, std::ostream& os) {
  59. nlohmann::json json;
  60. json["count"] = args.size();
  61. json["path"] = path;
  62. json["list"] = args;
  63. os << std::setw(4) << json;
  64. }
  65. inline void ReadWorkDescription(std::vector<TaskData>& args, std::string& path, std::istream& is) {
  66. nlohmann::json json;
  67. is >> json;
  68. const uint32_t count = json.at("count");
  69. args.resize(count);
  70. path = json.at("path");
  71. for (uint32_t i = 0; i < count; i++) {
  72. args[i] = json["list"][i].template get<TaskData>();
  73. }
  74. }