8 Fn() {
F[0] = 1;
F[1] = 0; }
9 template <
typename Archive>
13 template <
typename Archive>
22 auto fib = ttg::make_tt(
23 [=](int64_t n,
Fn&& f_n) {
24 int64_t next_f_n = f_n.F[0] + f_n.F[1];
28 ttg::send<0>(n + 1, f_n);
35 auto print = ttg::make_tt(
37 std::cout <<
"The largest Fibonacci number smaller than " <<
F_n_max <<
" is " << f_n.F[1] << std::endl;
40 auto ins = std::make_tuple(fib->template in<0>());
41 std::vector<std::unique_ptr<ttg::TTBase>> ops;
42 ops.emplace_back(std::move(fib));
43 ops.emplace_back(std::move(print));
44 return make_ttg(std::move(ops), ins, std::make_tuple(),
"Fib_n < N");
47int main(
int argc,
char* argv[]) {
49 int64_t N = (argc > 1) ? std::atol(argv[1]) : 1000;
59 fib->template in<0>()->send(1,
Fn{});;
Edge is used to connect In and Out terminals.
int main(int argc, char *argv[])
auto make_ttg_fib_lt(const int64_t F_n_max=1000)
void execute(ttg::World world)
Starts the execution in the given execution context.
void initialize(int argc, char **argv, int num_threads=-1, RestOfArgs &&...)
World default_execution_context()
Accesses the default backend's default execution context.
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.
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.
N.B. contains values of F_n and F_{n-1}.
void serialize(Archive &ar, const unsigned int)
void serialize(Archive &ar)