Skip to content

Commit

Permalink
#included util/hash/std/pair.h where needed
Browse files Browse the repository at this point in the history
  • Loading branch information
evaleev committed Sep 15, 2022
1 parent ebfe297 commit 1f4efe1
Show file tree
Hide file tree
Showing 10 changed files with 42 additions and 41 deletions.
7 changes: 4 additions & 3 deletions doc/dox/user/examples/distributed.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <ttg.h>
#include <ttg/serialization/std/pair.h>
#include <ttg/util/hash/std/pair.h>

const double threshold = 100.0;
using Key2 = std::pair<int, int>;
Expand Down Expand Up @@ -35,7 +36,7 @@ int main(int argc, char **argv) {
ttg::Edge<int, double> C_A("C(k)->A(k)");

auto wc(ttg::make_tt(c, ttg::edges(B_C), ttg::edges(C_A), "C", {"From B"}, {"to A"}));

/**! \link TT::set_input_reducer() */wc->set_input_reducer/**! \endlink */<0>([](double &a, const double &b) { a += b; });

auto wa(ttg::make_tt([&](const int &k, const double &input, std::tuple<ttg::Out<Key2, double>> &out) {
Expand Down Expand Up @@ -67,8 +68,8 @@ int main(int argc, char **argv) {
/**
* \example distributed.cc
* This is the iterative diamond DAG with variable number of inputs using the reducing
* terminals of Template Task Graph, adapted to run in distributed: iteratively, a reducing
* diamond of data-dependent width is run, until the amount of data gathered at the bottom
* terminals of Template Task Graph, adapted to run in distributed: iteratively, a reducing
* diamond of data-dependent width is run, until the amount of data gathered at the bottom
* of the diamond exceeds a given threshold. First and last tasks of each diamond are run
* on rank 0, while the tasks inside the diamond are distributed between the ranks in a
* round-robin fashion.
Expand Down
32 changes: 14 additions & 18 deletions examples/floyd-warshall/floyd_warshall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace ttg;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

struct Key {
// ((I, J), K) where (I, J) is the tile coordinate and K is the iteration number
Expand Down Expand Up @@ -81,8 +82,8 @@ namespace std {
};
} // namespace std

class Initiator : public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
Initiator> {
class Initiator
: public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, Initiator> {
using baseT = typename Initiator::ttT;

public:
Expand Down Expand Up @@ -112,10 +113,11 @@ class Initiator : public TT<int, std::tuple<Out<Key, void>, Out<Key, void>, Out<
}
};

class FuncA : public TT<Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>,
Out<Key, void>, Out<Key, void>>,
FuncA, ttg::typelist<void>> {
class FuncA
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncA, ttg::typelist<void>> {
using baseT = typename FuncA::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -204,11 +206,8 @@ class FuncA : public TT<Key,
}
};

class FuncB
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncB, ttg::typelist<void, void>> {
class FuncB : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncB, ttg::typelist<void, void>> {
using baseT = typename FuncB::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -295,11 +294,8 @@ class FuncB
}
};

class FuncC
: public TT<
Key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncC, ttg::typelist<void, void>> {
class FuncC : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncC, ttg::typelist<void, void>> {
using baseT = typename FuncC::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -386,8 +382,8 @@ class FuncC
}
};

class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncD, ttg::typelist<void, void, void>> {
class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, FuncD,
ttg::typelist<void, void, void>> {
using baseT = typename FuncD::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down
1 change: 1 addition & 0 deletions examples/floyd-warshall/floyd_warshall_df.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ using namespace ttg;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

#include "../blockmatrix.h"
#include "ttg/util/bug.h"
Expand Down
8 changes: 4 additions & 4 deletions examples/ge/ge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using namespace std;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

using namespace ttg;

Expand Down Expand Up @@ -116,8 +117,7 @@ std::ostream& operator<<(std::ostream& s, const Integer& intVal) {
}

class Initiator
: public TT<Integer, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
Initiator> {
: public TT<Integer, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, Initiator> {
using baseT = typename Initiator::ttT;

public:
Expand Down Expand Up @@ -371,8 +371,8 @@ class FuncC : public TT<Key, std::tuple<Out<Key, void>>, FuncC, ttg::typelist<vo
}
};

class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>,
FuncD, ttg::typelist<void, void, void, void>> {
class FuncD : public TT<Key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>, Out<Key, void>>, FuncD,
ttg::typelist<void, void, void, void>> {
using baseT = typename FuncD::ttT;
double* adjacency_matrix_ttg;
int problem_size;
Expand Down
9 changes: 5 additions & 4 deletions examples/ge/ge_df.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ using namespace ttg;

#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

#include <madness/world/world.h>

Expand Down Expand Up @@ -328,8 +329,8 @@ class FuncA : public TT<Key,
};

template <typename T>
class FuncB : public TT<Key, std::tuple<Out<Key, BlockMatrix<T>>, Out<Key, BlockMatrix<T>>>,
FuncB<T>, ttg::typelist<BlockMatrix<T>, BlockMatrix<T>>> {
class FuncB : public TT<Key, std::tuple<Out<Key, BlockMatrix<T>>, Out<Key, BlockMatrix<T>>>, FuncB<T>,
ttg::typelist<BlockMatrix<T>, BlockMatrix<T>>> {
using baseT = typename FuncB::ttT;
Matrix<T>* adjacency_matrix_ttg;
int problem_size;
Expand Down Expand Up @@ -408,8 +409,8 @@ class FuncB : public TT<Key, std::tuple<Out<Key, BlockMatrix<T>>, Out<Key, Block
};

template <typename T>
class FuncC : public TT<Key, std::tuple<Out<Key, BlockMatrix<T>>, Out<Key, BlockMatrix<T>>>,
FuncC<T>, ttg::typelist<BlockMatrix<T>, BlockMatrix<T>>> {
class FuncC : public TT<Key, std::tuple<Out<Key, BlockMatrix<T>>, Out<Key, BlockMatrix<T>>>, FuncC<T>,
ttg::typelist<BlockMatrix<T>, BlockMatrix<T>>> {
using baseT = typename FuncC::ttT;
Matrix<T>* adjacency_matrix_ttg;
int problem_size;
Expand Down
1 change: 1 addition & 0 deletions examples/sw/sw.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ttg.h"

#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

/* TODO: get rid of the using statement */
using namespace ttg;
Expand Down
7 changes: 4 additions & 3 deletions examples/wavefront/wavefront-df.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "ttg/serialization.h"
#include "ttg/serialization/std/pair.h"
#include "ttg/serialization/std/vector.h"
#include "ttg/util/hash/std/pair.h"

/* TODO: Get rid of using statement */
using namespace ttg;
Expand Down Expand Up @@ -113,7 +114,7 @@ auto make_wavefront2(const funcT& func, int MB, int NB, Edge<Key, BlockMatrix<T>
};

return make_tt(f, edges(input, left, top, bottom_right), edges(left, top, result), "wavefront2",
{"input", "left", "top", "bottom-right"}, {"left", "top", "result"});
{"input", "left", "top", "bottom-right"}, {"left", "top", "result"});
}

template <typename T>
Expand Down Expand Up @@ -165,7 +166,7 @@ auto initiator(Matrix<T>* m, Edge<Key, BlockMatrix<T>>& out0, Edge<Key, BlockMat
};

return make_tt<Key>(f, edges(), edges(out0, out1, out2, bottom_right0, bottom_right1, bottom_right2), "initiator", {},
{"out0", "out1", "out2", "bottom_right0", "bottom-right1", "bottom-right2"});
{"out0", "out1", "out2", "bottom_right0", "bottom-right1", "bottom-right2"});
}

template <typename funcT, typename T>
Expand All @@ -189,7 +190,7 @@ auto make_wavefront0(const funcT& func, int MB, int NB, Edge<Key, BlockMatrix<T>
};

return make_tt(f, edges(input, bottom_right), edges(toporleft, result), "wavefront0", {"input", "bottom_right"},
{"toporleft", "result"});
{"toporleft", "result"});
}

