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