Commit 99450164 authored by BRAMAS Berenger's avatar BRAMAS Berenger
parents 3af79557 c96c1f40
......@@ -12,10 +12,16 @@
#include "Core/FFmmAlgorithmThread.hpp"
/**
* \brief Algorithm loader for FFmmAlgorithmThread
*
* See FAlgoLoader.
*/
template <class _TreeLoader, template<typename> class _KernelLoader>
class AlgoLoaderThread : public FAlgoLoader<_TreeLoader, _KernelLoader> {
public:
// Type definitions, allows them to be reused by other classes
using TreeLoader = _TreeLoader;
using KernelLoader = _KernelLoader<TreeLoader>;
......@@ -26,14 +32,18 @@ public:
using OctreeClass = typename TreeLoader::OctreeClass;
using KernelClass = typename KernelLoader::KernelClass;
/// FMM algorithm class
using FMMClass = FFmmAlgorithmThread<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>;
/// The tree loader (FTreeLoader) that was used
TreeLoader& _treeLoader;
/// The kernel loader (FKernelLoader) that was used
KernelLoader& _kernelLoader;
bool _omp_static_schedule;
unsigned int _omp_chunk_size;
unsigned int _omp_chunk_size; ///< Chunk size for OpenMP
/// The #FMMClass algorithm instance
std::unique_ptr<FMMClass> _algo;
AlgoLoaderThread(FPerfTestParams& params,
......@@ -41,7 +51,6 @@ public:
KernelLoader& kernelLoader) :
_treeLoader(treeLoader),
_kernelLoader(kernelLoader),
_omp_static_schedule(params.omp_static_schedule),
_omp_chunk_size(params.omp_chunk_size),
_algo(nullptr) {
......
// ==== CMAKE ====
// Keep in private GIT
// @SCALFMM_PRIVATE
#ifndef _ALGOLOADERTHREADBALANCE_HPP_
#define _ALGOLOADERTHREADBALANCE_HPP_
#include <memory>
#include <sstream>
#include "PerfTestUtils.hpp"
#include "Core/FFmmAlgorithmThreadBalance.hpp"
template <class _TreeLoader, template<typename> class _KernelLoader>
class AlgoLoaderThreadBalance : public FAlgoLoader<_TreeLoader, _KernelLoader> {
public:
using TreeLoader = _TreeLoader;
using KernelLoader = _KernelLoader<TreeLoader>;
using FReal = typename TreeLoader::FReal;
using CellClass = typename TreeLoader::CellClass;
using ContainerClass = typename TreeLoader::ContainerClass;
using LeafClass = typename TreeLoader::LeafClass;
using OctreeClass = typename TreeLoader::OctreeClass;
using KernelClass = typename KernelLoader::KernelClass;
using FMMClass = FFmmAlgorithmThreadBalance<OctreeClass, CellClass, ContainerClass, KernelClass, LeafClass>;
TreeLoader& _treeLoader;
KernelLoader& _kernelLoader;
std::unique_ptr<FMMClass> _algo;
AlgoLoaderThreadBalance(FPerfTestParams& params,
TreeLoader& treeLoader,
KernelLoader& kernelLoader) :
_treeLoader(treeLoader),
_kernelLoader(kernelLoader),
_algo(nullptr) {
}
void run() {
_algo = std::unique_ptr<FMMClass>(
new FMMClass(&(_treeLoader._tree), &(_kernelLoader._kernel)));
_algo->execute();
}
virtual std::string getRunInfoString() const {
return "";
}
};
#endif
......@@ -31,6 +31,7 @@
#include "AlgoLoaderTask.hpp"
#include "AlgoLoaderSectionTask.hpp"
#include "AlgoLoaderCostZones.hpp"
#include "AlgoLoaderThreadBalance.hpp"
/**
* \brief Runs a generic sequence of actions to use an algorithm.
......@@ -80,6 +81,8 @@ namespace ParName {
int main (int argc, char** argv)
{
// Parameter handling //////////////
FHelpDescribeAndExit(argc, argv,
"Driver for Chebyshev interpolation kernel (1/r kernel).",
FParameterDefinitions::InputFile,
......@@ -99,10 +102,9 @@ int main (int argc, char** argv)
params.subTreeHeight = getValue(argc, argv, OctreeSubHeight.options, 2);
params.nbThreads = getValue(argc, argv, NbThreads.options, 1);
params.algo = getStr(argc,argv,ParName::Algo.options,"task");
params.omp_static_schedule =
getStr(argc,argv,ParName::Schedule.options,"dynamic") == std::string("static");
params.omp_chunk_size = getValue(argc, argv, ParName::ChunkSize.options, 0);
}
// End of Parameter handling ///////
omp_set_num_threads(params.nbThreads);
......@@ -114,6 +116,8 @@ int main (int argc, char** argv)
runperf<TreeLoaderFCheb<>, KernelLoaderFChebSym, AlgoLoaderCostZones>(params);
} else if ( "sectiontask" == params.algo ) {
runperf<TreeLoaderFCheb<>, KernelLoaderFChebSym, AlgoLoaderSectionTask>(params);
} else if ( "autobalance" == params.algo ) {
runperf<TreeLoaderFCheb<>, KernelLoaderFChebSym, AlgoLoaderThreadBalance>(params);
} else {
std::cout << "Unknown algorithm: " << params.algo << std::endl;
}
......
......@@ -21,8 +21,7 @@ struct FPerfTestParams {
int nbThreads = 1; ///< Maximum number of threads (when used).
std::string filename = ""; ///< Particles file.
std::string algo = "task"; ///< Algorithm to run.
bool omp_static_schedule = false; ///< OpenMP static or dynamic schedule.
int omp_chunk_size = 0;
int omp_chunk_size = 0; ///< OpenMP chunk size for basic algorithm (FFmmAlgorithmThread)
};
......
......@@ -13,7 +13,7 @@
#include <vector>
/**
* \brief Saves the far-field costzones to files.
* \brief Saves the far field costzones to files.
*
* One file is created per level, one particle is stored per line in the form :
* x,y,z,zone.
......@@ -91,7 +91,6 @@ void loadTree(OctreeClass& tree, FFmaGenericLoader<FReal>& loader)
}
}
/**
* \brief Loads a tree from a loader.
* \param tree The the to load into.
......@@ -108,11 +107,16 @@ void loadTree(OctreeClass& tree, FRandomLoader<FReal>& loader)
}
}
/**
* \brief Prints the costzones costs.
* \brief Prints the cost of each zone.
*
* This function prints the far-field and near-field costzones costs to stdout.
* The costs are printed using the format :
* zone_number far_field_cost near_field_cost
*
* \param tree The tree.
* \param costzones The FCostZones object that was used to compute the zones.
*/
template <typename OctreeClass, typename CellClass>
void printZonesCosts(OctreeClass& tree, FCostZones<OctreeClass, CellClass>& costzones)
......@@ -188,7 +192,6 @@ void printZonesCosts(OctreeClass& tree, FCostZones<OctreeClass, CellClass>& cost
zoneIdx++;
}
zoneIdx = 0;
for(auto z : zonecosts) {
std::cout << "@@"
......
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