HW2: Add the rest of the report (w/o the prof)
This commit is contained in:
+39
-32
@@ -29,31 +29,31 @@ std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
|
||||
//! Performance timers for each one of the "costly" functions
|
||||
Timing Ttotal;
|
||||
Timing TfullSort;
|
||||
Timing Texchange;
|
||||
Timing Tminmax;
|
||||
Timing TelbowSort;
|
||||
Timing Timer_total;
|
||||
Timing Timer_fullSort;
|
||||
Timing Timer_exchange;
|
||||
Timing Timer_minmax;
|
||||
Timing Timer_elbowSort;
|
||||
|
||||
//! Init timing objects for extra rounds
|
||||
void measurements_init() {
|
||||
if (config.perf > 1) {
|
||||
Ttotal.init(config.perf);
|
||||
TfullSort.init(config.perf);
|
||||
Texchange.init(config.perf);
|
||||
Tminmax.init(config.perf);
|
||||
TelbowSort.init(config.perf);
|
||||
Timer_total.init(config.perf);
|
||||
Timer_fullSort.init(config.perf);
|
||||
Timer_exchange.init(config.perf);
|
||||
Timer_minmax.init(config.perf);
|
||||
Timer_elbowSort.init(config.perf);
|
||||
}
|
||||
}
|
||||
|
||||
//! iterate ot the next round of measurements for all measurement objects
|
||||
void measurements_next() {
|
||||
if (config.perf > 1) {
|
||||
Ttotal.next();
|
||||
TfullSort.next();
|
||||
Texchange.next();
|
||||
Tminmax.next();
|
||||
TelbowSort.next();
|
||||
Timer_total.next();
|
||||
Timer_fullSort.next();
|
||||
Timer_exchange.next();
|
||||
Timer_minmax.next();
|
||||
Timer_elbowSort.next();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,12 +108,17 @@ bool get_options(int argc, char* argv[]){
|
||||
else if (arg == "-v" || arg == "--verbose") {
|
||||
config.verbose = true;
|
||||
}
|
||||
else if (arg == "--version") {
|
||||
std::cout << "distbitonic/distbubbletonic - A distributed sort utility\n";
|
||||
std::cout << "version: " << version << "\n\n";
|
||||
exit(0);
|
||||
}
|
||||
else if (arg == "-h" || arg == "--help") {
|
||||
std::cout << "distbitonic/distbubbletonic - A distributed sort utility\n\n";
|
||||
std::cout << "distbitonic -q <N> [-e] [-p | --pipeline N] [--validation] [--perf <N>] [--ndebug] [-v]\n";
|
||||
std::cout << "distbitonic -h\n";
|
||||
std::cout << "distbubbletonic -q <N> [-e] [-p | --pipeline N] [--validation] [--perf <N> ] [--ndebug] [-v]\n";
|
||||
std::cout << "distbubbletonic -h\n";
|
||||
std::cout << " distbitonic -q <N> [-e] [-p | --pipeline <N>] [--validation] [--perf <N>] [--ndebug] [-v]\n";
|
||||
std::cout << " distbitonic -h\n";
|
||||
std::cout << " distbubbletonic -q <N> [-e] [-p | --pipeline <N>] [--validation] [--perf <N> ] [--ndebug] [-v]\n";
|
||||
std::cout << " distbubbletonic -h\n";
|
||||
std::cout << '\n';
|
||||
std::cout << "Options:\n\n";
|
||||
std::cout << " -q | --array-size <N>\n";
|
||||
@@ -134,6 +139,8 @@ bool get_options(int argc, char* argv[]){
|
||||
std::cout << " Request a more verbose output to stdout.\n\n";
|
||||
std::cout << " -h | --help\n";
|
||||
std::cout << " Prints this and exit.\n\n";
|
||||
std::cout << " --version\n";
|
||||
std::cout << " Prints version and exit.\n\n";
|
||||
std::cout << "Examples:\n\n";
|
||||
std::cout << " mpirun -np 4 distbitonic -q 24\n";
|
||||
std::cout << " Runs distbitonic in 4 MPI processes with 2^24 array points each\n\n";
|
||||
@@ -201,13 +208,13 @@ bool validator(ShadowedDataT& data, mpi_id_t Processes, mpi_id_t rank) {
|
||||
* @param argv [char***] POINTER to main's argv argument
|
||||
*/
|
||||
void init(int* argc, char*** argv) {
|
||||
// Initialize MPI environment
|
||||
mpi.init(argc, argv);
|
||||
|
||||
// try to read command line (after MPI parsing)
|
||||
// try to read command line
|
||||
if (!get_options(*argc, *argv))
|
||||
exit(1);
|
||||
|
||||
// Initialize MPI environment
|
||||
mpi.init(argc, argv);
|
||||
|
||||
logger << "MPI environment initialized." << " Rank: " << mpi.rank() << " Size: " << mpi.size()
|
||||
<< logger.endl;
|
||||
|
||||
@@ -237,7 +244,7 @@ void init(int* argc, char*** argv) {
|
||||
|
||||
#if !defined TESTING
|
||||
/*!
|
||||
* @return Returns 0, but.... we may throw or exit(1)
|
||||
* @return Returns 0, but.... we may throw or exit(0) / exit(1)
|
||||
*/
|
||||
int main(int argc, char* argv[]) try {
|
||||
|
||||
@@ -255,13 +262,13 @@ int main(int argc, char* argv[]) try {
|
||||
// Run distributed sort
|
||||
if (mpi.rank() == 0)
|
||||
logger << "Starting distributed sorting ... ";
|
||||
Ttotal.start();
|
||||
Timer_total.start();
|
||||
#if CODE_VERSION == BUBBLETONIC
|
||||
distBubbletonic(Data, mpi.size(), mpi.rank());
|
||||
#else
|
||||
distBitonic(Data, mpi.size(), mpi.rank());
|
||||
#endif
|
||||
Ttotal.stop();
|
||||
Timer_total.stop();
|
||||
measurements_next();
|
||||
if (mpi.rank() == 0)
|
||||
logger << " Done." << logger.endl;
|
||||
@@ -269,11 +276,11 @@ int main(int argc, char* argv[]) try {
|
||||
|
||||
// Print-outs and validation
|
||||
if (config.perf > 1) {
|
||||
Timing::print_duration(Ttotal.median(), "Total ", mpi.rank());
|
||||
Timing::print_duration(TfullSort.median(), "Full-Sort ", mpi.rank());
|
||||
Timing::print_duration(Texchange.median(), "Exchange ", mpi.rank());
|
||||
Timing::print_duration(Texchange.median(), "Min-Max ", mpi.rank());
|
||||
Timing::print_duration(TelbowSort.median(),"Elbow-Sort", mpi.rank());
|
||||
Timing::print_duration(Timer_total.median(), "Total ", mpi.rank());
|
||||
Timing::print_duration(Timer_fullSort.median(), "Full-Sort ", mpi.rank());
|
||||
Timing::print_duration(Timer_exchange.median(), "Exchange ", mpi.rank());
|
||||
Timing::print_duration(Timer_minmax.median(), "Min-Max ", mpi.rank());
|
||||
Timing::print_duration(Timer_elbowSort.median(),"Elbow-Sort", mpi.rank());
|
||||
}
|
||||
if (config.validation) {
|
||||
// If requested, we have the chance to fail!
|
||||
@@ -308,4 +315,4 @@ catch (std::exception& e) {
|
||||
std::cout << "Exception: " << e.what() << '\n';
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user