evaluate_defaults_action_t Struct Reference
+ Inheritance diagram for evaluate_defaults_action_t:

Classes

struct  results_entry_t
 

Public Member Functions

virtual const charinvokation_name () const override
 
void show_usage_and_exit () const
 
virtual void run (const vector< string > &input_filenames) const override
 
- Public Member Functions inherited from action_t
virtual ~action_t ()
 
virtual void run () const
 
virtual ~action_t ()
 

Static Public Member Functions

static bool lower_efficiency (const results_entry_t &e1, const results_entry_t &e2)
 

Friends

ostream & operator<< (ostream &s, const results_entry_t &entry)
 

Member Function Documentation

◆ invokation_name()

virtual const char* evaluate_defaults_action_t::invokation_name ( ) const
inlineoverridevirtual

Reimplemented from action_t.

599 { return "evaluate-defaults"; }

◆ lower_efficiency()

static bool evaluate_defaults_action_t::lower_efficiency ( const results_entry_t e1,
const results_entry_t e2 
)
inlinestatic
596  {
597  return e1.default_efficiency < e2.default_efficiency;
598  }

References evaluate_defaults_action_t::results_entry_t::default_efficiency.

◆ run()

virtual void evaluate_defaults_action_t::run ( const vector< string > &  input_filenames) const
inlineoverridevirtual

Reimplemented from action_t.

606  {
607  if (input_filenames.size() != 2) {
609  }
610  inputfile_t inputfile_default_sizes(input_filenames[0]);
611  inputfile_t inputfile_all_pot_sizes(input_filenames[1]);
612  if (inputfile_default_sizes.type != inputfile_t::type_t::default_sizes) {
613  cerr << inputfile_default_sizes.filename << " is not an input file with default sizes." << endl;
615  }
616  if (inputfile_all_pot_sizes.type != inputfile_t::type_t::all_pot_sizes) {
617  cerr << inputfile_all_pot_sizes.filename << " is not an input file with all POT sizes." << endl;
619  }
620  vector<results_entry_t> results;
621  vector<results_entry_t> cubic_results;
622 
623  uint16_t product_size = 0;
624  auto it_all_pot_sizes = inputfile_all_pot_sizes.entries.begin();
625  for (auto it_default_sizes = inputfile_default_sizes.entries.begin();
626  it_default_sizes != inputfile_default_sizes.entries.end(); ++it_default_sizes) {
627  if (it_default_sizes->product_size == product_size) {
628  continue;
629  }
630  product_size = it_default_sizes->product_size;
631  while (it_all_pot_sizes != inputfile_all_pot_sizes.entries.end() &&
632  it_all_pot_sizes->product_size != product_size) {
633  ++it_all_pot_sizes;
634  }
635  if (it_all_pot_sizes == inputfile_all_pot_sizes.entries.end()) {
636  break;
637  }
638  uint16_t best_pot_block_size = 0;
639  float best_pot_gflops = 0;
640  for (auto it = it_all_pot_sizes; it != inputfile_all_pot_sizes.entries.end() && it->product_size == product_size;
641  ++it) {
642  if (it->gflops > best_pot_gflops) {
643  best_pot_gflops = it->gflops;
644  best_pot_block_size = it->pot_block_size;
645  }
646  }
647  results_entry_t entry;
648  entry.product_size = product_size;
649  entry.default_block_size = it_default_sizes->nonpot_block_size;
650  entry.best_pot_block_size = best_pot_block_size;
651  entry.default_gflops = it_default_sizes->gflops;
652  entry.best_pot_gflops = best_pot_gflops;
653  entry.default_efficiency = entry.default_gflops / entry.best_pot_gflops;
654  results.push_back(entry);
655 
656  size_triple_t t(product_size);
657  if (t.k == t.m && t.m == t.n) {
658  cubic_results.push_back(entry);
659  }
660  }
661 
662  cout << "All results:" << endl;
663  for (auto it = results.begin(); it != results.end(); ++it) {
664  cout << *it << endl;
665  }
666  cout << endl;
667 
668  sort(results.begin(), results.end(), lower_efficiency);
669 
670  const size_t n = min<size_t>(20, results.size());
671  cout << n << " worst results:" << endl;
672  for (size_t i = 0; i < n; i++) {
673  cout << results[i] << endl;
674  }
675  cout << endl;
676 
677  cout << "cubic results:" << endl;
678  for (auto it = cubic_results.begin(); it != cubic_results.end(); ++it) {
679  cout << *it << endl;
680  }
681  cout << endl;
682 
683  sort(cubic_results.begin(), cubic_results.end(), lower_efficiency);
684 
685  cout.precision(2);
686  vector<float> a = {0.5f, 0.20f, 0.10f, 0.05f, 0.02f, 0.01f};
687  for (auto it = a.begin(); it != a.end(); ++it) {
688  size_t n = min(results.size() - 1, size_t(*it * results.size()));
689  cout << (100.0f * n / (results.size() - 1))
690  << " % of product sizes have default efficiency <= " << 100.0f * results[n].default_efficiency << " %"
691  << endl;
692  }
693  cout.precision(default_precision);
694  }
int i
Definition: BiCGSTAB_step_by_step.cpp:9
const unsigned n
Definition: CG3DPackingUnitTest.cpp:11
const int default_precision
Definition: analyze-blocking-sizes.cpp:26
#define min(a, b)
Definition: datatypes.h:22
std::map< std::string, Array< float, 1, 8, DontAlign|RowMajor > > results
Definition: dense_solvers.cpp:10
const Scalar * a
Definition: level2_cplx_impl.h:32
std::uint16_t uint16_t
Definition: Meta.h:38
t
Definition: plotPSD.py:36
void show_usage_and_exit() const
Definition: analyze-blocking-sizes.cpp:600
static bool lower_efficiency(const results_entry_t &e1, const results_entry_t &e2)
Definition: analyze-blocking-sizes.cpp:596
Definition: analyze-blocking-sizes.cpp:67
Definition: analyze-blocking-sizes.cpp:45

