Calculate Fibonacci numbers exploiting nested parallelism through Async.
#include <future>
#include <iostream>
int Fibonacci(int n)
{
if (n < 2) {
} else {
auto res = fut1.get() + fut2.get();
return res;
}
}
void mt304_AsyncNested()
{
std::cout << "Fibonacci(33) = " << Fibonacci(33) << std::endl;
}
{
mt304_AsyncNested();
return 0;
}
- Author
- Danilo Piparo
Definition in file mt304_AsyncNested.C.