Commit 8ad76e38 authored by berenger-bramas's avatar berenger-bramas
Browse files

Rename fmm thread file name

and have created a basic mpi version just for fun.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@52 2616d619-271b-44dc-8df4-d4a8f33a7222
parent f8addfdf
#ifndef FFmmALGORITHM_HPP
#define FFmmALGORITHM_HPP
#ifndef FFMMALGORITHM_HPP
#define FFMMALGORITHM_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/FAssertable.hpp"
......@@ -232,6 +232,6 @@ public:
};
#endif //FFmmALGORITHM_HPP
#endif //FFMMALGORITHM_HPP
// [--LICENSE--]
#ifndef FFmmALGORITHMARRAY_HPP
#define FFmmALGORITHMARRAY_HPP
#ifndef FFMMALGORITHMTHREAD_HPP
#define FFMMALGORITHMTHREAD_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/FAssertable.hpp"
......@@ -15,7 +15,7 @@
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmArray
* @class FFmmAlgorithmThread
* @brief
* Please read the license
*
......@@ -33,7 +33,7 @@ template<template< class ParticleClass, class CellClass, int OctreeHeight> class
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
class FFmmAlgorithmArray : protected FAssertable{
class FFmmAlgorithmThread : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
......@@ -56,7 +56,7 @@ public:
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmArray(Octree* const inTree, Kernel* const inKernels)
FFmmAlgorithmThread(Octree* const inTree, Kernel* const inKernels)
: tree(inTree) , iterArray(0) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
......@@ -66,11 +66,11 @@ public:
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmArray\n");
FDEBUG(FDebug::Controller << "FFmmAlgorithmThread\n");
}
/** Default destructor */
virtual ~FFmmAlgorithmArray(){
virtual ~FFmmAlgorithmThread(){
for(int idxThread = 0 ; idxThread < FThreadNumbers ; ++idxThread){
delete this->kernels[idxThread];
}
......@@ -347,6 +347,6 @@ public:
};
#endif //FFmmALGORITHMARRAY_HPP
#endif //FFMMALGORITHMTHREAD_HPP
// [--LICENSE--]
This diff is collapsed.
#ifndef FFmmALGORITHMARRAYTSM_HPP
#define FFmmALGORITHMARRAYTSM_HPP
#ifndef FFMMALGORITHMTHREADTSM_HPP
#define FFMMALGORITHMTHREADTSM_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/FAssertable.hpp"
......@@ -15,7 +15,7 @@
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmArrayTsm
* @class FFmmAlgorithmThreadTsm
* @brief
* Please read the license
*
......@@ -33,7 +33,7 @@ template<template< class ParticleClass, class CellClass, int OctreeHeight> class
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
class FFmmAlgorithmArrayTsm : protected FAssertable{
class FFmmAlgorithmThreadTsm : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
......@@ -53,7 +53,7 @@ public:
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmArrayTsm(Octree* const inTree, Kernel* const inKernels)
FFmmAlgorithmThreadTsm(Octree* const inTree, Kernel* const inKernels)
: tree(inTree) , iterArray(0) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
......@@ -63,11 +63,11 @@ public:
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmArrayTsm\n");
FDEBUG(FDebug::Controller << "FFmmAlgorithmThreadTsm\n");
}
/** Default destructor */
virtual ~FFmmAlgorithmArrayTsm(){
virtual ~FFmmAlgorithmThreadTsm(){
for(int idxThread = 0 ; idxThread < FThreadNumbers ; ++idxThread){
delete this->kernels[idxThread];
}
......@@ -362,6 +362,6 @@ public:
};
#endif //FFmmALGORITHMARRAYTSM_HPP
#endif //FFMMALGORITHMTHREADTSM_HPP
// [--LICENSE--]
#ifndef FFmmALGORITHMARRAYUS_HPP
#define FFmmALGORITHMARRAYUS_HPP
#ifndef FFMMALGORITHMTHREADUS_HPP
#define FFMMALGORITHMTHREADUS_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/FAssertable.hpp"
......@@ -15,7 +15,7 @@
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmArrayUs
* @class FFmmAlgorithmThreadUs
* @brief
* Please read the license
*
......@@ -33,7 +33,7 @@ template<template< class ParticleClass, class CellClass, int OctreeHeight> class
class ParticleClass, class CellClass,
template<class ParticleClass> class LeafClass,
int OctreeHeight, int SubtreeHeight>
class FFmmAlgorithmArrayUs : protected FAssertable{
class FFmmAlgorithmThreadUs : protected FAssertable{
// To reduce the size of variable type based on foctree in this file
typedef FOctree<ParticleClass, CellClass, LeafClass, OctreeHeight, SubtreeHeight> Octree;
typedef typename FOctree<ParticleClass, CellClass,LeafClass, OctreeHeight, SubtreeHeight>::Iterator OctreeIterator;
......@@ -53,7 +53,7 @@ public:
* @param inKernels the kernels to call
* An assert is launched if one of the arguments is null
*/
FFmmAlgorithmArrayUs(Octree* const inTree, Kernel* const inKernels)
FFmmAlgorithmThreadUs(Octree* const inTree, Kernel* const inKernels)
: tree(inTree) , iterArray(0) {
assert(tree, "tree cannot be null", __LINE__, __FILE__);
......@@ -63,11 +63,11 @@ public:
this->kernels[idxThread] = new KernelClass<ParticleClass, CellClass, OctreeHeight>(*inKernels);
}
FDEBUG(FDebug::Controller << "FFmmAlgorithmArrayUs\n");
FDEBUG(FDebug::Controller << "FFmmAlgorithmThreadUs\n");
}
/** Default destructor */
virtual ~FFmmAlgorithmArrayUs(){
virtual ~FFmmAlgorithmThreadUs(){
for(int idxThread = 0 ; idxThread < FThreadNumbers ; ++idxThread){
delete this->kernels[idxThread];
}
......@@ -313,6 +313,6 @@ public:
};
#endif //FFmmALGORITHMARRAYUS_HPP
#endif //FFMMALGORITHMTHREADUS_HPP
// [--LICENSE--]
#ifndef FFmmALGORITHMTSM_HPP
#define FFmmALGORITHMTSM_HPP
#ifndef FFMMALGORITHMTSM_HPP
#define FFMMALGORITHMTSM_HPP
// /!\ Please, you must read the license at the bottom of this page
#include "../Utils/FAssertable.hpp"
......@@ -283,6 +283,6 @@ public:
};
#endif //FFmmALGORITHMTSM_HPP
#endif //FFMMALGORITHMTSM_HPP
// [--LICENSE--]
This diff is collapsed.
......@@ -46,6 +46,16 @@ protected:
*/
virtual void initSlave(){}
/**
* Send data to another process
*/
virtual void sendData(const int inReceiver, const int inSize, void* const inData, const int inTag) = 0;
/**
* Receive from any process
*/
virtual void receiveData(const int inSize, void* const inData, int* const inSource, int* const inTag, int* const inFilledSize) = 0;
private:
/** Forbiden (private) default constructor */
......
......@@ -29,7 +29,7 @@
// MPI
///////////////////////////////////////////////////////
//#define FUSE_MPI
#define FUSE_MPI
///////////////////////////////////////////////////////
// Threads
......
......@@ -28,6 +28,19 @@ protected:
virtual void run() = 0;
void sendData(const int inReceiver, const int inSize, void* const inData, const int inTag){
MPI_Request request;
MPI_Isend(inData, inSize, MPI_CHAR , inReceiver, inTag, MPI_COMM_WORLD, &request);
}
void receiveData(const int inSize, void* const inData, int* const inSource, int* const inTag, int* const inFilledSize){
MPI_Status status;
MPI_Recv(inData, inSize, MPI_CHAR, MPI_ANY_SOURCE, MPI_ANY_TAG,MPI_COMM_WORLD, &status);
*inSource = status.MPI_SOURCE;
*inTag = status.MPI_TAG;
MPI_Get_count(&status,MPI_CHAR,inFilledSize);
}
public:
/**
* Constructor
......
......@@ -29,6 +29,15 @@ protected:
*/
virtual void run() = 0;
void sendData(const int, const int, void* const, const int ){
}
void receiveData(const int, void* const, int* const inSource, int* const inTag, int* const inFilledSize){
*inSource = 0;
*inTag = 0;
*inFilledSize = 0;
}
public:
/**
......
......@@ -18,8 +18,8 @@
#include "../Sources/Fmb/FExtendFmbCell.hpp"
#include "../Sources/Core/FFmmAlgorithm.hpp"
#include "../Sources/Core/FFmmAlgorithmArray.hpp"
#include "../Sources/Core/FFmmAlgorithmArrayUs.hpp"
#include "../Sources/Core/FFmmAlgorithmThread.hpp"
#include "../Sources/Core/FFmmAlgorithmThreadUs.hpp"
#include "../Sources/Components/FSimpleLeaf.hpp"
......@@ -115,8 +115,8 @@ int main(int argc, char ** argv){
counter.tic();
FFmbKernels<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmArray FFmmAlgorithmTask FFmmAlgorithmArrayUs
FFmmAlgorithmArrayUs<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask FFmmAlgorithmThreadUs
FFmmAlgorithmThreadUs<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
......@@ -18,7 +18,7 @@
#include "../Sources/Fmb/FExtendFmbCell.hpp"
#include "../Sources/Core/FFmmAlgorithm.hpp"
#include "../Sources/Core/FFmmAlgorithmArray.hpp"
#include "../Sources/Core/FFmmAlgorithmThread.hpp"
#include "../Sources/Components/FSimpleLeaf.hpp"
......@@ -118,7 +118,7 @@ int main(int argc, char ** argv){
//FFmbKernelsBlas FFmbKernels
FFmbKernelsBlas<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmArray FFmmAlgorithmTask
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask
FFmmAlgorithm<FFmbKernelsBlas, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
......
......@@ -20,7 +20,7 @@
#include "../Sources/Fmb/FExtendFmbCell.hpp"
#include "../Sources/Core/FFmmAlgorithm.hpp"
#include "../Sources/Core/FFmmAlgorithmArray.hpp"
#include "../Sources/Core/FFmmAlgorithmThread.hpp"
#include "../Sources/Components/FSimpleLeaf.hpp"
......@@ -116,7 +116,7 @@ int main(int argc, char ** argv){
counter.tic();
FFmbKernels<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmArray FFmmAlgorithmTask
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask
FFmmAlgorithm<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
......
......@@ -23,8 +23,8 @@
#include "../Sources/Core/FFmmAlgorithm.hpp"
#include "../Sources/Core/FFmmAlgorithmTsm.hpp"
#include "../Sources/Core/FFmmAlgorithmArray.hpp"
#include "../Sources/Core/FFmmAlgorithmArrayTsm.hpp"
#include "../Sources/Core/FFmmAlgorithmThread.hpp"
#include "../Sources/Core/FFmmAlgorithmThreadTsm.hpp"
#include "../Sources/Components/FSimpleLeaf.hpp"
#include "../Sources/Components/FTypedLeaf.hpp"
......@@ -130,9 +130,9 @@ int main(int argc, char ** argv){
FFmbKernels<FmbParticle, FmbCell, NbLevels> kernels(BoxWidth);
FFmbKernels<FmbParticleTyped, FmbCellTyped, NbLevels> kernelsTyped(BoxWidth);
//FFmmAlgorithm FFmmAlgorithmArray
FFmmAlgorithmArray<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
FFmmAlgorithmArrayTsm<FFmbKernels, FmbParticleTyped, FmbCellTyped, FTypedLeaf, NbLevels, SizeSubLevels> algoTyped(&treeTyped,&kernelsTyped);
//FFmmAlgorithm FFmmAlgorithmThread
FFmmAlgorithmThread<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
FFmmAlgorithmThreadTsm<FFmbKernels, FmbParticleTyped, FmbCellTyped, FTypedLeaf, NbLevels, SizeSubLevels> algoTyped(&treeTyped,&kernelsTyped);
algo.execute();
algoTyped.execute();
......
......@@ -19,7 +19,7 @@
#include "../Sources/Components/FTestKernels.hpp"
#include "../Sources/Core/FFmmAlgorithm.hpp"
#include "../Sources/Core/FFmmAlgorithmArray.hpp"
#include "../Sources/Core/FFmmAlgorithmThread.hpp"
#include "../Sources/Components/FBasicKernels.hpp"
......@@ -82,8 +82,8 @@ int main(int argc, char ** argv){
// FTestKernels FBasicKernels
FTestKernels<FTestParticle, FTestCell, NbLevels> kernels;
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmArray FFmmAlgorithmTask
FFmmAlgorithmArray<FTestKernels, FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
//FFmmAlgorithm FFmmAlgorithmThread
FFmmAlgorithmThread<FTestKernels, FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......@@ -98,9 +98,6 @@ int main(int argc, char ** argv){
//////////////////////////////////////////////////////////////////////////////////
std::cout << "Deleting particles ..." << std::endl;
counter.tic();
for(long idxPart = 0 ; idxPart < NbPart ; ++idxPart){
particles[idxPart].~FTestParticle();
}
delete [] particles;
counter.tac();
std::cout << "Done " << "(" << counter.elapsed() << "s)." << std::endl;
......
......@@ -22,7 +22,7 @@
#include "../Sources/Extenssions/FExtendCellType.hpp"
#include "../Sources/Core/FFmmAlgorithmTsm.hpp"
#include "../Sources/Core/FFmmAlgorithmArrayTsm.hpp"
#include "../Sources/Core/FFmmAlgorithmThreadTsm.hpp"
#include "../Sources/Components/FBasicKernels.hpp"
......@@ -90,8 +90,8 @@ int main(int argc, char ** argv){
// FTestKernels FBasicKernels
FTestKernels<FTestParticleTsm, FTestCellTsm, NbLevels> kernels;
//FFmmAlgorithmTsm FFmmAlgorithmArrayTsm
FFmmAlgorithmArrayTsm<FTestKernels, FTestParticleTsm, FTestCellTsm, FTypedLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
//FFmmAlgorithmTsm FFmmAlgorithmThreadTsm
FFmmAlgorithmThreadTsm<FTestKernels, FTestParticleTsm, FTestCellTsm, FTypedLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
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