void Runner::printHeader()

in gloo/benchmark/runner.cc [395:468]


void Runner::printHeader() {
  if (options_.contextRank != 0) {
    return;
  }
  std::string line = std::string(kTotalWidth + 2, '=');

  // ================================= ALGORITHM =================================
  std::cout << line << std::endl;
  std::string algo = options_.benchmark;
  // Add offset to header width to center text
  int algoOffset = algo.length() / 2;
  // Print out algorithm name in upper case
  for (auto &c : algo) {
    c = std::toupper(c);
  }
  std::cout << std::right << std::setw(kHeaderWidth + algoOffset) << algo;
  std::cout << std::endl << std::endl;

  if (transportDevices_.size() == 1) {
    std::cout << std::left << std::setw(kColWidthM) << "Device:";
    std::cout << transportDevices_.front()->str() << std::endl;
  } else {
    std::cout << std::left << std::setw(kColWidthM) << "Devices:" << std::endl;
    for (const auto& device : transportDevices_) {
      std::cout << "  - " << device->str() << std::endl;
    }
  }

  std::cout << std::left << std::setw(kColWidthM) << "Options:";
  std::cout << "processes=" << options_.contextSize;
  std::cout << ", inputs=" << options_.inputs;
  std::cout << ", threads=" << options_.threads;
  if (options_.benchmark == "allreduce_bcube") {
    std::cout << ", base=" << options_.base;
  }
  if (options_.benchmark.compare(0, 5, "cuda_") == 0) {
    std::cout << ", gpudirect=";
    if (options_.transport == "ibverbs" && options_.gpuDirect) {
      std::cout << "yes";
    } else {
      std::cout << "no";
    }
  }
  std::cout << std::boolalpha;
  std::cout << ", verify=" << options_.verify;
  std::cout << std::endl << std::endl;

  // =============================== BENCHMARK RESULTS ===============================
  std::cout << line << std::endl;
  // Section title
  std::string benchmarkTitle = "BENCHMARK RESULTS";
  // Add offset to header width to center text
  int offset = benchmarkTitle.length() / 2;
  std::cout << std::right << std::setw(kHeaderWidth + offset) << benchmarkTitle;
  std::cout << std::endl << std::endl;

  std::string suffix = "(us)";
  if (options_.showNanos) {
    suffix = "(ns)";
  }
  std::string bwSuffix = "(GB/s)";
  std::string sSuffix = "(B)";

  std::cout << std::right;
  std::cout << std::setw(kColWidthS) << ("size " + sSuffix);
  std::cout << std::setw(kColWidthS) << "elements";
  std::cout << std::setw(kColWidthS) << ("min " + suffix);
  std::cout << std::setw(kColWidthS) << ("p50 " + suffix);
  std::cout << std::setw(kColWidthS) << ("p99 " + suffix);
  std::cout << std::setw(kColWidthS) << ("max " + suffix);
  std::cout << std::setw(kColWidthL) << ("bandwidth " + bwSuffix);
  std::cout << std::setw(kColWidthM) << "iterations";
  std::cout << std::endl;
}