Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

FFmmAlgorithmThread.hpp 18.5 KB
Newer Older
1
// ===================================================================================
2
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas, Matthias Messner
3 4 5 6
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
7 8
// abiding by the rules of distribution of free software.
//
9 10 11 12
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public and CeCILL-C Licenses for more details.
13
// "http://www.cecill.info".
14
// "http://www.gnu.org/licenses".
15
// ===================================================================================
16 17
#ifndef FFMMALGORITHMTHREAD_HPP
#define FFMMALGORITHMTHREAD_HPP
18

19

BRAMAS Berenger's avatar
BRAMAS Berenger committed
20
#include "../Utils/FAssert.hpp"
BRAMAS Berenger's avatar
BRAMAS Berenger committed
21
#include "../Utils/FLog.hpp"
22

23 24
#include "../Utils/FTic.hpp"
#include "../Utils/FGlobal.hpp"
25
#include "Utils/FAlgorithmTimers.hpp"
26 27 28

#include "../Containers/FOctree.hpp"

29
#include "FCoreCommon.hpp"
30 31 32 33 34 35 36 37 38 39 40 41 42 43

#include <omp.h>

/**
* @author Berenger Bramas (berenger.bramas@inria.fr)
* @class FFmmAlgorithmThread
* @brief
* Please read the license
*
* This class is a threaded FMM algorithm
* It just iterates on a tree and call the kernels with good arguments.
* It used the inspector-executor model :
* iterates on the tree and builds an array to work in parallel on this array
*
COULAUD Olivier's avatar
COULAUD Olivier committed
44
* Of course this class does not deallocate pointer given in arguments.
45
*
berenger-bramas's avatar
berenger-bramas committed
46
* When using this algorithm the P2P is thread safe.
47
*/
48
template<class OctreeClass, class CellClass, class ContainerClass, class KernelClass, class LeafClass>
49
class FFmmAlgorithmThread : public FAbstractAlgorithm, public FAlgorithmTimers{
berenger-bramas's avatar
berenger-bramas committed
50 51
    OctreeClass* const tree;                  //< The octree to work on
    KernelClass** kernels;                    //< The kernels
52

berenger-bramas's avatar
berenger-bramas committed
53
    typename OctreeClass::Iterator* iterArray;
54
    int leafsNumber;
55 56

    static const int SizeShape = 3*3*3;
57
    int shapeLeaf[SizeShape];
berenger-bramas's avatar
berenger-bramas committed
58 59

    const int MaxThreads;
60

61 62
    const int OctreeHeight;

63 64 65 66 67 68
public:
    /** The constructor need the octree and the kernels used for computation
      * @param inTree the octree to work on
      * @param inKernels the kernels to call
      * An assert is launched if one of the arguments is null
      */
berenger-bramas's avatar
berenger-bramas committed
69
    FFmmAlgorithmThread(OctreeClass* const inTree, KernelClass* const inKernels)
70
        : tree(inTree) , kernels(nullptr), iterArray(nullptr), leafsNumber(0),
71
          MaxThreads(omp_get_max_threads()), OctreeHeight(tree->getHeight()) {
72

BRAMAS Berenger's avatar
BRAMAS Berenger committed
73
        FAssertLF(tree, "tree cannot be null");
74

berenger-bramas's avatar
berenger-bramas committed
75
        this->kernels = new KernelClass*[MaxThreads];
76
        #pragma omp parallel for schedule(static)
berenger-bramas's avatar
berenger-bramas committed
77
        for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
78
            #pragma omp critical (InitFFmmAlgorithmThread)
79 80 81
            {
                this->kernels[idxThread] = new KernelClass(*inKernels);
            }
82 83
        }

84 85
        FAbstractAlgorithm::setNbLevelsInTree(tree->getHeight());

BRAMAS Berenger's avatar
BRAMAS Berenger committed
86
        FLOG(FLog::Controller << "FFmmAlgorithmThread (Max Thread " << omp_get_max_threads() << ")\n");
87 88 89 90
    }

    /** Default destructor */
    virtual ~FFmmAlgorithmThread(){
berenger-bramas's avatar
berenger-bramas committed
91
        for(int idxThread = 0 ; idxThread < MaxThreads ; ++idxThread){
92 93
            delete this->kernels[idxThread];
        }
berenger-bramas's avatar
berenger-bramas committed
94
        delete [] this->kernels;
95 96
    }

