Optimized Belief Propagation (CPU and GPU)
RunResultsSpeedups.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2024 Scott Grauer-Gray
3 
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8 
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 
28 #ifndef RUN_RESULTS_SPEEDUPS_H_
29 #define RUN_RESULTS_SPEEDUPS_H_
30 
31 #include <map>
32 #include <vector>
33 #include <string>
34 #include <filesystem>
35 #include <optional>
37 
43 public:
51  explicit RunResultsSpeedups(
52  const std::filesystem::path& imp_results_file_path,
53  const std::string& run_name);
54 
62  explicit RunResultsSpeedups(const std::filesystem::path& run_results_file_path);
63 
69  std::map<std::string, std::vector<std::string>> Speedups() const {
70  return speedup_header_to_result_speedup_order_->first;
71  }
72 
78  std::vector<std::string> SpeedupHeadersOrder() const {
79  return speedup_header_to_result_speedup_order_->second;
80  }
81 
89  std::map<InputSignature, std::string> InputsToKeyVal(std::string_view key) const;
90 
97  std::map<std::string, std::string> DataForInput(
98  const InputSignature& input_sig) const
99  {
100  return input_sig_to_run_data_->at(input_sig);
101  }
102 
103 private:
106  std::string run_name_;
107 
110  std::optional<std::pair<std::map<std::string, std::vector<std::string>>,
111  std::vector<std::string>>>
112  speedup_header_to_result_speedup_order_;
113 
115  std::optional<std::map<InputSignature, std::map<std::string, std::string>>>
116  input_sig_to_run_data_;
117 
124  void GenInputSignatureToDataMapping(
125  const std::optional<std::map<std::string, std::vector<std::string>>>&
126  run_results_header_to_data);
127 
140  std::pair<std::map<std::string, std::vector<std::string>>,
141  std::vector<std::string>>
142  HeaderToDataWOrderedHeadersCsv(
143  const std::filesystem::path& csv_file_path) const;
144 };
145 
146 #endif //RUN_RESULTS_SPEEDUPS_H_
Declares class for defining input signature for evaluation run that consists of evaluation set number...
Class defines input signature for evaluation run that contains evaluation set number,...
Class to load and store run results data including speedups from evaluation.
std::vector< std::string > SpeedupHeadersOrder() const
Return order of speedup headers.
std::map< std::string, std::string > DataForInput(const InputSignature &input_sig) const
Return data for specified input signature.
RunResultsSpeedups(const std::filesystem::path &imp_results_file_path, const std::string &run_name)
Constructor that takes in implementation file path and run name and retrieves run results and speedup...
std::map< InputSignature, std::string > InputsToKeyVal(std::string_view key) const
Get mapping of run input signature to value corresponding to input key for each run result.
std::map< std::string, std::vector< std::string > > Speedups() const
Return speedups from run results data with speedups.