Commit dc1809b4 authored by BRAMAS Berenger's avatar BRAMAS Berenger

update the transfer pass with or without finalize

parent b078ac09
......@@ -77,7 +77,7 @@ public:
*
* @return false
*/
bool needFinishedM2LEvent(){
constexpr static bool NeedFinishedM2LEvent(){
return false;
}
/** This method can be optionally inherited
......
......@@ -86,6 +86,8 @@ public:
FLOG(FLog::Controller << "FFmmAlgorithmOmp4 (Max Thread " << omp_get_max_threads() << ")\n");
FAssertLF(KernelClass::NeedFinishedM2LEvent() == false, "FFmmAlgorithmOmp4 cannot notify for M2L at level ending.");
#ifdef OPENMP_SUPPORT_PRIORITY
size_t nbLeaves = 0;
size_t nbParticles = 0;
......
......@@ -190,7 +190,7 @@ protected:
do{
// We need the current cell and the child
// child is an array (of 8 child) that may be null
#pragma omp task firstprivate(octreeIterator) shared(idxLevel)
#pragma omp task firstprivate(octreeIterator,idxLevel)
{
kernels[omp_get_thread_num()]->M2M( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
}
......@@ -218,7 +218,12 @@ protected:
eztrace_start();
#endif
this->transferPassWithFinalize() ;
if(KernelClass::NeedFinishedM2LEvent()){
this->transferPassWithFinalize() ;
}
else{
this->transferPassWithoutFinalize() ;
}
#ifdef SCALFMM_USE_EZTRACE
eztrace_stop();
#endif
......@@ -246,7 +251,7 @@ protected:
do{
const int counter = tree->getInteractionNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(), idxLevel, separationCriteria);
if(counter){
#pragma omp task firstprivate(octreeIterator, neighbors, counter) shared(idxLevel)
#pragma omp task firstprivate(octreeIterator, neighbors, counter,idxLevel)
{
kernels[omp_get_thread_num()]->M2L( octreeIterator.getCurrentCell() , neighbors, counter, idxLevel);
}
......@@ -273,6 +278,47 @@ protected:
FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" );
}
void transferPassWithoutFinalize(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
const CellClass* neighbors[343];
typename OctreeClass::Iterator octreeIterator(tree);
octreeIterator.moveDown();
for(int idxLevel = 2 ; idxLevel < FAbstractAlgorithm::upperWorkingLevel ; ++idxLevel){
octreeIterator.moveDown();
}
typename OctreeClass::Iterator avoidGotoLeftIterator(octreeIterator);
//
// for each levels
for(int idxLevel = FAbstractAlgorithm::upperWorkingLevel ; idxLevel < FAbstractAlgorithm::lowerWorkingLevel ; ++idxLevel ){
FLOG(FTic counterTimeLevel);
const int separationCriteria = (idxLevel != FAbstractAlgorithm::lowerWorkingLevel-1 ? 1 : leafLevelSeparationCriteria);
// for each cells
do{
const int counter = tree->getInteractionNeighbors(neighbors, octreeIterator.getCurrentGlobalCoordinate(), idxLevel, separationCriteria);
if(counter){
#pragma omp task firstprivate(octreeIterator, neighbors, counter,idxLevel)
{
kernels[omp_get_thread_num()]->M2L( octreeIterator.getCurrentCell() , neighbors, counter, idxLevel);
}
}
} while(octreeIterator.moveRight());
avoidGotoLeftIterator.moveDown();
octreeIterator = avoidGotoLeftIterator;
}
#pragma omp taskwait
FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = " << counterTime.tacAndElapsed() << " s)\n" );
}
/////////////////////////////////////////////////////////////////////////////
// Downward
/////////////////////////////////////////////////////////////////////////////
......@@ -296,7 +342,7 @@ protected:
FLOG(FTic counterTimeLevel);
// for each cells
do{
#pragma omp task firstprivate(octreeIterator) shared(idxLevel)
#pragma omp task firstprivate(octreeIterator,idxLevel)
{
kernels[omp_get_thread_num()]->L2L( octreeIterator.getCurrentCell() , octreeIterator.getCurrentChild(), idxLevel);
}
......
......@@ -209,18 +209,23 @@ protected:
/////////////////////////////////////////////////////////////////////////////
/** M2L */
void transferPass(){
#ifdef SCALFMM_USE_EZTRACE
eztrace_start();
#endif
this->transferPassWithFinalize() ;
#ifdef SCALFMM_USE_EZTRACE
eztrace_stop();
#endif
}
void transferPassWithOutFinalize(){
void transferPass(){
#ifdef SCALFMM_USE_EZTRACE
eztrace_start();
#endif
if(KernelClass::NeedFinishedM2LEvent()){
this->transferPassWithFinalize() ;
}
else{
this->transferPassWithoutFinalize() ;
}
#ifdef SCALFMM_USE_EZTRACE
eztrace_stop();
#endif
}
void transferPassWithoutFinalize(){
FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
FLOG(FTic counterTime);
......
......@@ -859,7 +859,7 @@ protected:
#pragma omp taskwait
for(int idxThread = 0 ; idxThread < omp_get_num_threads() ; ++idxThread){
#pragma omp task default(none) firstprivate(idxThread) shared(idxLevel)
#pragma omp task default(none) firstprivate(idxThread,idxLevel)
{
kernels[idxThread]->finishedLevelM2L(idxLevel);
}
......
......@@ -960,7 +960,7 @@ protected:
#pragma omp taskwait
for(int idxThread = 0 ; idxThread < omp_get_num_threads() ; ++idxThread){
#pragma omp task default(none) firstprivate(idxThread) shared(idxLevel)
#pragma omp task default(none) firstprivate(idxThread,idxLevel)
{
kernels[idxThread]->finishedLevelM2L(fackLevel);
}
......
......@@ -189,7 +189,7 @@ public:
}
}
/** the needFinishedM2LEvent method is needed */
bool needFinishedM2LEvent(){
constexpr static bool NeedFinishedM2LEvent(){
return true ;
}
/** Do we have some computation to do in the buffers */
......
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