97
protected:
98 99 100 101
    /**
      * To execute the fmm algorithm
      * Call this function to run the complete algorithm
      */
102
    void executeCore(const unsigned operationsToProceed) override {
103 104 105 106 107 108

        for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
            this->shapeLeaf[idxShape] = 0;
        }

        // Count leaf
109
        leafsNumber = 0;
berenger-bramas's avatar
berenger-bramas committed
110
        typename OctreeClass::Iterator octreeIterator(tree);
111 112
        octreeIterator.gotoBottomLeft();
        do{
113
            ++leafsNumber;
114
            const FTreeCoordinate& coord = octreeIterator.getCurrentCell()->getCoordinate();
115 116 117
            ++this->shapeLeaf[(coord.getX()%3)*9 + (coord.getY()%3)*3 + (coord.getZ()%3)];

        } while(octreeIterator.moveRight());
berenger-bramas's avatar
berenger-bramas committed
118
        iterArray = new typename OctreeClass::Iterator[leafsNumber];
BRAMAS Berenger's avatar
BRAMAS Berenger committed
119
        FAssertLF(iterArray, "iterArray bad alloc");
120

121
        Timers[P2MTimer].tic();
122
        if(operationsToProceed & FFmmP2M) bottomPass();
123
        Timers[P2MTimer].tac();
124

125
        Timers[M2MTimer].tic();
126
        if(operationsToProceed & FFmmM2M) upwardPass();
127
        Timers[M2MTimer].tac();
128

129
        Timers[M2LTimer].tic();
130
        if(operationsToProceed & FFmmM2L) transferPass();
131
        Timers[M2LTimer].tac();
132

133
        Timers[L2LTimer].tic();
134
        if(operationsToProceed & FFmmL2L) downardPass();
135
        Timers[L2LTimer].tac();
136

137 138 139
        Timers[NearTimer].tic();
        if( (operationsToProceed & FFmmP2P) || (operationsToProceed & FFmmL2P) ) directPass((operationsToProceed & FFmmP2P),(operationsToProceed & FFmmL2P));
        Timers[NearTimer].tac();
140 141

        delete [] iterArray;
142
        iterArray = nullptr;
143 144
    }

berenger-bramas's avatar
berenger-bramas committed
145 146 147 148
    /////////////////////////////////////////////////////////////////////////////
    // P2M
    /////////////////////////////////////////////////////////////////////////////

149 150
    /** P2M */
    void bottomPass(){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
151
        FLOG( FLog::Controller.write("\tStart Bottom Pass\n").write(FLog::Flush) );
BRAMAS Berenger's avatar
BRAMAS Berenger committed
152
        FLOG(FTic counterTime);
153

berenger-bramas's avatar
berenger-bramas committed
154
        typename OctreeClass::Iterator octreeIterator(tree);
155 156 157 158 159 160 161 162
        int leafs = 0;
        // Iterate on leafs
        octreeIterator.gotoBottomLeft();
        do{
            iterArray[leafs] = octreeIterator;
            ++leafs;
        } while(octreeIterator.moveRight());

163 164
        const int chunkSize = FMath::Max(1 , leafs/(omp_get_max_threads()*omp_get_max_threads()));

BRAMAS Berenger's avatar
BRAMAS Berenger committed
165
        FLOG(FTic computationCounter);
BRAMAS Berenger's avatar
BRAMAS Berenger committed
166
        #pragma omp parallel
167
        {
berenger-bramas's avatar
berenger-bramas committed
168
            KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
169
            #pragma omp for nowait schedule(dynamic, chunkSize)
170 171 172 173 174 175
            for(int idxLeafs = 0 ; idxLeafs < leafs ; ++idxLeafs){
                // We need the current cell that represent the leaf
                // and the list of particles
                myThreadkernels->P2M( iterArray[idxLeafs].getCurrentCell() , iterArray[idxLeafs].getCurrentListSrc());
            }
        }
BRAMAS Berenger's avatar
BRAMAS Berenger committed
176
        FLOG(computationCounter.tac() );
177

BRAMAS Berenger's avatar
BRAMAS Berenger committed
178 179
        FLOG( FLog::Controller << "\tFinished (@Bottom Pass (P2M) = "  << counterTime.tacAndElapsed() << "s)\n" );
        FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.elapsed() << " s\n" );
