HW2: RC3b - A MinMax-MPIexchange pipeline and small changes

This commit is contained in:
2025-01-05 21:26:56 +02:00
parent c485d0db2d
commit 3bf4522448
35 changed files with 286 additions and 101 deletions
+10
View File
@@ -23,3 +23,13 @@ bool isActive(mpi_id_t node, size_t nodes) {
return (node >= 0) && (node < static_cast<mpi_id_t>(nodes));
}
size_t tagGenerator(size_t depth, size_t step, size_t stage) {
auto stage_bits = static_cast<uint32_t>(std::log2(MAX_PIPELINE_SIZE));
auto step_bits = static_cast<uint32_t>(std::log2(MAX_MPI_SIZE));
// ^ We use MPI_SIZE room for steps to fit the bubbletonic version
size_t tag = stage
| (step << stage_bits)
| (depth << (stage_bits + step_bits));
return tag;
}
+23 -10
View File
@@ -17,7 +17,7 @@
#include "distsort.hpp"
// Global config data
// Global session data
config_t config;
MPI_t<> mpi;
distBuffer_t Data;
@@ -43,36 +43,49 @@ bool get_options(int argc, char* argv[]){
status = false;
}
}
else if (arg == "--pipeline") {
if (i+1 < argc) {
auto stages = atoi(argv[++i]);
if (isPowerOfTwo(stages) && stages <= static_cast<int>(MAX_PIPELINE_SIZE))
config.pipeline = stages;
else
status = false;
}
else {
status = false;
}
}
else if (arg == "--validation") {
config.validation = true;
}
else if (arg == "--ndebug") {
config.ndebug = true;
}
else if (arg == "--perf") {
config.perf = true;
}
else if (arg == "--ndebug") {
config.ndebug = true;
}
else if (arg == "-v" || arg == "--verbose") {
config.verbose = true;
}
else if (arg == "-h" || arg == "--help") {
std::cout << "distbitonic/distbubbletonic - A distributed bitonic sort\n\n";
std::cout << "distbitonic -q <N> [--validation] [--ndebug] [-v]\n";
std::cout << "distbitonic -q <N> [--pipeline N] [--validation] [--ndebug] [-v]\n";
std::cout << "distbitonic -h\n";
std::cout << "distbubbletonic -q <N> [--validation] [--ndebug] [-v]\n";
std::cout << "distbubbletonic -q <N> [--pipeline N] [--validation] [--ndebug] [-v]\n";
std::cout << "distbubbletonic -h\n";
std::cout << '\n';
std::cout << "Options:\n\n";
std::cout << " -q | --array-size <N>\n";
std::cout << " Selects the array size according to size = 2^N\n\n";
std::cout << " --par-sort\n";
std::cout << " Request a parallel full sorting algorithm\n\n";
std::cout << " --pipeline <N>\n";
std::cout << " Request a pipeline of <N> stages for exchange-minmax\n";
std::cout << " N must be power of 2 up to " << MAX_PIPELINE_SIZE << "\n\n";
std::cout << " --validation\n";
std::cout << " Request a full validation at the end, performed by process rank 0\n\n";
std::cout << " --perf\n";
std::cout << " Request performance timing measurements to stdout.\n\n";
std::cout << " --ndebug\n";
std::cout << " Skip debug breakpoint when on debug build.\n\n";
std::cout << " -t | --timing\n";
std::cout << " Request timing measurements output to stdout.\n\n";
std::cout << " -v | --verbose\n";
std::cout << " Request a more verbose output to stdout.\n\n";
std::cout << " -h | --help\n";