// Method to generate wavefront task with single input.
Expand Down
16 changes: 7 additions & 9 deletions examples/wavefront/wavefront-wf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <utility>

#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

#include "ttg.h"

Expand Down Expand Up @@ -92,10 +93,8 @@ void wavefront_serial() {

// Method to generate wavefront tasks with two inputs.
template <typename funcT>
auto make_wavefront2(std::shared_ptr<double> m, const funcT& func, Edge<Key, void>& input1,
Edge<Key, void>& input2) {
auto f = [m, func](const Key& key,
std::tuple<Out<Key, void>, Out<Key, void>>& out) {
auto make_wavefront2(std::shared_ptr<double> m, const funcT& func, Edge<Key, void>& input1, Edge<Key, void>& input2) {
auto f = [m, func](const Key& key, std::tuple<Out<Key, void>, Out<Key, void>>& out) {
auto [i, j] = key;
int next_i = i + 1;
int next_j = j + 1;
Expand Down Expand Up @@ -123,10 +122,8 @@ auto make_wavefront2(std::shared_ptr<double> m, const funcT& func, Edge<Key, voi

// Method to generate wavefront task with single input.
template <typename funcT>
auto make_wavefront(std::shared_ptr<double> m, const funcT& func, Edge<Key, void>& input1,
Edge<Key, void>& input2) {
auto f = [m, func](const Key& key,
std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>>& out) {
auto make_wavefront(std::shared_ptr<double> m, const funcT& func, Edge<Key, void>& input1, Edge<Key, void>& input2) {
auto f = [m, func](const Key& key, std::tuple<Out<Key, void>, Out<Key, void>, Out<Key, void>>& out) {
auto [i, j] = key;
int next_i = i + 1;
int next_j = j + 1;
Expand All @@ -148,7 +145,8 @@ auto make_wavefront(std::shared_ptr<double> m, const funcT& func, Edge<Key, void
};

Edge<Key, void> recur("recur");
return make_tt(f, edges(recur), edges(recur, input1, input2), "wavefront", {"control"}, {"recur", "output1", "output2"});
return make_tt(f, edges(recur), edges(recur, input1, input2), "wavefront", {"control"},
{"recur", "output1", "output2"});
}

int main(int argc, char** argv) {
Expand Down
1 change: 1 addition & 0 deletions examples/wavefront/wavefront-wf2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "ttg.h"

#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

using namespace ttg;

Expand Down
1 change: 1 addition & 0 deletions tests/unit/fibonacci.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "ttg.h"

#include "ttg/serialization/std/pair.h"
#include "ttg/util/hash/std/pair.h"

constexpr int64_t N = 1000;

Expand Down

0 comments on commit 1f4efe1

Please sign in to comment.