180

181 182
    }

berenger-bramas's avatar
berenger-bramas committed
183 184 185 186
    /////////////////////////////////////////////////////////////////////////////
    // Upward
    /////////////////////////////////////////////////////////////////////////////

187 188
    /** M2M */
    void upwardPass(){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
189
        FLOG( FLog::Controller.write("\tStart Upward Pass\n").write(FLog::Flush); );
BRAMAS Berenger's avatar
BRAMAS Berenger committed
190 191
        FLOG(FTic counterTime);
        FLOG(FTic computationCounter);
192 193

        // Start from leal level - 1
berenger-bramas's avatar
berenger-bramas committed
194
        typename OctreeClass::Iterator octreeIterator(tree);
195 196
        octreeIterator.gotoBottomLeft();
        octreeIterator.moveUp();
197 198 199 200 201

        for(int idxLevel = OctreeHeight - 2 ; idxLevel > FAbstractAlgorithm::lowerWorkingLevel-2 ; --idxLevel){
            octreeIterator.moveUp();
        }

berenger-bramas's avatar
berenger-bramas committed
202
        typename OctreeClass::Iterator avoidGotoLeftIterator(octreeIterator);
203 204

        // for each levels
205
        for(int idxLevel = FAbstractAlgorithm::lowerWorkingLevel - 2 ; idxLevel >= FAbstractAlgorithm::upperWorkingLevel ; --idxLevel ){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
206
            FLOG(FTic counterTimeLevel);
207
            int numberOfCells = 0;
208 209
            // for each cells
            do{
210 211
                iterArray[numberOfCells] = octreeIterator;
                ++numberOfCells;
212 213 214 215
            } while(octreeIterator.moveRight());
            avoidGotoLeftIterator.moveUp();
            octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft();

216 217
            const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));

BRAMAS Berenger's avatar
BRAMAS Berenger committed
218
            FLOG(computationCounter.tic());
219
            #pragma omp parallel
220
            {
berenger-bramas's avatar
berenger-bramas committed
221
                KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
222
                #pragma omp for nowait  schedule(dynamic, chunkSize)
223
                for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
224 225
                    // We need the current cell and the child
                    // child is an array (of 8 child) that may be null
226
                    myThreadkernels->M2M( iterArray[idxCell].getCurrentCell() , iterArray[idxCell].getCurrentChild(), idxLevel);
227 228
                }
            }
berenger-bramas's avatar
berenger-bramas committed
229

BRAMAS Berenger's avatar
BRAMAS Berenger committed
230
            FLOG(computationCounter.tac());
BRAMAS Berenger's avatar
BRAMAS Berenger committed
231
            FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = "  << counterTimeLevel.tacAndElapsed() << "s\n" );
232 233
        }

berenger-bramas's avatar
berenger-bramas committed
234

BRAMAS Berenger's avatar
BRAMAS Berenger committed
235 236
        FLOG( FLog::Controller << "\tFinished (@Upward Pass (M2M) = "  << counterTime.tacAndElapsed() << "s)\n" );
        FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
237