References a, inputfile_t::all_pot_sizes, evaluate_defaults_action_t::results_entry_t::best_pot_block_size, evaluate_defaults_action_t::results_entry_t::best_pot_gflops, evaluate_defaults_action_t::results_entry_t::default_block_size, evaluate_defaults_action_t::results_entry_t::default_efficiency, evaluate_defaults_action_t::results_entry_t::default_gflops, default_precision, inputfile_t::default_sizes, inputfile_t::entries, inputfile_t::filename, i, lower_efficiency(), min, n, evaluate_defaults_action_t::results_entry_t::product_size, results, show_usage_and_exit(), plotPSD::t, and inputfile_t::type.

◆ show_usage_and_exit()

void evaluate_defaults_action_t::show_usage_and_exit ( ) const
inline
600  {
601  cerr << "usage: " << invokation_name() << " default-sizes-data all-pot-sizes-data" << endl;
602  cerr << "checks how well the performance with default sizes compares to the best "
603  << "performance measured over all POT sizes." << endl;
604  exit(1);
605  }
virtual const char * invokation_name() const override
Definition: analyze-blocking-sizes.cpp:599

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  s,
const results_entry_t entry 
)
friend
589  {
590  return s << "Product size " << size_triple_t(entry.product_size) << ": default block size "
591  << entry.default_block_size << " -> " << entry.default_gflops
592  << " GFlop/s = " << entry.default_efficiency * 100.0f << " %"
593  << " of best POT block size " << size_triple_t(entry.best_pot_block_size) << " -> "
594  << entry.best_pot_gflops << " GFlop/s" << dec;
595  }
RealScalar s
Definition: level1_cplx_impl.h:130

The documentation for this struct was generated from the following file: