Nous avons procédé ce jeudi matin 08 avril 2021 à une MAJ de sécurité urgente. Nous sommes passé de la version 13.9.3 à la version 13.9.5 les releases notes correspondantes sont ici:
https://about.gitlab.com/releases/2021/03/17/security-release-gitlab-13-9-4-released/
https://about.gitlab.com/releases/2021/03/31/security-release-gitlab-13-10-1-released/

Commit fa0db644 authored by berenger-bramas's avatar berenger-bramas

Factorize the computation of the position of each cells in the tree

(FTreeCordinate)
To gain time.
Now will test the efficiency.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/scalfmm/scalfmm/trunk@107 2616d619-271b-44dc-8df4-d4a8f33a7222
parent def73c4f
......@@ -46,7 +46,8 @@ public:
* @param size the number of neighbors
* @param inLevel the current level of the computation
*/
virtual void M2L(CellClass* const FRestrict local, const CellClass* distantNeighbors[208], const int size, const int inLevel) = 0;
virtual void M2L(CellClass* const FRestrict local, const CellClass* distantNeighbors[208],
const FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208], const int size, const int inLevel) = 0;
/**
* L2L
......
......@@ -35,7 +35,7 @@ public:
}
/** Print the morton index */
virtual void M2L(CellClass* const FRestrict , const CellClass* [], const int , const int ) {
virtual void M2L(CellClass* const FRestrict , const CellClass* [], const FTreeCoordinate& , FTreeCoordinate [], const int , const int ) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTRACE( FTrace::Controller.leaveFunction(FTrace::KERNELS) );
}
......
......@@ -48,7 +48,7 @@ public:
}
// Before Downward
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int ) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const FTreeCoordinate& , FTreeCoordinate [208], const int size, const int ) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
// The pole is impacted by what represent other poles
for(int idx = 0 ; idx < size ; ++idx){
......
......@@ -672,9 +672,11 @@ public:
* @param inLevel the level of the element
* @return the number of neighbors
*/
int getDistantNeighbors(const CellClass* inNeighbors[208], const MortonIndex inIndex, const int inLevel) const{
int getDistantNeighbors(const CellClass* inNeighbors[208],
FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208],
const MortonIndex inIndex, const int inLevel) const{
MortonIndex inNeighborsIndex[208];
return getDistantNeighborsWithIndex(inNeighbors, inNeighborsIndex, inIndex, inLevel);
return getDistantNeighborsWithIndex(inNeighbors, inNeighborsIndex, inCurrentPosition, inNeighborsPosition, inIndex, inLevel);
}
......@@ -685,12 +687,14 @@ public:
* @param inLevel the level of the element
* @return the number of neighbors
*/
int getDistantNeighborsWithIndex(const CellClass* inNeighbors[208], MortonIndex inNeighborsIndex[208], const MortonIndex inIndex, const int inLevel) const{
int getDistantNeighborsWithIndex(const CellClass* inNeighbors[208], MortonIndex inNeighborsIndex[208],
FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208],
const MortonIndex inIndex, const int inLevel) const{
// Then take each child of the parent's neighbors if not in directNeighbors
// Father coordinate
FTreeCoordinate parentCell;
parentCell.setPositionFromMorton(inIndex>>3, inLevel-1);
inCurrentPosition.setPositionFromMorton(inIndex,inLevel);
const FTreeCoordinate parentCell(inCurrentPosition.getX()>>1,inCurrentPosition.getY()>>1,inCurrentPosition.getZ()>>1);
// the current cell
FTreeCoordinate workingCell;
workingCell.setPositionFromMorton(inIndex, inLevel);
......@@ -730,7 +734,11 @@ public:
FMath::Abs(workingCell.getZ() - potentialNeighbor.getZ()) > 1){
// add to neighbors
inNeighborsIndex[idxNeighbors] = mortonOther | idxCousin;
inNeighbors[idxNeighbors++] = cells[idxCousin];
inNeighbors[idxNeighbors] = cells[idxCousin];
inNeighborsPosition[idxNeighbors] = FTreeCoordinate((other.getX()<<1) | (idxCousin>>2 & 1),
(other.getY()<<1) | (idxCousin>>1 & 1),
(other.getZ()<<1) | (idxCousin&1));
++idxNeighbors;
}
}
}
......
......@@ -156,13 +156,16 @@ public:
FOctreeIterator avoidGotoLeftIterator(octreeIterator);
const CellClass* neighbors[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
// for each levels
for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){
// for each cells
do{
const int counter = tree->getDistantNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),idxLevel);
const int counter = tree->getDistantNeighbors(neighbors, currentPosition, neighborsPosition, octreeIterator.getCurrentGlobalIndex(),idxLevel);
FDEBUG(computationCounter.tic());
if(counter) kernels->M2L( octreeIterator.getCurrentCell() , neighbors, counter, idxLevel);
if(counter) kernels->M2L( octreeIterator.getCurrentCell() , neighbors, currentPosition, neighborsPosition, counter, idxLevel);
FDEBUG(computationCounter.tac());
} while(octreeIterator.moveRight());
......
......@@ -237,10 +237,13 @@ public:
{
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
const CellClass* neighbors[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
#pragma omp for
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
const int counter = tree->getDistantNeighbors(neighbors, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, counter, idxLevel);
const int counter = tree->getDistantNeighbors(neighbors, currentPosition, neighborsPosition, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, currentPosition, neighborsPosition, counter, idxLevel);
}
}
FDEBUG(computationCounter.tac());
......
......@@ -474,7 +474,7 @@ public:
FBoolArray* const indexToReceive = new FBoolArray(1 << (3*(OctreeHeight-1)));
struct LimitCell { int counter; const CellClass* neighbors[208]; };
struct LimitCell { int counter; const CellClass* neighbors[208]; FTreeCoordinate currentPosition; FTreeCoordinate neighborsPosition[208]; };
LimitCell ** const unfinishedCells = new LimitCell*[this->leafRight - this->leafLeft + 1];
FBoolArray* alreadySent[this->nbProcess];
......@@ -517,6 +517,9 @@ public:
{
const CellClass* neighbors[208];
MortonIndex neighborsIndexes[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
#pragma omp single nowait
......@@ -527,7 +530,7 @@ public:
#pragma omp for //schedule(dynamic)
for(int idxCell = startIdx ; idxCell < endIdx ; ++idxCell){
const int neighborsCounter = tree->getDistantNeighborsWithIndex(neighbors, neighborsIndexes, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
const int neighborsCounter = tree->getDistantNeighborsWithIndex(neighbors, neighborsIndexes, currentPosition, neighborsPosition,iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
bool needData = false;
......@@ -588,14 +591,20 @@ public:
if(needData){
const int currentCell = idxCell - startIdx;
unfinishedCells[currentCell] = new LimitCell();
unfinishedCells[currentCell]->counter = neighborsCounter;
unfinishedCells[currentCell]->currentPosition = currentPosition;
memcpy(unfinishedCells[currentCell]->neighbors,neighbors,sizeof(CellClass*)*neighborsCounter);
memcpy(unfinishedCells[currentCell]->neighborsPosition,neighborsPosition,sizeof(FTreeCoordinate)*neighborsCounter);
alreadySent[idPorcess]->set(idxCell-startIdx,true);
}
// we can compute now !
else if(neighborsCounter){
FDEBUG(computationCounter.tic());
myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, neighborsCounter, idxLevel);
myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, currentPosition, neighborsPosition, neighborsCounter, idxLevel);
FDEBUG(computationCounter.tac());
}
FDEBUG(computationCounter.tic());
......@@ -651,7 +660,9 @@ public:
#pragma omp for nowait
for(int idxCell = startIdx ; idxCell < endIdx ; ++idxCell){
if(alreadySent[idPorcess]->get(idxCell-startIdx)){
myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , unfinishedCells[idxCell-startIdx]->neighbors, unfinishedCells[idxCell-startIdx]->counter, idxLevel);
myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , unfinishedCells[idxCell-startIdx]->neighbors,
unfinishedCells[idxCell-startIdx]->currentPosition, unfinishedCells[idxCell-startIdx]->neighborsPosition,
unfinishedCells[idxCell-startIdx]->counter, idxLevel);
delete unfinishedCells[idxCell-startIdx];
}
}
......
......@@ -234,11 +234,14 @@ public:
{
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
const CellClass* neighbors[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
#pragma omp for
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
CellClass* const currentCell = iterArray[idxCell].getCurrentCell();
if(currentCell->hasTargetsChild()){
const int counter = tree->getDistantNeighbors(neighbors, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
const int counter = tree->getDistantNeighbors(neighbors, currentPosition, neighborsPosition, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
int offsetTargetNeighbors = 0;
for(int idxRealNeighbors = 0 ; idxRealNeighbors < counter ; ++idxRealNeighbors, ++offsetTargetNeighbors){
if(neighbors[idxRealNeighbors]->hasSrcChild()){
......@@ -251,7 +254,7 @@ public:
}
}
if(offsetTargetNeighbors){
myThreadkernels->M2L( currentCell , neighbors, offsetTargetNeighbors, idxLevel);
myThreadkernels->M2L( currentCell , neighbors, currentPosition, neighborsPosition, offsetTargetNeighbors, idxLevel);
}
}
}
......
......@@ -214,10 +214,13 @@ public:
{
Kernel * const myThreadkernels = kernels[omp_get_thread_num()];
CellClass* neighbors[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
#pragma omp for
for(int idxCell = 0 ; idxCell < numberOfCells ; ++idxCell){
const int counter = tree->getDistantNeighbors(neighbors, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , neighbors, counter, idxLevel);
const int counter = tree->getDistantNeighbors(neighbors, currentPosition, neighborsPosition, iterArray[idxCell].getCurrentGlobalIndex(),idxLevel);
if(counter) myThreadkernels->M2L( iterArray[idxCell].getCurrentCell() , currentPosition, neighborsPosition, neighbors, counter, idxLevel);
}
}
FDEBUG(computationCounter.tac());
......
......@@ -174,6 +174,9 @@ public:
FOctreeIterator avoidGotoLeftIterator(octreeIterator);
CellClass* neighbors[208];
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
// for each levels
for(int idxLevel = 2 ; idxLevel < OctreeHeight ; ++idxLevel ){
// for each cells
......@@ -181,7 +184,7 @@ public:
FDEBUG(computationCounter.tic());
CellClass* const currentCell = octreeIterator.getCurrentCell();
if(currentCell->hasTargetsChild()){
const int counter = tree->getDistantNeighbors(neighbors, octreeIterator.getCurrentGlobalIndex(),idxLevel);
const int counter = tree->getDistantNeighbors(neighbors, currentPosition, neighborsPosition, octreeIterator.getCurrentGlobalIndex(),idxLevel);
int offsetTargetNeighbors = 0;
for(int idxRealNeighbors = 0 ; idxRealNeighbors < counter ; ++idxRealNeighbors, ++offsetTargetNeighbors){
if(neighbors[idxRealNeighbors]->hasSrcChild()){
......@@ -194,7 +197,7 @@ public:
}
}
if(offsetTargetNeighbors){
kernels->M2L( currentCell , neighbors, offsetTargetNeighbors, idxLevel);
kernels->M2L( currentCell , neighbors, currentPosition, neighborsPosition, offsetTargetNeighbors, idxLevel);
}
}
FDEBUG(computationCounter.tac());
......
......@@ -836,7 +836,8 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208],
const FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......
......@@ -908,7 +908,8 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208],
const FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......
......@@ -1212,7 +1212,8 @@ public:
*Remark: here we have always j+n >= |-k-l|
*
*/
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208], const int size, const int inLevel) {
void M2L(CellClass* const FRestrict pole, const CellClass* distantNeighbors[208],
const FTreeCoordinate& inCurrentPosition, FTreeCoordinate inNeighborsPosition[208], const int size, const int inLevel) {
FTRACE( FTrace::Controller.enterFunction(FTrace::KERNELS, __FUNCTION__ , __FILE__ , __LINE__) );
FTreeCoordinate coordCenter;
coordCenter.setPositionFromMorton(pole->getMortonIndex(),inLevel);
......
......@@ -110,7 +110,7 @@ int main(int argc, char ** argv){
FFmbKernels<FmbParticle, FmbCell> kernels(NbLevels,loader.getBoxWidth());
//FBasicKernels<FmbParticle, FmbCell> kernels;
//FFmmAlgorithm FFmmAlgorithmThread FFmmAlgorithmThreadUs
FFmmAlgorithmThread<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf> algo(&tree,&kernels);
FFmmAlgorithm<FFmbKernels, FmbParticle, FmbCell, FSimpleLeaf> algo(&tree,&kernels);
algo.execute();
counter.tac();
......
......@@ -206,7 +206,10 @@ int main(int argc, char ** argv){
const FBasicCell* neighbors[208];
MortonIndex neighborsIndexes[208];
M2LCalculusAtLevel[idxArray] += tree.getDistantNeighborsWithIndex(neighbors, neighborsIndexes, octreeIterator.getCurrentGlobalIndex(),idxLevel);
FTreeCoordinate currentPosition;
FTreeCoordinate neighborsPosition[208];
M2LCalculusAtLevel[idxArray] += tree.getDistantNeighborsWithIndex(neighbors, neighborsIndexes, currentPosition, neighborsPosition, octreeIterator.getCurrentGlobalIndex(),idxLevel);
} while(octreeIterator.moveRight());
......
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