238 239
    }

berenger-bramas's avatar
berenger-bramas committed
240
    /////////////////////////////////////////////////////////////////////////////
241
    // Transfer
berenger-bramas's avatar
berenger-bramas committed
242 243
    /////////////////////////////////////////////////////////////////////////////

244
    /** M2L L2L */
245
    void transferPass(){
246

BRAMAS Berenger's avatar
BRAMAS Berenger committed
247
        FLOG( FLog::Controller.write("\tStart Downward Pass (M2L)\n").write(FLog::Flush); );
BRAMAS Berenger's avatar
BRAMAS Berenger committed
248 249
        FLOG(FTic counterTime);
        FLOG(FTic computationCounter);
berenger-bramas's avatar
berenger-bramas committed
250

251 252
        typename OctreeClass::Iterator octreeIterator(tree);
        octreeIterator.moveDown();
253

254
        for(int idxLevel = 2 ; idxLevel < FAbstractAlgorithm::upperWorkingLevel ; ++idxLevel){
255 256 257
            octreeIterator.moveDown();
        }

258 259 260
        typename OctreeClass::Iterator avoidGotoLeftIterator(octreeIterator);

        // for each levels
261
        for(int idxLevel = FAbstractAlgorithm::upperWorkingLevel ; idxLevel < FAbstractAlgorithm::lowerWorkingLevel ; ++idxLevel ){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
262
            FLOG(FTic counterTimeLevel);
263 264 265 266 267 268 269 270 271
            int numberOfCells = 0;
            // for each cells
            do{
                iterArray[numberOfCells] = octreeIterator;
                ++numberOfCells;
            } while(octreeIterator.moveRight());
            avoidGotoLeftIterator.moveDown();
            octreeIterator = avoidGotoLeftIterator;

272 273
            const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));

BRAMAS Berenger's avatar
BRAMAS Berenger committed
274
            FLOG(computationCounter.tic());
275
            #pragma omp parallel
276 277
            {
                KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
278
                const CellClass* neighbors[343];
279

280
                #pragma omp for  schedule(dynamic, chunkSize) nowait
281
                for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
282
                    const int counter = tree->getInteractionNeighbors(neighbors,  iterArray[idxCell].getCurrentGlobalCoordinate(),idxLevel);
283
                    if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, counter, idxLevel);
284
                }
285 286

                myThreadkernels->finishedLevelM2L(idxLevel);
287
            }
BRAMAS Berenger's avatar
BRAMAS Berenger committed
288
            FLOG(computationCounter.tac());
BRAMAS Berenger's avatar
BRAMAS Berenger committed
289
            FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = "  << counterTimeLevel.tacAndElapsed() << "s\n" );
290 291
        }

BRAMAS Berenger's avatar
BRAMAS Berenger committed
292 293
        FLOG( FLog::Controller << "\tFinished (@Downward Pass (M2L) = "  << counterTime.tacAndElapsed() << "s)\n" );
        FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
294
    }
berenger-bramas's avatar
berenger-bramas committed
295

296
    /////////////////////////////////////////////////////////////////////////////
COULAUD Olivier's avatar
COULAUD Olivier committed
297
    // Downward
