Maj terminée. Pour consulter la release notes associée voici le lien :
https://about.gitlab.com/releases/2021/07/07/critical-security-release-gitlab-14-0-4-released/

Commit cba7159c authored by berenger-bramas's avatar berenger-bramas
Browse files

Make the pre-computation in P2P Threaded parallel.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@129 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 4038ff37
......@@ -318,37 +318,56 @@ public:
LeafData* const leafsDataArray = new LeafData[this->leafsNumber];
const int LeafIndex = OctreeHeight - 1;
int leafs = 0;
int startPosAtShape[SizeShape];
startPosAtShape[0] = 0;
for(int idxShape = 1 ; idxShape < SizeShape ; ++idxShape){
startPosAtShape[idxShape] = startPosAtShape[idxShape-1] + this->shapeLeaf[idxShape-1];
}
#pragma omp parallel
{
int startPosAtShape[SizeShape];
startPosAtShape[0] = 0;
for(int idxShape = 1 ; idxShape < SizeShape ; ++idxShape){
startPosAtShape[idxShape] = startPosAtShape[idxShape-1] + this->shapeLeaf[idxShape-1];
}
const float step = (float(this->leafsNumber) / omp_get_num_threads());
const int start = int(FMath::Ceil(step * omp_get_thread_num()));
const int tempEnd = int(FMath::Ceil(step * (omp_get_thread_num()+1)));
const int end = (tempEnd > this->leafsNumber ? this->leafsNumber : tempEnd);
OctreeIterator octreeIterator(tree);
octreeIterator.gotoBottomLeft();
for(int idxPreLeaf = 0 ; idxPreLeaf < start ; ++idxPreLeaf){
octreeIterator.moveRight();
}
// for each leafs
do{
for(int idxMyLeafs = start ; idxMyLeafs < end ; ++idxMyLeafs){
//iterArray[leafs] = octreeIterator;
++leafs;
//++leafs;
const FTreeCoordinate& coord = octreeIterator.getCurrentGlobalCoordinate();
const int shapePosition = (coord.getX()%3)*9 + (coord.getY()%3)*3 + (coord.getZ()%3);
leafsDataArray[startPosAtShape[shapePosition]].index = octreeIterator.getCurrentGlobalIndex();
leafsDataArray[startPosAtShape[shapePosition]].cell = octreeIterator.getCurrentCell();
leafsDataArray[startPosAtShape[shapePosition]].targets = octreeIterator.getCurrentListTargets();
leafsDataArray[startPosAtShape[shapePosition]].sources = octreeIterator.getCurrentListSrc();
int positionToWork = 0;
#pragma omp critical
{
positionToWork = startPosAtShape[shapePosition]++;
}
++startPosAtShape[shapePosition];
leafsDataArray[positionToWork].index = octreeIterator.getCurrentGlobalIndex();
leafsDataArray[positionToWork].cell = octreeIterator.getCurrentCell();
leafsDataArray[positionToWork].targets = octreeIterator.getCurrentListTargets();
leafsDataArray[positionToWork].sources = octreeIterator.getCurrentListSrc();
} while(octreeIterator.moveRight());
}
octreeIterator.moveRight();
}
FDEBUG(computationCounter.tic());
#pragma omp barrier
#pragma omp master
{
FDEBUG(computationCounter.tic());
}
#pragma omp parallel
{
Kernel& myThreadkernels = (*kernels[omp_get_thread_num()]);
// There is a maximum of 26 neighbors
ContainerClass<ParticleClass>* neighbors[26];
......@@ -372,6 +391,7 @@ public:
previous = endAtThisShape;
}
}
FDEBUG(computationCounter.tac());
delete [] leafsDataArray;
......
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