Commit 671265a7 authored by Quentin Khan's avatar Quentin Khan
Browse files

FFmmAlgorithm(Task,Thread,Omp4): implement FAlgorithmInterface methods

The methods `name` and `description` are implemented.
parent 5cd5748f
......@@ -50,7 +50,7 @@ class FFmmAlgorithm : public FAbstractAlgorithm, public FAlgorithmTimers {
const int leafLevelSeparationCriteria;
public:
/** Class constructor
*
*
* The constructor needs the octree and the kernels used for computation.
* @param inTree the octree to work on.
* @param inKernels the kernels to call.
......@@ -73,6 +73,15 @@ public:
virtual ~FFmmAlgorithm(){
}
virtual std::string name() const override {
return "sequential uniform algorithm";
}
virtual std::string description() const override {
return "";
}
protected:
/**
* Runs the complete algorithm.
......
#ifndef FFMMALGORITHMOMP4_HPP
#define FFMMALGORITHMOMP4_HPP
#include <omp.h>
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssert.hpp"
#include "../Utils/FLog.hpp"
......@@ -161,6 +163,22 @@ public:
delete [] this->kernels;
}
std::string name() const override {
return "OpenMP 4 task adaptive algorithm";
}
std::string description() const override {
int threads = 1;
#pragma omp parallel shared(threads)
{
#pragma omp single nowait
{
threads = omp_get_max_threads();
}
}
return std::string("threads: ") + std::to_string(threads);
}
protected:
const unsigned char* getCellMultipoleDepPtr(const CellClass* taskCell) const {
......@@ -1007,4 +1025,3 @@ protected:
#endif // FFMMALGORITHMOMP4_HPP
......@@ -4,18 +4,19 @@
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
#ifndef FFMMALGORITHMTASK_HPP
#define FFMMALGORITHMTASK_HPP
#include <omp.h>
#include "../Utils/FGlobal.hpp"
#include "../Utils/FAssert.hpp"
......@@ -23,6 +24,7 @@
#include "../Utils/FEnv.hpp"
#include "../Utils/FTic.hpp"
#include "../Utils/FAlgorithmTimers.hpp"
#include "../Containers/FOctree.hpp"
#include "../Containers/FVector.hpp"
......@@ -89,6 +91,22 @@ public:
delete [] this->kernels;
}
std::string name() const override {
return "Task adaptive algorithm";
}
std::string description() const override {
int threads = 1;
#pragma omp parallel shared(threads)
{
#pragma omp single nowait
{
threads = omp_get_max_threads();
}
}
return std::string("threads: ") + std::to_string(threads);
}
protected:
/**
* To execute the fmm algorithm
......@@ -446,5 +464,3 @@ protected:
#endif //FFMMALGORITHMTASK_HPP
......@@ -108,7 +108,23 @@ public:
}
delete [] this->kernels;
}
virtual std::string name() const override {
return "threaded uniform algorithm";
}
virtual std::string description() const override {
std::string res("threads: ");
#pragma omp parallel
{
#pragma omp single
{
res += std::to_string(omp_get_num_threads());
}
}
return res;
}
template <class NumType>
NumType getChunkSize(const NumType inSize) const {
if(userChunkSize <= -1){
......
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