298 299 300 301
    /////////////////////////////////////////////////////////////////////////////

    void downardPass(){ // second L2L

BRAMAS Berenger's avatar
BRAMAS Berenger committed
302
        FLOG( FLog::Controller.write("\tStart Downward Pass (L2L)\n").write(FLog::Flush); );
BRAMAS Berenger's avatar
BRAMAS Berenger committed
303 304
        FLOG(FTic counterTime);
        FLOG(FTic computationCounter);
305 306 307 308

        typename OctreeClass::Iterator octreeIterator(tree);
        octreeIterator.moveDown();

309
        for(int idxLevel = 2 ; idxLevel < FAbstractAlgorithm::upperWorkingLevel ; ++idxLevel){
310 311 312
            octreeIterator.moveDown();
        }

313 314
        typename OctreeClass::Iterator avoidGotoLeftIterator(octreeIterator);

315
        const int heightMinusOne = FAbstractAlgorithm::lowerWorkingLevel - 1;
COULAUD Olivier's avatar
COULAUD Olivier committed
316
        // for each levels excepted leaf level
317
        for(int idxLevel = FAbstractAlgorithm::upperWorkingLevel ; idxLevel < heightMinusOne ; ++idxLevel ){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
318
            FLOG(FTic counterTimeLevel);
319 320 321 322 323 324 325 326 327
            int numberOfCells = 0;
            // for each cells
            do{
                iterArray[numberOfCells] = octreeIterator;
                ++numberOfCells;
            } while(octreeIterator.moveRight());
            avoidGotoLeftIterator.moveDown();
            octreeIterator = avoidGotoLeftIterator;

BRAMAS Berenger's avatar
BRAMAS Berenger committed
328
            FLOG(computationCounter.tic());
329
            const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
330
            #pragma omp parallel
331 332
            {
                KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
333
                #pragma omp for nowait schedule(dynamic, chunkSize)
334 335
                for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
                    myThreadkernels->L2L( iterArray[idxCell].getCurrentCell() , iterArray[idxCell].getCurrentChild(), idxLevel);
336 337
                }
            }
BRAMAS Berenger's avatar
BRAMAS Berenger committed
338
            FLOG(computationCounter.tac());
BRAMAS Berenger's avatar
BRAMAS Berenger committed
339
            FLOG( FLog::Controller << "\t\t>> Level " << idxLevel << " = "  << counterTimeLevel.tacAndElapsed() << "s\n" );
340 341
        }

BRAMAS Berenger's avatar
BRAMAS Berenger committed
342 343
        FLOG( FLog::Controller << "\tFinished (@Downward Pass (L2L) = "  << counterTime.tacAndElapsed() << "s)\n" );
        FLOG( FLog::Controller << "\t\t Computation : " << computationCounter.cumulated() << " s\n" );
344 345
    }

346 347


berenger-bramas's avatar
berenger-bramas committed
348 349 350 351
    /////////////////////////////////////////////////////////////////////////////
    // Direct
    /////////////////////////////////////////////////////////////////////////////

352
    /** P2P */
353
    void directPass(const bool p2pEnabled, const bool l2pEnabled){
BRAMAS Berenger's avatar
BRAMAS Berenger committed
354
        FLOG( FLog::Controller.write("\tStart Direct Pass\n").write(FLog::Flush); );
BRAMAS Berenger's avatar
BRAMAS Berenger committed
355 356 357
        FLOG(FTic counterTime);
        FLOG(FTic computationCounter);
        FLOG(FTic computationCounterP2P);
358

359
        omp_lock_t lockShape[SizeShape];
360
        for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
361
            omp_init_lock(&lockShape[idxShape]);
362 363
        }

364 365 366
        struct LeafData{
            MortonIndex index;
            CellClass* cell;
berenger-bramas's avatar
berenger-bramas committed
367 368
            ContainerClass* targets;
            ContainerClass* sources;
369 370 371
        };
        LeafData* const leafsDataArray = new LeafData[this->leafsNumber];

372
        const int LeafIndex = OctreeHeight - 1;
373 374 375 376 377 378 379

        int startPosAtShape[SizeShape];
        startPosAtShape[0] = 0;
        for(int idxShape = 1 ; idxShape < SizeShape ; ++idxShape){
            startPosAtShape[idxShape] = startPosAtShape[idxShape-1] + this->shapeLeaf[idxShape-1];
        }

380
        #pragma omp parallel
