1 #ifndef LINGEN_BMSTATUS_HPP_
2 #define LINGEN_BMSTATUS_HPP_
3 // IWYU pragma: no_include <algorithm>
4 #include <cstring>
5 #include <vector>
6 #include <tuple>
7 #include "lingen_bw_dimensions.hpp"
8 #include "lingen_hints.hpp"
9 #include "lingen_call_companion.hpp"
10 #include "tree_stats.hpp"
11 #include "select_mpi.h"               // for MPI_Comm
12 
13 struct bmstatus {
14     bw_dimensions d;
15     unsigned int t = 0;
16     std::vector<int> lucky;
17     std::vector<unsigned int> delta;
18     int done = 0;
19 
20     double t_basecase = 0;
21     double t_mp = 0;
22     double t_mul = 0;
23     double t_cp_io = 0;
24 
25     // unsigned int lingen_threshold;
26     // unsigned int lingen_mpi_threshold;
27 
28     int mpi_dims[2]; /* mpi_dims[0] = mpi[0] * thr[0] */
29     MPI_Comm com[3]; /* [0]: MPI_COMM_WORLD, reordered.
30                         [1]: row-wise
31                         [2]: column-wise */
32 
33     lingen_hints hints;
34 
35     tree_stats stats;
36 
depthbmstatus37     int depth() const { return stats.non_transition_depth(); }
38 
bmstatusbmstatus39     bmstatus(unsigned int m, unsigned int n)/*{{{*/
40 
41     {
42         memset(&d, 0, sizeof(bw_dimensions));
43         d.m = m;
44         d.n = n;
45         lucky.assign(m+n, 0);
46     }/*}}}*/
set_t0bmstatus47     void set_t0(unsigned int t0) {
48         t = t0;
49         delta.assign(d.m + d.n, t);
50     }
51     /* Attention: reloading a checkpoint invalidates this reference !! */
52     lingen_call_companion & companion(int depth, size_t L);
recursebmstatus53     bool recurse(int depth, size_t L) {/*{{{*/
54         return companion(depth, L).recurse();
55     }/*}}}*/
56     void display_deltas() const;
recursebmstatus57     bool recurse(size_t L) {/*{{{*/
58         return companion(depth(), L).recurse();
59     }/*}}}*/
60     std::tuple<unsigned int, unsigned int> get_minmax_delta_on_solutions() const;
61     unsigned int get_max_delta_on_solutions() const;
62 };
63 
64 #endif	/* LINGEN_BMSTATUS_HPP_ */
65