Run the benchmark algorithm.
// verify command line args
if (args.length < 1) {
System.err.println("Usage: java Benchmark <algorithm file>");
System.exit(1);
}
// verify input files
File algFile = new File(args[0]);
if (!algFile.exists() || !algFile.isFile() || !algFile.canRead()) {
System.err.println("cannot find/read algorithm file: "+algFile.getAbsolutePath());
System.exit(1);
}
// last preparations
PerfRunData runData = null;
try {
runData = new PerfRunData(new Config(algFile));
} catch (Exception e) {
System.err.println("Error: cannot init PerfRunData: "+e.getMessage());
e.printStackTrace();
System.exit(1);
}
// parse algorithm
Algorithm algorithm = null;
try {
algorithm = new Algorithm(runData);
} catch (Exception e) {
System.err.println("Error: cannot understand algorithm from file: "+algFile.getAbsolutePath());
e.printStackTrace();
System.exit(1);
}
System.out.println("------------> algorithm:");
System.out.println(algorithm.toString());
// execute
try {
algorithm.execute();
} catch (Exception e) {
System.err.println("Error: cannot execute the algorithm! "+e.getMessage());
e.printStackTrace();
}
System.out.println("####################");
System.out.println("### D O N E !!! ###");
System.out.println("####################");