Une nouvelle version du portail de gestion des comptes externes sera mise en production lundi 09 août. Elle permettra d'allonger la validité d'un compte externe jusqu'à 3 ans. Pour plus de détails sur cette version consulter : https://doc-si.inria.fr/x/FCeS

Commit 69274c7e authored by berenger-bramas's avatar berenger-bramas
Browse files

Change the critical section into mutex array.

Now, the threads are blocking the groups they want to write into
(not all the write).

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@134 2616d619-271b-44dc-8df4-d4a8f33a7222
parent 21680271
......@@ -305,8 +305,10 @@ public:
FDEBUG(FTic computationCounterP2P);
int countShape[SizeShape];
omp_lock_t lockShape[SizeShape];
for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
countShape[idxShape] = 0;
omp_init_lock(&lockShape[idxShape]);
}
struct LeafData{
......@@ -347,11 +349,9 @@ public:
const FTreeCoordinate& coord = octreeIterator.getCurrentGlobalCoordinate();
const int shapePosition = (coord.getX()%3)*9 + (coord.getY()%3)*3 + (coord.getZ()%3);
int positionToWork = 0;
#pragma omp critical
{
positionToWork = startPosAtShape[shapePosition]++;
}
omp_set_lock(&lockShape[shapePosition]);
const int positionToWork = startPosAtShape[shapePosition]++;
omp_unset_lock(&lockShape[shapePosition]);
leafsDataArray[positionToWork].index = octreeIterator.getCurrentGlobalIndex();
leafsDataArray[positionToWork].cell = octreeIterator.getCurrentCell();
......@@ -392,6 +392,10 @@ public:
FDEBUG(computationCounter.tac());
delete [] leafsDataArray;
for(int idxShape = 0 ; idxShape < SizeShape ; ++idxShape){
omp_destroy_lock(&lockShape[idxShape]);
}
FDEBUG( FDebug::Controller << "\tFinished (@Direct Pass (L2P + P2P) = " << counterTime.tacAndElapsed() << "s)\n" );
FDEBUG( FDebug::Controller << "\t\t Computation L2P + P2P : " << computationCounter.cumulated() << " s\n" );
......
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