diff options
author | Benji Dial <benji@benjidial.net> | 2023-07-18 10:19:42 -0400 |
---|---|---|
committer | Benji Dial <benji@benjidial.net> | 2023-07-18 10:19:42 -0400 |
commit | 651b851fdd2a36958e09a66cb2877c66cf160a5e (patch) | |
tree | 2f4e0e35f0f27b9dbb28bd9f7fbe4e0b937ce378 /tabulator-mpi | |
parent | 723437674e0002f7b0e2b727bc24ec3080ac069f (diff) | |
download | lib94-651b851fdd2a36958e09a66cb2877c66cf160a5e.tar.gz |
better warrior placement, including handling the case where they don't fit
Diffstat (limited to 'tabulator-mpi')
-rw-r--r-- | tabulator-mpi/main.cpp | 9 | ||||
-rw-r--r-- | tabulator-mpi/worker.cpp | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/tabulator-mpi/main.cpp b/tabulator-mpi/main.cpp index e6e1a27..cd17044 100644 --- a/tabulator-mpi/main.cpp +++ b/tabulator-mpi/main.cpp @@ -42,6 +42,15 @@ int main(int argc, char **argv) { for (int i = 0; i < argc - 1; ++i) warriors[i] = load_warrior(argv[i + 1]); + for (int i = 0; i < argc - 1; ++i) + for (int j = i + 1; j < argc - 1; ++j) { + const lib94::warrior *wbuf[2] = {warriors[i], warriors[j]}; + if (!lib94::init_round(wbuf, 2)) { + fprintf(stderr, "warriors do not fit in core\n"); + return 1; + } + } + if (comm_rank == 0) head_main(comm_size, argc - 1, warriors); else diff --git a/tabulator-mpi/worker.cpp b/tabulator-mpi/worker.cpp index 511a27a..486d107 100644 --- a/tabulator-mpi/worker.cpp +++ b/tabulator-mpi/worker.cpp @@ -1,4 +1,5 @@ #include <lib94/lib94.hpp> +#include <cassert> #include <ctime> #include <mpi.h> @@ -15,7 +16,7 @@ static void do_round(const lib94::warrior *w1, const lib94::warrior *w2, int &w1 lib94::clear_core(background); - lib94::init_round(ws, 2); + assert(lib94::init_round(ws, 2)); for (int i = 0; i < STEPS_TO_TIE; ++i) { const lib94::warrior *result = lib94::single_step<false>(); |