summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/lib94/lib94.hpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/include/lib94/lib94.hpp b/include/lib94/lib94.hpp
index 71ec68e..9b4147c 100644
--- a/include/lib94/lib94.hpp
+++ b/include/lib94/lib94.hpp
@@ -6,6 +6,7 @@
#include <string>
#include <vector>
#include <deque>
+#include <mpi.h>
#include <set>
#ifndef LIB94_CORE_SIZE
@@ -22,7 +23,8 @@ namespace lib94 {
//it has to be at least big enough to represent LIB94_CORE_SIZE squared,
//since it is used as an intermediate for all of the instructions,
//including in particular MUL.
- typedef int_least32_t number_t;
+ typedef int32_t number_t;
+ #define LIB94_MPI_NUMBER_T MPI_INT32_T
enum opcode : uint8_t {
DAT, MOV, ADD, SUB,
@@ -162,10 +164,17 @@ namespace lib94 {
//convenience method - calls clear_core(background), then init_round(warriors, count,
//offsets, shuffle), then single_step<false> until either one warrior remains or that
- //has been called rounds_to_tie times. if one warrior remains, returns the pointer to
+ //has been called steps_to_tie times. if one warrior remains, returns the pointer to
//that warrior. if a tie is reached, returns a null pointer. this asserts that the call
//to init_round returns true. see comment on init_round.
- const warrior *do_round(const instruction &background, const warrior *const *warriors, size_t count, const number_t *offsets, bool shuffle, long rounds_to_tie);
+ const warrior *do_round(const instruction &background, const warrior *const *warriors, size_t count, const number_t *offsets, bool shuffle, long steps_to_tie);
+
+ //runs every possible offset and turn order using do_round.
+ //asserts that total length is not more than core size.
+ //should be called from everyone in a communicator.
+ //assumes comm ranks go from 0 to comm size - 1.
+ template <bool print_progress>
+ void tabulate_mpi(const instruction &background, const warrior *w1, const warrior *w2, long steps_to_tie, int &w1_wins_out, int &w2_wins_out, int &rounds_out, MPI_Comm communicator);
}