Browse Source

use the new json handler for reading configuration and writing output

master
Constantin Fürst 1 year ago
parent
commit
5606a21cc0
  1. 61
      benchmarks/main.cpp

61
benchmarks/main.cpp

@ -2,53 +2,42 @@
#include <vector>
#include <iostream>
#include <fstream>
#include "error.hpp"
#include "logging-helper.hpp"
#include "execute-move.hpp"
template <typename path>
int testrunner() {
std::vector<ThreadArgs> args;
ThreadArgs a;
a.core = 0;
a.numa_node = 0;
a.size = 4096;
a.nnode_dst = 0;
a.nnode_src = 0;
args.emplace_back(a);
execute_mem_move<path>(args);
const auto status = args.front().status.front();
std::cout << "Operation Result Status: " << status << std::endl;
return 0;
}
int main(int argc, char **argv) {
if (argc < 2) {
std::cout << "Missing the execution path as the first parameter. Use hardware_path, software_path or automatic_path." << std::endl;
if (argc < 3) {
std::cout << "Missing input and output file names." << std::endl;
std::cout << "Usage: ./benchmarks [input.json] [output.json]" << std::endl;
return 1;
}
const std::string path = argv[1];
const std::string input = argv[1];
const std::string output = argv[2];
std::string path;
std::vector<ThreadArgs> args;
std::ifstream is(input);
ReadWorkDescription(args, path, is);
is.close();
if (path == "hardware_path") {
std::cout << "Executing using dml::hardware path" << std::endl;
return testrunner<dml::hardware>();
if (path == "hw") {
execute_mem_move<dml::hardware>(args);
}
else if (path == "software_path") {
std::cout << "Executing using dml::software path" << std::endl;
return testrunner<dml::software>();
else if (path == "sw") {
execute_mem_move<dml::software>(args);
}
else if (path == "auto_path") {
std::cout << "Executing using dml::automatic path" << std::endl;
return testrunner<dml::automatic>();
else if (path == "auto") {
execute_mem_move<dml::automatic>(args);
}
else {
std::cout << "Unrecognized value for parameter. Use hardware_path, software_path or automatic_path." << std::endl;
return 1;
std::cerr << "Path is neither hw/sw/auto." << std::endl;
}
std::ofstream os(output);
WriteResultLog(args, path, os);
os.close();
}
Loading…
Cancel
Save