Commit e2d240c5 authored by Quentin Khan's avatar Quentin Khan

Adaptive algorithms: fix kernel setup method detection

parent 2c5ef5d6
......@@ -34,11 +34,16 @@ private:
>::type*;
template<typename K, has_setup<K, void> = nullptr>
void setup_kernel() {
template<typename K, has_setup<K, void, tree_t> = nullptr>
void setup_kernel(K&) {
_kernel.setup(_tree);
}
template<typename K, has_setup<K, void> = nullptr>
void setup_kernel(K&) {
_kernel.setup();
}
void setup_kernel(...) {}
public:
......@@ -68,7 +73,7 @@ public:
std::cout << "Sequential algorithm" << std::endl;
this->setup_kernel();
this->setup_kernel(this->_kernel);
if(operations & FFmmP2M) {
// 1. source to up, P2M
......
......@@ -47,11 +47,14 @@ protected:
>::type*;
template<typename K, has_setup<K, void, tree_t> = nullptr>
void setup_kernel(K& kernel) {
kernel.setup(_tree);
}
template<typename K, has_setup<K, void> = nullptr>
void setup_kernel() {
for(auto& kernel : this->_kernels) {
kernel->setup(_tree);
}
void setup_kernel(K& kernel) {
kernel.setup();
}
void setup_kernel(...) {}
......@@ -107,10 +110,11 @@ public:
void run(int operations = FFmmNearAndFarFields) {
this->setup_kernel();
#pragma omp parallel
{
this->setup_kernel(*(this->_kernels[omp_get_thread_num()]));
#pragma omp barrier
#pragma omp single nowait
{
std::cout << "Task adaptive algorithm (" << omp_get_num_threads() << " threads)" << std::endl;
......
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