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).

Commit dde626f2 authored by BRAMAS Berenger's avatar BRAMAS Berenger
Browse files

Put a good chunk size for the threaded only algorithm (but need some test)

parent 8af35e2b
......@@ -143,11 +143,13 @@ private:
++leafs;
} while(octreeIterator.moveRight());
const int chunkSize = FMath::Max(1 , leafs/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(FTic computationCounter);
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait schedule(dynamic, 50)
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxLeafs = 0 ; idxLeafs < leafs ; ++idxLeafs){
// We need the current cell that represent the leaf
// and the list of particles
......@@ -189,11 +191,13 @@ private:
avoidGotoLeftIterator.moveUp();
octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft();
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(computationCounter.tic());
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait schedule(dynamic, 50)
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
// We need the current cell and the child
// child is an array (of 8 child) that may be null
......@@ -238,13 +242,15 @@ private:
avoidGotoLeftIterator.moveDown();
octreeIterator = avoidGotoLeftIterator;
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(computationCounter.tic());
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
const CellClass* neighbors[343];
#pragma omp for schedule(dynamic, 50) nowait
#pragma omp for schedule(dynamic, chunkSize) nowait
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
const int counter = tree->getInteractionNeighbors(neighbors, iterArray[idxCell].getCurrentGlobalCoordinate(),idxLevel);
if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, counter, idxLevel);
......@@ -289,10 +295,11 @@ private:
octreeIterator = avoidGotoLeftIterator;
FLOG(computationCounter.tic());
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait schedule(dynamic, 50)
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
myThreadkernels->L2L( iterArray[idxCell].getCurrentCell() , iterArray[idxCell].getCurrentChild(), idxLevel);
}
......@@ -384,8 +391,8 @@ private:
for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
const int endAtThisShape = this->shapeLeaf[idxShape] + previous;
#pragma omp for schedule(dynamic, 50)
const int chunkSize = FMath::Max(1 , endAtThisShape/(omp_get_num_threads()*omp_get_num_threads()));
#pragma omp for schedule(dynamic, chunkSize)
for(int idxLeafs = previous ; idxLeafs < endAtThisShape ; ++idxLeafs){
LeafData& currentIter = leafsDataArray[idxLeafs];
myThreadkernels.L2P(currentIter.cell, currentIter.targets);
......
......@@ -128,11 +128,13 @@ public:
++numberOfLeafs;
} while(octreeIterator.moveRight());
const int chunkSize = FMath::Max(1 , numberOfLeafs/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(FTic computationCounter);
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxLeafs = 0 ; idxLeafs < numberOfLeafs ; ++idxLeafs){
// We need the current cell that represent the leaf
// and the list of particles
......@@ -178,11 +180,13 @@ public:
avoidGotoLeftIterator.moveUp();
octreeIterator = avoidGotoLeftIterator;// equal octreeIterator.moveUp(); octreeIterator.gotoLeft();
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(computationCounter.tic());
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
// We need the current cell and the child
// child is an array (of 8 child) that may be null
......@@ -236,13 +240,15 @@ public:
avoidGotoLeftIterator.moveDown();
octreeIterator = avoidGotoLeftIterator;
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(computationCounter.tic());
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
const CellClass* neighbors[343];
#pragma omp for schedule(dynamic) nowait
#pragma omp for schedule(dynamic, chunkSize) nowait
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
CellClass* const currentCell = iterArray[idxCell].getCurrentCell();
if(currentCell->hasTargetsChild()){
......@@ -299,11 +305,13 @@ public:
avoidGotoLeftIterator.moveDown();
octreeIterator = avoidGotoLeftIterator;
const int chunkSize = FMath::Max(1 , numberOfCells/(omp_get_max_threads()*omp_get_max_threads()));
FLOG(computationCounter.tic());
#pragma omp parallel
{
KernelClass * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp for nowait
#pragma omp for nowait schedule(dynamic, chunkSize)
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
if( iterArray[idxCell].getCurrentCell()->hasTargetsChild() ){
CellClass* potentialChild[8];
......@@ -345,6 +353,8 @@ public:
} while(octreeIterator.moveRight());
}
const int chunkSize = FMath::Max(1 , numberOfLeafs/(omp_get_max_threads()*omp_get_max_threads()));
const int heightMinusOne = OctreeHeight - 1;
FLOG(FTic computationCounter);
#pragma omp parallel
......@@ -353,7 +363,7 @@ public:
// There is a maximum of 26 neighbors
ContainerClass* neighbors[27];
#pragma omp for schedule(dynamic) nowait
#pragma omp for schedule(dynamic, chunkSize) nowait
for(int idxLeafs = 0 ; idxLeafs < numberOfLeafs ; ++idxLeafs){
if( iterArray[idxLeafs].getCurrentCell()->hasTargetsChild() ){
myThreadkernels->L2P(iterArray[idxLeafs].getCurrentCell(), iterArray[idxLeafs].getCurrentListTargets());
......
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