Commit 7741b9b5 authored by Quentin Khan's avatar Quentin Khan

FAdaptiveTask: use FAlgorithmTimers to time algorithm steps

parent 1176253b
......@@ -6,6 +6,7 @@
#include <cmath> // Used to round box differences
#include <functional>
#include <map>
#include <vector>
#include <list>
#include <array>
#include <type_traits>
......@@ -18,11 +19,10 @@
#include "Core/FCoreCommon.hpp"
#include "Containers/FTreeCoordinate.hpp"
#include "FTimer.hpp"
#include "Utils/FAlgorithmTimers.hpp"
template<class _Tree, class _Kernel>
class FAdaptiveTask : public FAlgorithmInterface {
class FAdaptiveTask : public FAlgorithmInterface, public FAlgorithmTimers {
public:
using tree_t = _Tree;
using kernel_t = _Kernel;
......@@ -36,9 +36,6 @@ protected:
/// Vector of kernels, one per thread
std::vector<std::unique_ptr<kernel_t>> _kernels;
/// Timing object
FTimer timer;
/** \brief SFINAE shortcut to check `K.setup(Args...)` existence */
template<typename K, typename Ret, typename... Args>
......@@ -206,56 +203,74 @@ public:
{
if(operations & FFmmP2M) {
// 1. source to up, P2M
timer.time([this](){this->source_to_up();});
std::cout << " P2M: " << timer.last().count() << '\n';
Timers["P2M"].tic();
this->source_to_up();;
Timers["P2M"].tac();
std::cout << " P2M: " << Timers["P2M"].elapsed() << std::endl;
}
if(operations & FFmmP2L) {
// 3b X-list, P2L
timer.time([this](){this->x_list_step();});
std::cout << " P2L: " << timer.last().count() << '\n';
Timers["P2L"].tic();
this->x_list_step();
Timers["P2L"].tac();
std::cout << " P2L: " << Timers["P2L"].elapsed() << std::endl;
}
if(operations & FFmmP2P) {
// A. U-list, P2P
timer.time([this](){this->u_list_step();});
std::cout << " P2P: " << timer.last().count() << '\n';
Timers["P2P"].tic();
this->u_list_step();
Timers["P2P"].tac();
std::cout << " P2P: " << Timers["P2P"].elapsed() << std::endl;
}
if(operations & FFmmM2M) {
// 2. up to up, M2M
timer.time([this](){this->up_to_up();});
std::cout << " M2M: " << timer.last().count() << '\n';
Timers["M2M"].tic();
this->up_to_up();
Timers["M2M"].tac();
std::cout << " M2M: " << Timers["M2M"].elapsed() << std::endl;
}
if(operations & FFmmM2P) {
// 5a W-list, M2P
timer.time([this](){this->w_list_step();});
std::cout << " M2P: " << timer.last().count() << '\n';
Timers["M2P"].tic();
this->w_list_step();
Timers["M2P"].tac();
std::cout << " M2P: " << Timers["M2P"].elapsed() << std::endl;
}
if(operations & FFmmM2L) {
// 3a V-list, M2L
timer.time([this](){this->v_list_step();});
std::cout << " M2L: " << timer.last().count() << '\n';
Timers["M2L"].tic();
this->v_list_step();
Timers["M2L"].tac();
std::cout << " M2L: " << Timers["M2L"].elapsed() << std::endl;
}
if(operations & FFmmL2L) {
// 4. down to down, L2L
timer.time([this](){this->down_to_down();});
std::cout << " L2L: " << timer.last().count() << '\n';
Timers["L2L"].tic();
this->down_to_down();
Timers["L2L"].tac();
std::cout << " L2L: " << Timers["L2L"].elapsed() << std::endl;
}
if(operations & FFmmL2P) {
// 5b down to target, L2P
timer.time([this](){this->down_to_target();});
std::cout << " L2P: " << timer.last().count() << '\n';
Timers["L2P"].tic();
this->down_to_target();
Timers["L2P"].tac();
std::cout << " L2P: " << Timers["L2P"].elapsed() << std::endl;
}
std::cout << " task created: "
<< std::accumulate(this->timer.measures().begin(),
this->timer.measures().end(),
std::chrono::duration<double>(0)).count()
<< std::accumulate(Timers.begin(), Timers.end(), 0.,
[](double & res, const typename decltype(Timers)::value_type & t)
{return res + t.second.cumulated();})
<< '\n';
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment