Commit 0b6ed9f6 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Add a test to do only P2P or L2P in Algorithm

parent 8b2baebb
......@@ -79,7 +79,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if( (operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P) ) directPass();
if( (operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P) ) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
}
private:
......@@ -236,7 +236,7 @@ private:
/////////////////////////////////////////////////////////////////////////////
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounterL2P);
......@@ -250,15 +250,19 @@ private:
ContainerClass* neighbors[27];
// for each leafs
do{
if(l2pEnabled){
FLOG(computationCounterL2P.tic());
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentListTargets());
FLOG(computationCounterL2P.tac());
}
if(p2pEnabled){
// need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(),heightMinusOne);
FLOG(computationCounterP2P.tic());
kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(),
octreeIterator.getCurrentListSrc(), neighbors, counter);
FLOG(computationCounterP2P.tac());
}
} while(octreeIterator.moveRight());
......
......@@ -97,7 +97,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
}
......@@ -247,7 +247,7 @@ public:
/////////////////////////////////////////////////////////////////////////////
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounterL2P);
......@@ -264,10 +264,12 @@ public:
bool hasPeriodicLeaves;
// for each leafs
do{
if(l2pEnabled){
FLOG(computationCounterL2P.tic());
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentListTargets());
FLOG(computationCounterL2P.tac());
}
if(p2pEnabled){
// need the current particles and neighbors particles
const FTreeCoordinate centerOfLeaf = octreeIterator.getCurrentGlobalCoordinate();
const int counter = tree->getPeriodicLeafsNeighbors( neighbors, offsets, &hasPeriodicLeaves, centerOfLeaf, heightMinusOne, AllDirs);
......@@ -320,8 +322,7 @@ public:
kernels->P2P(octreeIterator.getCurrentGlobalCoordinate(),octreeIterator.getCurrentListTargets(),
octreeIterator.getCurrentListSrc(), neighbors, counter - periodicNeighborsCounter);
FLOG(computationCounterP2P.tac());
}
} while(octreeIterator.moveRight());
......
......@@ -94,7 +94,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
}
private:
......@@ -281,7 +281,7 @@ private:
/////////////////////////////////////////////////////////////////////////////
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounter);
......@@ -317,14 +317,18 @@ private:
const int nbLeaf = shapes[idxShape].getSize();
for(int iterLeaf = 0 ; iterLeaf < nbLeaf ; ++iterLeaf ){
typename OctreeClass::Iterator toWork = shapes[idxShape][iterLeaf];
#pragma omp task firstprivate(neighbors, toWork)
#pragma omp task firstprivate(neighbors, toWork, l2pEnabled, p2pEnabled)
{
if(l2pEnabled){
kernels[omp_get_thread_num()]->L2P(toWork.getCurrentCell(), toWork.getCurrentListTargets());
}
if(p2pEnabled){
const int counter = tree->getLeafsNeighbors(neighbors, toWork.getCurrentGlobalCoordinate(),heightMinusOne);
kernels[omp_get_thread_num()]->P2P(toWork.getCurrentGlobalCoordinate(), toWork.getCurrentListTargets(),
toWork.getCurrentListSrc(), neighbors, counter);
}
}
}
#pragma omp taskwait
}
......
......@@ -119,7 +119,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
delete [] iterArray;
iterArray = nullptr;
......@@ -320,7 +320,7 @@ private:
/////////////////////////////////////////////////////////////////////////////
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
FLOG(FTic computationCounter);
......@@ -396,7 +396,10 @@ private:
#pragma omp for schedule(dynamic, chunkSize)
for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; ++idxLeafs){
LeafData& currentIter = leafsDataArray[idxLeafs];
if(l2pEnabled){
myThreadkernels.L2P(currentIter.cell, currentIter.targets);
}
if(p2pEnabled){
// need the current particles and neighbors particles
FLOG(if(!omp_get_thread_num()) computationCounterP2P.tic());
const int counter = tree->getLeafsNeighbors(neighbors, currentIter.cell->getCoordinate(), LeafIndex);
......@@ -404,6 +407,7 @@ private:
currentIter.sources, neighbors, counter);
FLOG(if(!omp_get_thread_num()) computationCounterP2P.tac());
}
}
previous = endAtThisShape;
}
......
......@@ -247,7 +247,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
// delete array
......@@ -1082,7 +1082,7 @@ private:
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG( FTic counterTime);
FLOG( FTic prepareCounter);
......@@ -1139,7 +1139,7 @@ private:
#pragma omp parallel
{
#pragma omp master // MUST WAIT to fill leafsNeedOther
{
if(p2pEnabled){
// Copy leafs
{
typename OctreeClass::Iterator octreeIterator(tree);
......@@ -1203,7 +1203,7 @@ private:
#pragma omp barrier
#pragma omp master // nowait
{
if(p2pEnabled){
//Share to all processus globalReceiveMap
FLOG(gatherCounter.tic());
FMpi::MpiAssert( MPI_Allgather( partsToSend, nbProcess, MPI_INT, globalReceiveMap, nbProcess, MPI_INT, comm.getComm()), __LINE__ );
......@@ -1338,8 +1338,10 @@ private:
for(int idxTaskLeaf = idxLeafs ; idxTaskLeaf < (idxLeafs + nbLeavesInTask) ; ++idxTaskLeaf){
LeafData& currentIter = leafsDataArray[idxTaskLeaf];
if(l2pEnabled){
myThreadkernels->L2P(currentIter.cell, currentIter.targets);
}
if(p2pEnabled){
// need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, currentIter.coord, LeafIndex);
myThreadkernels->P2P( currentIter.coord,currentIter.targets,
......@@ -1347,6 +1349,7 @@ private:
}
}
}
}
previous = endAtThisShape;
#pragma omp taskwait
......@@ -1365,7 +1368,7 @@ private:
#pragma omp master
{ FLOG( computation2Counter.tic() ); }
{
if(p2pEnabled){
KernelClass& myThreadkernels = (*kernels[omp_get_thread_num()]);
// There is a maximum of 26 neighbors
ContainerClass* neighbors[27];
......
......@@ -246,7 +246,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
// delete array
......@@ -1204,7 +1204,7 @@ private:
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG( FTic counterTime);
FLOG( FTic prepareCounter);
......@@ -1261,7 +1261,7 @@ private:
#pragma omp parallel
{
#pragma omp master // MUST WAIT to fill leafsNeedOther
{
if(p2pEnabled){
// Copy leafs
{
typename OctreeClass::Iterator octreeIterator(tree);
......@@ -1327,7 +1327,7 @@ private:
#pragma omp barrier
#pragma omp master // nowait
{
if(p2pEnabled){
//Share to all processus globalReceiveMap
FLOG(gatherCounter.tic());
FMpi::MpiAssert( MPI_Allgather( partsToSend, nbProcess, MPI_INT, globalReceiveMap, nbProcess, MPI_INT, comm.getComm()), __LINE__ );
......@@ -1465,7 +1465,10 @@ private:
bool hasPeriodicLeaves;
for(int idxTaskLeaf = idxLeafs ; idxTaskLeaf < (idxLeafs + nbLeavesInTask) ; ++idxTaskLeaf){
LeafData& currentIter = leafsDataArray[idxTaskLeaf];
if(l2pEnabled){
myThreadkernels->L2P(currentIter.cell, currentIter.targets);
}
if(p2pEnabled){
// need the current particles and neighbors particles
const int counter = tree->getPeriodicLeafsNeighbors(neighbors, offsets, &hasPeriodicLeaves,
currentIter.coord, LeafIndex, AllDirs);
......@@ -1515,6 +1518,7 @@ private:
myThreadkernels->P2P( currentIter.coord, currentIter.targets,
currentIter.sources, neighbors, counter - periodicNeighborsCounter);
}
}
}
}
......@@ -1537,7 +1541,7 @@ private:
#pragma omp master
{ FLOG( computation2Counter.tic() ); }
{
if(p2pEnabled){
KernelClass& myThreadkernels = (*kernels[omp_get_thread_num()]);
// There is a maximum of 26 neighbors
ContainerClass* neighbors[27];
......
......@@ -107,7 +107,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
delete [] iterArray;
iterArray = nullptr;
......@@ -339,7 +339,7 @@ public:
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......@@ -367,7 +367,10 @@ public:
#pragma omp for schedule(dynamic, chunkSize) nowait
for(int idxLeafs = 0 ; idxLeafs < numberOfLeafs ; ++idxLeafs){
if( iterArray[idxLeafs].getCurrentCell()->hasTargetsChild() ){
if(l2pEnabled){
myThreadkernels->L2P(iterArray[idxLeafs].getCurrentCell(), iterArray[idxLeafs].getCurrentListTargets());
}
if(p2pEnabled){
// need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, iterArray[idxLeafs].getCurrentGlobalCoordinate(),heightMinusOne);
neighbors[13] = iterArray[idxLeafs].getCurrentListSrc();
......@@ -376,6 +379,7 @@ public:
}
}
}
}
FLOG(computationCounter.tac());
FLOG( counterTime.tac() );
......
......@@ -82,7 +82,7 @@ public:
if(operationsToProceed & FFmmL2L) downardPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass();
if((operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P)) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
}
/** P2M */
......@@ -276,7 +276,7 @@ public:
/** P2P */
void directPass(){
void directPass(const bool p2pEnabled, const bool l2pEnabled){
FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
FLOG( counterTime.tic() );
FLOG( double totalComputation = 0 );
......@@ -291,12 +291,16 @@ public:
do{
if( octreeIterator.getCurrentCell()->hasTargetsChild() ){
FLOG(computationCounter.tic());
if(l2pEnabled){
kernels->L2P(octreeIterator.getCurrentCell(), octreeIterator.getCurrentListTargets());
}
if(p2pEnabled){
// need the current particles and neighbors particles
const int counter = tree->getLeafsNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(), heightMinusOne);
neighbors[13] = octreeIterator.getCurrentListSrc();
kernels->P2PRemote( octreeIterator.getCurrentGlobalCoordinate(), octreeIterator.getCurrentListTargets(),
octreeIterator.getCurrentListSrc() , neighbors, counter + 1);
}
FLOG(computationCounter.tac());
FLOG(totalComputation += computationCounter.elapsed());
}
......
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