Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 28cc32a6 authored by berenger-bramas's avatar berenger-bramas
Browse files

Update of the P2P and extensions.

In Extesions we previously return object instead of ref for F3DPosition
Now this is ref (it seems that the compiler already did this because the efficiency is unchanged).

The P2P time contains L2P.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@95 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 8db0160a
......@@ -58,6 +58,13 @@ public:
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
virtual void P2P(const MortonIndex,
FList<ParticleClass*>* const FRestrict, const FList<ParticleClass*>* const FRestrict,
FList<ParticleClass*>* FRestrict const* FRestrict, MortonIndex const* FRestrict, const int){
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
};
......
......@@ -220,15 +220,16 @@ public:
octreeIterator.gotoBottomLeft();
// There is a maximum of 26 neighbors
FList<ParticleClass*>* neighbors[26];
MortonIndex neighborsIndex[26];
// for each leafs
do{
FDEBUG(computationCounter.tic());
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentListTargets());
FDEBUG(computationCounter.tac());
// need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),heightMinusOne);
const int counter = tree->getLeafsNeighborsWithIndex(neighbors,neighborsIndex, octreeIterator.getCurrentGlobalIndex(),heightMinusOne);
FDEBUG(computationCounter.tic());
kernels->P2P( octreeIterator.getCurrentListTargets(), octreeIterator.getCurrentListSrc() , neighbors, counter);
kernels->P2P(octreeIterator.getCurrentGlobalIndex(),octreeIterator.getCurrentListTargets(), octreeIterator.getCurrentListSrc() , neighbors, neighborsIndex,counter);
FDEBUG(computationCounter.tac());
} while(octreeIterator.moveRight());
......
......@@ -37,7 +37,7 @@ public:
}
/** Return the forces */
F3DPosition getForces() const {
const F3DPosition& getForces() const {
return this->forces;
}
......
......@@ -36,7 +36,7 @@ public:
}
/** To get the position */
F3DPosition getPosition() const {
const F3DPosition& getPosition() const {
return this->position;
}
......
......@@ -17,7 +17,7 @@
// P is a input parameter
static const int FMB_Info_P = 2;
static const int FMB_Info_P = 6;
/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
......@@ -1342,8 +1342,8 @@ public:
if(inCurrentIndex < inNeighborsIndex[idxDirectNeighbors] ){
typename FList<ParticleClass*>::BasicIterator iterSource(*directNeighbors[idxDirectNeighbors]);
while( iterSource.isValide() ){
DIRECT_COMPUTATION_MUTUAL_SOFT(&iterTarget.value(),
&iterSource.value());
DIRECT_COMPUTATION_MUTUAL_SOFT(iterTarget.value(),
iterSource.value());
iterSource.progress();
}
}
......@@ -1353,8 +1353,8 @@ public:
iterSameBox.progress();
while( iterSameBox.isValide() ){
if(iterSameBox.value() < iterTarget.value()){
DIRECT_COMPUTATION_MUTUAL_SOFT(&iterTarget.value(),
&iterSameBox.value());
DIRECT_COMPUTATION_MUTUAL_SOFT(iterTarget.value(),
iterSameBox.value());
}
iterSameBox.progress();
}
......@@ -1369,30 +1369,30 @@ public:
}
void DIRECT_COMPUTATION_MUTUAL_SOFT(ParticleClass** const target, ParticleClass** const source){
void DIRECT_COMPUTATION_MUTUAL_SOFT(ParticleClass* const FRestrict target, ParticleClass* const FRestrict source){
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
const FReal dx = (*target)->getPosition().getX() - (*source)->getPosition().getX();
const FReal dy = (*target)->getPosition().getY() - (*source)->getPosition().getY();
const FReal dz = (*target)->getPosition().getZ() - (*source)->getPosition().getZ();
const FReal dx = (*target).getPosition().getX() - (*source).getPosition().getX();
const FReal dy = (*target).getPosition().getY() - (*source).getPosition().getY();
const FReal dz = (*target).getPosition().getZ() - (*source).getPosition().getZ();
FReal inv_square_distance = 1.0/ (dx*dx + dy*dy + dz*dz + FMB_Info_eps_soft_square);
FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_distance *= (*target)->getPhysicalValue() * (*source)->getPhysicalValue();
inv_distance *= (*target).getPhysicalValue() * (*source).getPhysicalValue();
inv_square_distance *= inv_distance;
(*target)->setForces(
(*target)->getForces().getX() + dx * inv_square_distance,
(*target)->getForces().getY() + dy * inv_square_distance,
(*target)->getForces().getZ() + dz * inv_square_distance
(*target).setForces(
(*target).getForces().getX() + dx * inv_square_distance,
(*target).getForces().getY() + dy * inv_square_distance,
(*target).getForces().getZ() + dz * inv_square_distance
);
(*target)->setPotential( inv_distance + (*target)->getPotential());
(*target).setPotential( inv_distance + (*target).getPotential());
(*source)->setForces(
(*source)->getForces().getX() + (-dx) * inv_square_distance,
(*source)->getForces().getY() + (-dy) * inv_square_distance,
(*source)->getForces().getZ() + (-dz) * inv_square_distance
(*source).setForces(
(*source).getForces().getX() + (-dx) * inv_square_distance,
(*source).getForces().getY() + (-dy) * inv_square_distance,
(*source).getForces().getZ() + (-dz) * inv_square_distance
);
(*source)->setPotential( inv_distance + (*source)->getPotential());
(*source).setPotential( inv_distance + (*source).getPotential());
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
......@@ -1418,7 +1418,7 @@ public:
for(int idxDirectNeighbors = 0 ; idxDirectNeighbors < size ; ++idxDirectNeighbors){
typename FList<ParticleClass*>::ConstBasicIterator iterSource(*directNeighbors[idxDirectNeighbors]);
while( iterSource.isValide() ){
DIRECT_COMPUTATION_NO_MUTUAL_SOFT(&iterTarget.value(),
DIRECT_COMPUTATION_NO_MUTUAL_SOFT(iterTarget.value(),
iterSource.value());
iterSource.progress();
}
......@@ -1427,7 +1427,7 @@ public:
typename FList<ParticleClass*>::ConstBasicIterator iterSameBox(*sources);
while( iterSameBox.isValide() ){
if(iterSameBox.value() != iterTarget.value()){
DIRECT_COMPUTATION_NO_MUTUAL_SOFT(&iterTarget.value(),
DIRECT_COMPUTATION_NO_MUTUAL_SOFT(iterTarget.value(),
iterSameBox.value());
}
iterSameBox.progress();
......@@ -1443,24 +1443,24 @@ public:
}
void DIRECT_COMPUTATION_NO_MUTUAL_SOFT(ParticleClass** const target, const ParticleClass* const source){
void DIRECT_COMPUTATION_NO_MUTUAL_SOFT(ParticleClass* const FRestrict target, const ParticleClass* const FRestrict source){
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
const FReal dx = (*target)->getPosition().getX() - source->getPosition().getX();
const FReal dy = (*target)->getPosition().getY() - source->getPosition().getY();
const FReal dz = (*target)->getPosition().getZ() - source->getPosition().getZ();
const FReal dx = target->getPosition().getX() - source->getPosition().getX();
const FReal dy = target->getPosition().getY() - source->getPosition().getY();
const FReal dz = target->getPosition().getZ() - source->getPosition().getZ();
FReal inv_square_distance = 1.0/ (dx*dx + dy*dy + dz*dz + FMB_Info_eps_soft_square);
FReal inv_distance = FMath::Sqrt(inv_square_distance);
inv_distance *= (*target)->getPhysicalValue() * source->getPhysicalValue();
inv_distance *= target->getPhysicalValue() * source->getPhysicalValue();
inv_square_distance *= inv_distance;
(*target)->setForces(
(*target)->getForces().getX() + dx * inv_square_distance,
(*target)->getForces().getY() + dy * inv_square_distance,
(*target)->getForces().getZ() + dz * inv_square_distance
target->setForces(
target->getForces().getX() + dx * inv_square_distance,
target->getForces().getY() + dy * inv_square_distance,
target->getForces().getZ() + dz * inv_square_distance
);
(*target)->setPotential( inv_distance + (*target)->getPotential());
target->setPotential( inv_distance + target->getPotential());
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
};
......
......@@ -22,6 +22,8 @@
#include "../Src/Core/FFmmAlgorithmThreadUs.hpp"
#include "../Src/Components/FSimpleLeaf.hpp"
#include "../Src/Components/FBasicKernels.hpp"
#include "../Src/Fmb/FFmbKernels.hpp"
......@@ -59,7 +61,7 @@ int main(int argc, char ** argv){
std::cout << ">> This executable has to be used to test fmb algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = 9;//10;
const int NbLevels = 7;//10;
const int SizeSubLevels = 3;//3
FTic counter;
const char* const defaultFilename = "testLoaderFMA.fma"; //../../Data/ "testLoaderFMA.fma" "testFMAlgorithm.fma" Sphere.fma
......@@ -115,8 +117,9 @@ int main(int argc, char ** argv){
counter.tic();
FFmbKernels<FmbParticle, FmbCell, NbLevels> kernels(loader.getBoxWidth());
//FFmmAlgorithm FFmmAlgorithmThreaded FFmmAlgorithmThread FFmmAlgorithmTask FFmmAlgorithmThreadUs
FFmmAlgorithmThread<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
//FBasicKernels<FmbParticle, FmbCell, NbLevels> kernels;
//FFmmAlgorithm FFmmAlgorithmThread FFmmAlgorithmThreadUs
FFmmAlgorithm<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
......@@ -38,9 +38,9 @@ int main(int argc, char ** argv){
std::cout << ">> This executable has to be used to test the FMM algorithm.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = 10;//10;
const int NbLevels = 6;//10;
const int SizeSubLevels = 3;//3
const long NbPart = 2000;//2000000
const long NbPart = 200000;//2000000
FTestParticle* particles = new FTestParticle[NbPart];
FTic counter;
......@@ -83,7 +83,7 @@ int main(int argc, char ** argv){
// FTestKernels FBasicKernels
FTestKernels<FTestParticle, FTestCell, NbLevels> kernels;
//FFmmAlgorithm FFmmAlgorithmThread
FFmmAlgorithm<FTestKernels, FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
FFmmAlgorithmThread<FTestKernels, FTestParticle, FTestCell, FSimpleLeaf, NbLevels, SizeSubLevels> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
......@@ -45,7 +45,7 @@ int main(int argc, char ** argv){
std::cout << ">> This executable has to be used to show some stat about the tree.\n";
//////////////////////////////////////////////////////////////
const int NbLevels = 9;//10;
const int NbLevels = 7;//10;
const int SizeSubLevels = 3;//3
FTic counter;
const char* const defaultFilename = "testLoaderFMA.fma"; //../../Data/ "testLoaderFMA.fma" "testFMAlgorithm.fma" Sphere.fma
......
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