381
        {
382

383 384 385
            const float step = float(this->leafsNumber) / float(omp_get_num_threads());
            const int start = int(FMath::Ceil(step * float(omp_get_thread_num())));
            const int tempEnd = int(FMath::Ceil(step * float(omp_get_thread_num()+1)));
386
            const int end = (tempEnd > this->leafsNumber ? this->leafsNumber : tempEnd);
387

berenger-bramas's avatar
berenger-bramas committed
388
            typename OctreeClass::Iterator octreeIterator(tree);
389
            octreeIterator.gotoBottomLeft();
390 391 392 393 394

            for(int idxPreLeaf = 0 ; idxPreLeaf < start ; ++idxPreLeaf){
                octreeIterator.moveRight();
            }

395
            // for each leafs
396
            for(int idxMyLeafs = start ; idxMyLeafs < end ; ++idxMyLeafs){
397
                //iterArray[leafs] = octreeIterator;
398
                //++leafs;
399
                const FTreeCoordinate& coord = octreeIterator.getCurrentGlobalCoordinate();
400
                const int shapePosition = (coord.getX()%3)*9 + (coord.getY()%3)*3 + (coord.getZ()%3);
401

402 403 404
                omp_set_lock(&lockShape[shapePosition]);
                const int positionToWork = startPosAtShape[shapePosition]++;
                omp_unset_lock(&lockShape[shapePosition]);
405

COULAUD Olivier's avatar
COULAUD Olivier committed
406 407
                leafsDataArray[positionToWork].index   = octreeIterator.getCurrentGlobalIndex();
                leafsDataArray[positionToWork].cell    = octreeIterator.getCurrentCell();
408 409
                leafsDataArray[positionToWork].targets = octreeIterator.getCurrentListTargets();
                leafsDataArray[positionToWork].sources = octreeIterator.getCurrentListSrc();
410

411 412
                octreeIterator.moveRight();
            }
413

414
            #pragma omp barrier
415

BRAMAS Berenger's avatar
BRAMAS Berenger committed
416
            FLOG(if(!omp_get_thread_num()) computationCounter.tic());
417

berenger-bramas's avatar
berenger-bramas committed
418
            KernelClass& myThreadkernels = (*kernels[omp_get_thread_num()]);
419
            // There is a maximum of 26 neighbors
berenger-bramas's avatar
berenger-bramas committed
420
            ContainerClass* neighbors[27];
421
            int previous = 0;
422 423

            for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
424
                const int endAtThisShape = this->shapeLeaf[idxShape] + previous;
425 426
                const int chunkSize = FMath::Max(1 , endAtThisShape/(omp_get_num_threads()*omp_get_num_threads()));
                #pragma omp for schedule(dynamic, chunkSize)
427 428
                for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; ++idxLeafs){
                    LeafData& currentIter = leafsDataArray[idxLeafs];
429 430 431 432 433 434 435 436 437 438 439
                    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);
                        myThreadkernels.P2P(currentIter.cell->getCoordinate(), currentIter.targets,
                                            currentIter.sources, neighbors, counter);
                        FLOG(if(!omp_get_thread_num()) computationCounterP2P.tac());
                    }
440
                }
441 442

                previous = endAtThisShape;
443 444
            }
        }
445

BRAMAS Berenger's avatar
BRAMAS Berenger committed
446
        FLOG(computationCounter.tac());
447

448
        delete [] leafsDataArray;
449 450 451 452
        for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
            omp_destroy_lock(&lockShape[idxShape]);
        }

453

BRAMAS Berenger's avatar
BRAMAS Berenger committed
454
        FLOG( FLog::Controller << "\tFinished (@Direct Pass (L2P + P2P) = "  << counterTime.tacAndElapsed() << "s)\n" );
COULAUD Olivier's avatar
COULAUD Olivier committed
455 456
        FLOG( FLog::Controller << "\t\t Computation L2P + P2P : " << computationCounter.cumulated()    << " s\n" );
        FLOG( FLog::Controller << "\t\t Computation P2P :       " << computationCounterP2P.cumulated() << " s\n" );
457

458 459 460 461 462 463
    }

};


#endif //FFMMALGORITHMTHREAD_HPP