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 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.
#include <ttg.h>
using Key2 = std::pair<int, int>;
os << "{" << std::get<0>(key) << ", " << std::get<1>(key) << "}";
return os;
}
}
ttg::send<0>(std::get<0>(key), input + 1.0, out);
}
} else {
}
}
int main(
int argc,
char **argv) {
wc->set_input_reducer<0>([](
double &a,
const double &b) { a += b; });
wc->set_argstream_size<0>(k, k+1);
for(int i = 0; i < k+1; i++) {
}
wa->set_keymap([&](const int &k) { return 0; });
wb->set_keymap([&](
const Key2 &k) {
return std::get<1>(k) % wb->get_world().size(); });
wc->set_keymap([&](const int &k) { return 0; });
if (wa->get_world().rank() == 0) wa->invoke(0, 0.0);
return EXIT_SUCCESS;
}
Edge is used to connect In and Out terminals.
int main(int argc, char **argv)
std::pair< int, int > Key2
std::ostream & operator<<(std::ostream &os, ttg::device::Device device)
ttg::World ttg_default_execution_context()
void execute(ttg::World world)
Starts the execution in the given execution context.
void initialize(int argc, char **argv, int num_threads=-1, RestOfArgs &&...)
void send()
Sends a control message (message without an accompanying task id or a value) to the template tasks at...
ttg::World & get_default_world()
void fence(ttg::World world)
Returns when all tasks associated with the given execution context have finished on all ranks.
void finalize()
Finalizes the TTG runtime.
void print(const T &t, const Ts &... ts)
atomically prints to std::cout a sequence of items (separated by ttg::print_separator) followed by st...
int rank(World world=default_execution_context())
std::enable_if_t<(std::is_convertible_v< decltype(*(std::declval< TTBasePtrs >())), TTBase & > &&...), bool > make_graph_executable(TTBasePtrs &&...tts)
Make the TTG tts executable. Applies.
auto edges(inedgesT &&...args)
Make a tuple of Edges to pass to.