Commit c5cf75a3 authored by BRAMAS Berenger's avatar BRAMAS Berenger

Update starpu fmm

parent a7996fd1
...@@ -175,7 +175,7 @@ protected: ...@@ -175,7 +175,7 @@ protected:
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
property.outPosition = interactionsPosition[idxInter]; property.relativeOutPosition = interactionsPosition[idxInter];
property.insideIdxInBlock = cellIdx; property.insideIdxInBlock = cellIdx;
outsideInteractions.push_back(property); outsideInteractions.push_back(property);
} }
...@@ -215,8 +215,8 @@ protected: ...@@ -215,8 +215,8 @@ protected:
FAssertLF(cell.getMortonIndex() == outsideInteractions[outInterIdx].insideIndex); FAssertLF(cell.getMortonIndex() == outsideInteractions[outInterIdx].insideIndex);
const CellClass* ptCell = &interCell; const CellClass* ptCell = &interCell;
kernels->M2L( &cell , &ptCell, &outsideInteractions[outInterIdx].outPosition, 1, idxLevel); kernels->M2L( &cell , &ptCell, &outsideInteractions[outInterIdx].relativeOutPosition, 1, idxLevel);
const int otherPos = getOppositeInterIndex(outsideInteractions[outInterIdx].outPosition); const int otherPos = getOppositeInterIndex(outsideInteractions[outInterIdx].relativeOutPosition);
ptCell = &cell; ptCell = &cell;
kernels->M2L( &interCell , &ptCell, &otherPos, 1, idxLevel); kernels->M2L( &interCell , &ptCell, &otherPos, 1, idxLevel);
} }
...@@ -345,7 +345,7 @@ protected: ...@@ -345,7 +345,7 @@ protected:
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
property.outPosition = interactionsPosition[idxInter]; property.relativeOutPosition = interactionsPosition[idxInter];
property.insideIdxInBlock = leafIdx; property.insideIdxInBlock = leafIdx;
outsideInteractions.push_back(property); outsideInteractions.push_back(property);
} }
...@@ -386,8 +386,8 @@ protected: ...@@ -386,8 +386,8 @@ protected:
ParticleContainerClass* ptrLeaf = &interParticles; ParticleContainerClass* ptrLeaf = &interParticles;
kernels->P2POuter( FTreeCoordinate(outsideInteractions[outInterIdx].insideIndex, tree->getHeight()-1), kernels->P2POuter( FTreeCoordinate(outsideInteractions[outInterIdx].insideIndex, tree->getHeight()-1),
&particles , &ptrLeaf, &outsideInteractions[outInterIdx].outPosition, 1); &particles , &ptrLeaf, &outsideInteractions[outInterIdx].relativeOutPosition, 1);
const int otherPosition = getOppositeNeighIndex(outsideInteractions[outInterIdx].outPosition); const int otherPosition = getOppositeNeighIndex(outsideInteractions[outInterIdx].relativeOutPosition);
ptrLeaf = &particles; ptrLeaf = &particles;
kernels->P2POuter( FTreeCoordinate(outsideInteractions[outInterIdx].outIndex, tree->getHeight()-1), kernels->P2POuter( FTreeCoordinate(outsideInteractions[outInterIdx].outIndex, tree->getHeight()-1),
&interParticles , &ptrLeaf, &otherPosition, 1); &interParticles , &ptrLeaf, &otherPosition, 1);
......
This diff is collapsed.
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
#endif #endif
#include "Containers/FBoolArray.hpp"
template <class OctreeClass, class CellContainerClass, class KernelClass, class ParticleGroupClass, class StarPUCpuWrapperClass template <class OctreeClass, class CellContainerClass, class KernelClass, class ParticleGroupClass, class StarPUCpuWrapperClass
#ifdef SCALFMM_ENABLE_CUDA_KERNEL #ifdef SCALFMM_ENABLE_CUDA_KERNEL
, class StarPUCudaWrapperClass = FStarPUCudaWrapper<KernelClass, FCudaEmptyCellSymb, int, int, FCudaGroupOfCells<FCudaEmptyCellSymb, int, int>, , class StarPUCudaWrapperClass = FStarPUCudaWrapper<KernelClass, FCudaEmptyCellSymb, int, int, FCudaGroupOfCells<FCudaEmptyCellSymb, int, int>,
...@@ -624,8 +626,9 @@ protected: ...@@ -624,8 +626,9 @@ protected:
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
property.outPosition = interactionsPosition[idxInter]; property.relativeOutPosition = interactionsPosition[idxInter];
property.insideIdxInBlock = leafIdx; property.insideIdxInBlock = leafIdx;
property.outsideIdxInBlock = -1;
outsideInteractions.push_back(property); outsideInteractions.push_back(property);
} }
} }
...@@ -640,16 +643,28 @@ protected: ...@@ -640,16 +643,28 @@ protected:
const MortonIndex blockStartIdxOther = leftContainers->getStartingIndex(); const MortonIndex blockStartIdxOther = leftContainers->getStartingIndex();
const MortonIndex blockEndIdxOther = leftContainers->getEndingIndex(); const MortonIndex blockEndIdxOther = leftContainers->getEndingIndex();
while(currentOutInteraction < int(outsideInteractions.size()) && outsideInteractions[currentOutInteraction].outIndex < blockStartIdxOther){ while(currentOutInteraction < int(outsideInteractions.size())
&& (outsideInteractions[currentOutInteraction].outIndex < blockStartIdxOther
|| leftContainers->getLeafIndex(outsideInteractions[currentOutInteraction].outIndex) == -1)
&& outsideInteractions[currentOutInteraction].outIndex < blockEndIdxOther){
currentOutInteraction += 1; currentOutInteraction += 1;
} }
int lastOutInteraction = currentOutInteraction; int lastOutInteraction = currentOutInteraction;
int copyExistingInteraction = currentOutInteraction;
while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdxOther){ while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdxOther){
const int leafPos = leftContainers->getLeafIndex(outsideInteractions[lastOutInteraction].outIndex);
if(leafPos != -1){
if(copyExistingInteraction != lastOutInteraction){
outsideInteractions[copyExistingInteraction] = outsideInteractions[lastOutInteraction];
}
outsideInteractions[copyExistingInteraction].outsideIdxInBlock = leafPos;
copyExistingInteraction += 1;
}
lastOutInteraction += 1; lastOutInteraction += 1;
} }
const int nbInteractionsBetweenBlocks = (lastOutInteraction-currentOutInteraction); const int nbInteractionsBetweenBlocks = (copyExistingInteraction-currentOutInteraction);
if(nbInteractionsBetweenBlocks){ if(nbInteractionsBetweenBlocks){
externalInteractions->emplace_back(); externalInteractions->emplace_back();
BlockInteractions<ParticleGroupClass>* interactions = &externalInteractions->back(); BlockInteractions<ParticleGroupClass>* interactions = &externalInteractions->back();
...@@ -657,7 +672,7 @@ protected: ...@@ -657,7 +672,7 @@ protected:
interactions->otherBlockId = idxLeftGroup; interactions->otherBlockId = idxLeftGroup;
interactions->interactions.resize(nbInteractionsBetweenBlocks); interactions->interactions.resize(nbInteractionsBetweenBlocks);
std::copy(outsideInteractions.begin() + currentOutInteraction, std::copy(outsideInteractions.begin() + currentOutInteraction,
outsideInteractions.begin() + lastOutInteraction, outsideInteractions.begin() + copyExistingInteraction,
interactions->interactions.begin()); interactions->interactions.begin());
} }
...@@ -699,8 +714,9 @@ protected: ...@@ -699,8 +714,9 @@ protected:
OutOfBlockInteraction property; OutOfBlockInteraction property;
property.insideIndex = mindex; property.insideIndex = mindex;
property.outIndex = interactionsIndexes[idxInter]; property.outIndex = interactionsIndexes[idxInter];
property.outPosition = interactionsPosition[idxInter]; property.relativeOutPosition = interactionsPosition[idxInter];
property.insideIdxInBlock = cellIdx; property.insideIdxInBlock = cellIdx;
property.outsideIdxInBlock = -1;
outsideInteractions.push_back(property); outsideInteractions.push_back(property);
} }
} }
...@@ -715,17 +731,29 @@ protected: ...@@ -715,17 +731,29 @@ protected:
const MortonIndex blockStartIdxOther = leftCells->getStartingIndex(); const MortonIndex blockStartIdxOther = leftCells->getStartingIndex();
const MortonIndex blockEndIdxOther = leftCells->getEndingIndex(); const MortonIndex blockEndIdxOther = leftCells->getEndingIndex();
while(currentOutInteraction < int(outsideInteractions.size()) && outsideInteractions[currentOutInteraction].outIndex < blockStartIdxOther){ while(currentOutInteraction < int(outsideInteractions.size())
&& (outsideInteractions[currentOutInteraction].outIndex < blockStartIdxOther
|| leftCells->getCellIndex(outsideInteractions[currentOutInteraction].outIndex) == -1)
&& outsideInteractions[currentOutInteraction].outIndex < blockEndIdxOther){
currentOutInteraction += 1; currentOutInteraction += 1;
} }
int lastOutInteraction = currentOutInteraction; int lastOutInteraction = currentOutInteraction;
int copyExistingInteraction = currentOutInteraction;
while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdxOther){ while(lastOutInteraction < int(outsideInteractions.size()) && outsideInteractions[lastOutInteraction].outIndex < blockEndIdxOther){
const int cellPos = leftCells->getCellIndex(outsideInteractions[lastOutInteraction].outIndex);
if(cellPos != -1){
if(copyExistingInteraction != lastOutInteraction){
outsideInteractions[copyExistingInteraction] = outsideInteractions[lastOutInteraction];
}
outsideInteractions[copyExistingInteraction].outsideIdxInBlock = cellPos;
copyExistingInteraction += 1;
}
lastOutInteraction += 1; lastOutInteraction += 1;
} }
// Create interactions // Create interactions
const int nbInteractionsBetweenBlocks = (lastOutInteraction-currentOutInteraction); const int nbInteractionsBetweenBlocks = (copyExistingInteraction-currentOutInteraction);
if(nbInteractionsBetweenBlocks){ if(nbInteractionsBetweenBlocks){
externalInteractions->emplace_back(); externalInteractions->emplace_back();
BlockInteractions<CellContainerClass>* interactions = &externalInteractions->back(); BlockInteractions<CellContainerClass>* interactions = &externalInteractions->back();
...@@ -733,7 +761,7 @@ protected: ...@@ -733,7 +761,7 @@ protected:
interactions->otherBlockId = idxLeftGroup; interactions->otherBlockId = idxLeftGroup;
interactions->interactions.resize(nbInteractionsBetweenBlocks); interactions->interactions.resize(nbInteractionsBetweenBlocks);
std::copy(outsideInteractions.begin() + currentOutInteraction, std::copy(outsideInteractions.begin() + currentOutInteraction,
outsideInteractions.begin() + lastOutInteraction, outsideInteractions.begin() + copyExistingInteraction,
interactions->interactions.begin()); interactions->interactions.begin());
} }
......
...@@ -9,8 +9,9 @@ ...@@ -9,8 +9,9 @@
struct alignas(FStarPUDefaultAlign::StructAlign) OutOfBlockInteraction{ struct alignas(FStarPUDefaultAlign::StructAlign) OutOfBlockInteraction{
MortonIndex outIndex; MortonIndex outIndex;
MortonIndex insideIndex; MortonIndex insideIndex;
int outPosition; int relativeOutPosition;
int insideIdxInBlock; int insideIdxInBlock;
int outsideIdxInBlock;
// To sort // To sort
bool operator <=(const OutOfBlockInteraction& other) const{ bool operator <=(const OutOfBlockInteraction& other) const{
return outIndex <= other.outIndex; return outIndex <= other.outIndex;
......
...@@ -171,7 +171,7 @@ __global__ void FCuda__transferInoutPassPerformMpi(unsigned char* currentCellsP ...@@ -171,7 +171,7 @@ __global__ void FCuda__transferInoutPassPerformMpi(unsigned char* currentCellsP
typename CellContainerClass::CompleteCellClass interactions[343]; typename CellContainerClass::CompleteCellClass interactions[343];
memset(interactions, 0, 343*sizeof(interactions[0])); memset(interactions, 0, 343*sizeof(interactions[0]));
interactions[outsideInteractions[outInterIdx].outPosition] = interCell; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = interCell;
const int counter = 1; const int counter = 1;
kernel->M2L( cell , interactions, counter, idxLevel); kernel->M2L( cell , interactions, counter, idxLevel);
} }
...@@ -295,12 +295,12 @@ __global__ void FCuda__transferInoutPassPerform(unsigned char* currentCellsPtr, ...@@ -295,12 +295,12 @@ __global__ void FCuda__transferInoutPassPerform(unsigned char* currentCellsPtr,
typename CellContainerClass::CompleteCellClass interactions[343]; typename CellContainerClass::CompleteCellClass interactions[343];
memset(interactions, 0, 343*sizeof(interactions[0])); memset(interactions, 0, 343*sizeof(interactions[0]));
interactions[outsideInteractions[outInterIdx].outPosition] = interCell; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = interCell;
const int counter = 1; const int counter = 1;
kernel->M2L( cell , interactions, counter, idxLevel); kernel->M2L( cell , interactions, counter, idxLevel);
interactions[outsideInteractions[outInterIdx].outPosition].symb = nullptr; interactions[outsideInteractions[outInterIdx].relativeOutPosition].symb = nullptr;
interactions[FMGetOppositeInterIndex(outsideInteractions[outInterIdx].outPosition)] = cell; interactions[FMGetOppositeInterIndex(outsideInteractions[outInterIdx].relativeOutPosition)] = cell;
kernel->M2L( interCell , interactions, counter, idxLevel); kernel->M2L( interCell , interactions, counter, idxLevel);
} }
} }
...@@ -444,7 +444,7 @@ __global__ void FCuda__directInoutPassPerformMpi(unsigned char* containersPtr, s ...@@ -444,7 +444,7 @@ __global__ void FCuda__directInoutPassPerformMpi(unsigned char* containersPtr, s
ParticleGroupClass particles = containers.template getLeaf<ParticleGroupClass>(outsideInteractions[outInterIdx].insideIdxInBlock); ParticleGroupClass particles = containers.template getLeaf<ParticleGroupClass>(outsideInteractions[outInterIdx].insideIdxInBlock);
ParticleGroupClass* interactions[27]; ParticleGroupClass* interactions[27];
memset(interactions, 0, 27*sizeof(ParticleGroupClass*)); memset(interactions, 0, 27*sizeof(ParticleGroupClass*));
interactions[outsideInteractions[outInterIdx].outPosition] = &interParticles; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = &interParticles;
const int counter = 1; const int counter = 1;
kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), &particles, &particles , interactions, counter); kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), &particles, &particles , interactions, counter);
} }
...@@ -561,12 +561,12 @@ __global__ void FCuda__directInoutPassPerform(unsigned char* containersPtr, std: ...@@ -561,12 +561,12 @@ __global__ void FCuda__directInoutPassPerform(unsigned char* containersPtr, std:
ParticleGroupClass* interactions[27]; ParticleGroupClass* interactions[27];
memset(interactions, 0, 27*sizeof(ParticleGroupClass*)); memset(interactions, 0, 27*sizeof(ParticleGroupClass*));
interactions[outsideInteractions[outInterIdx].outPosition] = &interParticles; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = &interParticles;
const int counter = 1; const int counter = 1;
kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), &particles, &particles , interactions, counter); kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), &particles, &particles , interactions, counter);
interactions[outsideInteractions[outInterIdx].outPosition] = nullptr; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = nullptr;
interactions[FMGetOppositeNeighIndex(outsideInteractions[outInterIdx].outPosition)] = &particles; interactions[FMGetOppositeNeighIndex(outsideInteractions[outInterIdx].relativeOutPosition)] = &particles;
kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].outIndex, treeHeight-1), &interParticles, &interParticles , interactions, counter); kernel->P2PRemote( FCudaTreeCoordinate::GetPositionFromMorton(outsideInteractions[outInterIdx].outIndex, treeHeight-1), &interParticles, &interParticles , interactions, counter);
} }
} }
......
...@@ -8,7 +8,7 @@ typedef long long int MortonIndex; ...@@ -8,7 +8,7 @@ typedef long long int MortonIndex;
struct OutOfBlockInteraction{ struct OutOfBlockInteraction{
MortonIndex outIndex; MortonIndex outIndex;
MortonIndex insideIndex; MortonIndex insideIndex;
int outPosition; int relativeOutPosition;
} __attribute__ ((aligned (DefaultStructAlign))); } __attribute__ ((aligned (DefaultStructAlign)));
struct Uptr9{ struct Uptr9{
__global unsigned char* ptrs[9]; __global unsigned char* ptrs[9];
......
...@@ -20,7 +20,7 @@ public: ...@@ -20,7 +20,7 @@ public:
struct OutOfBlockInteraction{\ struct OutOfBlockInteraction{\
MortonIndex outIndex;\ MortonIndex outIndex;\
MortonIndex insideIndex;\ MortonIndex insideIndex;\
int outPosition;\ int relativeOutPosition;\
int insideIdxInBlock;\ int insideIdxInBlock;\
} __attribute__ ((aligned (DefaultStructAlign)));\ } __attribute__ ((aligned (DefaultStructAlign)));\
struct Uptr9{\ struct Uptr9{\
......
...@@ -204,7 +204,7 @@ public: ...@@ -204,7 +204,7 @@ public:
CellClass cell = currentCells->getDownCell((*outsideInteractions)[outInterIdx].insideIdxInBlock); CellClass cell = currentCells->getDownCell((*outsideInteractions)[outInterIdx].insideIdxInBlock);
FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex); FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex);
const CellClass* ptCell = &interCell; const CellClass* ptCell = &interCell;
kernel->M2L( &cell , &ptCell, &(*outsideInteractions)[outInterIdx].outPosition, 1, idxLevel); kernel->M2L( &cell , &ptCell, &(*outsideInteractions)[outInterIdx].relativeOutPosition, 1, idxLevel);
} }
} }
} }
...@@ -294,31 +294,25 @@ public: ...@@ -294,31 +294,25 @@ public:
if(mode == 1){ if(mode == 1){
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){ for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
const int cellPos = cellsOther->getCellIndex((*outsideInteractions)[outInterIdx].outIndex); CellClass interCell = cellsOther->getUpCell((*outsideInteractions)[outInterIdx].outsideIdxInBlock);
if(cellPos != -1){ FAssertLF(interCell.getMortonIndex() == (*outsideInteractions)[outInterIdx].outIndex);
CellClass interCell = cellsOther->getUpCell(cellPos); CellClass cell = currentCells->getDownCell((*outsideInteractions)[outInterIdx].insideIdxInBlock);
FAssertLF(interCell.getMortonIndex() == (*outsideInteractions)[outInterIdx].outIndex); FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex);
CellClass cell = currentCells->getDownCell((*outsideInteractions)[outInterIdx].insideIdxInBlock);
FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex); const CellClass* ptCell = &interCell;
kernel->M2L( &cell , &ptCell, &(*outsideInteractions)[outInterIdx].relativeOutPosition, 1, idxLevel);
const CellClass* ptCell = &interCell;
kernel->M2L( &cell , &ptCell, &(*outsideInteractions)[outInterIdx].outPosition, 1, idxLevel);
}
} }
} }
else{ else{
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){ for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
const int cellPos = currentCells->getCellIndex((*outsideInteractions)[outInterIdx].outIndex); CellClass cell = cellsOther->getUpCell((*outsideInteractions)[outInterIdx].insideIdxInBlock);
if(cellPos != -1){ FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex);
CellClass cell = cellsOther->getUpCell((*outsideInteractions)[outInterIdx].insideIdxInBlock); CellClass interCell = currentCells->getDownCell((*outsideInteractions)[outInterIdx].outsideIdxInBlock);
FAssertLF(cell.getMortonIndex() == (*outsideInteractions)[outInterIdx].insideIndex); FAssertLF(interCell.getMortonIndex() == (*outsideInteractions)[outInterIdx].outIndex);
CellClass interCell = currentCells->getDownCell(cellPos);
FAssertLF(interCell.getMortonIndex() == (*outsideInteractions)[outInterIdx].outIndex); const int otherPos = getOppositeInterIndex((*outsideInteractions)[outInterIdx].relativeOutPosition);
const CellClass* ptCell = &cell;
const int otherPos = getOppositeInterIndex((*outsideInteractions)[outInterIdx].outPosition); kernel->M2L( &interCell , &ptCell, &otherPos, 1, idxLevel);
const CellClass* ptCell = &cell;
kernel->M2L( &interCell , &ptCell, &otherPos, 1, idxLevel);
}
} }
} }
} }
...@@ -421,7 +415,7 @@ public: ...@@ -421,7 +415,7 @@ public:
FAssertLF(containers->getLeafMortonIndex(leafPos) == (*outsideInteractions)[outInterIdx].insideIndex); FAssertLF(containers->getLeafMortonIndex(leafPos) == (*outsideInteractions)[outInterIdx].insideIndex);
ParticleContainerClass* ptrLeaf = &interParticles; ParticleContainerClass* ptrLeaf = &interParticles;
kernel->P2PRemote( FTreeCoordinate((*outsideInteractions)[outInterIdx].insideIndex, treeHeight-1), &particles, &particles , kernel->P2PRemote( FTreeCoordinate((*outsideInteractions)[outInterIdx].insideIndex, treeHeight-1), &particles, &particles ,
&ptrLeaf, &(*outsideInteractions)[outInterIdx].outPosition, 1); &ptrLeaf, &(*outsideInteractions)[outInterIdx].relativeOutPosition, 1);
} }
} }
} }
...@@ -494,22 +488,19 @@ public: ...@@ -494,22 +488,19 @@ public:
const std::vector<OutOfBlockInteraction>* outsideInteractions){ const std::vector<OutOfBlockInteraction>* outsideInteractions){
KernelClass*const kernel = kernels[omp_get_thread_num()]; KernelClass*const kernel = kernels[omp_get_thread_num()];
for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){ for(int outInterIdx = 0 ; outInterIdx < int(outsideInteractions->size()) ; ++outInterIdx){
const int leafPos = containersOther->getLeafIndex((*outsideInteractions)[outInterIdx].outIndex); ParticleContainerClass interParticles = containersOther->template getLeaf<ParticleContainerClass>((*outsideInteractions)[outInterIdx].outsideIdxInBlock);
if(leafPos != -1){ ParticleContainerClass particles = containers->template getLeaf<ParticleContainerClass>((*outsideInteractions)[outInterIdx].insideIdxInBlock);
ParticleContainerClass interParticles = containersOther->template getLeaf<ParticleContainerClass>(leafPos);
ParticleContainerClass particles = containers->template getLeaf<ParticleContainerClass>((*outsideInteractions)[outInterIdx].insideIdxInBlock); FAssertLF(containersOther->getLeafMortonIndex((*outsideInteractions)[outInterIdx].outsideIdxInBlock) == (*outsideInteractions)[outInterIdx].outIndex);
FAssertLF(containers->getLeafMortonIndex((*outsideInteractions)[outInterIdx].insideIdxInBlock) == (*outsideInteractions)[outInterIdx].insideIndex);
FAssertLF(containersOther->getLeafMortonIndex(leafPos) == (*outsideInteractions)[outInterIdx].outIndex);
FAssertLF(containers->getLeafMortonIndex((*outsideInteractions)[outInterIdx].insideIdxInBlock) == (*outsideInteractions)[outInterIdx].insideIndex); ParticleContainerClass* ptrLeaf = &interParticles;
kernel->P2POuter( FTreeCoordinate((*outsideInteractions)[outInterIdx].insideIndex, treeHeight-1),
ParticleContainerClass* ptrLeaf = &interParticles; &particles , &ptrLeaf, &(*outsideInteractions)[outInterIdx].relativeOutPosition, 1);
kernel->P2POuter( FTreeCoordinate((*outsideInteractions)[outInterIdx].insideIndex, treeHeight-1), const int otherPosition = getOppositeNeighIndex((*outsideInteractions)[outInterIdx].relativeOutPosition);
&particles , &ptrLeaf, &(*outsideInteractions)[outInterIdx].outPosition, 1); ptrLeaf = &particles;
const int otherPosition = getOppositeNeighIndex((*outsideInteractions)[outInterIdx].outPosition); kernel->P2POuter( FTreeCoordinate((*outsideInteractions)[outInterIdx].outIndex, treeHeight-1),
ptrLeaf = &particles;
kernel->P2POuter( FTreeCoordinate((*outsideInteractions)[outInterIdx].outIndex, treeHeight-1),
&interParticles , &ptrLeaf, &otherPosition, 1); &interParticles , &ptrLeaf, &otherPosition, 1);
}
} }
} }
......
...@@ -49,7 +49,7 @@ struct FWrappeCell{ ...@@ -49,7 +49,7 @@ struct FWrappeCell{
struct OutOfBlockInteraction{ struct OutOfBlockInteraction{
MortonIndex outIndex; MortonIndex outIndex;
MortonIndex insideIndex; MortonIndex insideIndex;
int outPosition; int relativeOutPosition;
int insideIdxInBlock; int insideIdxInBlock;
} __attribute__ ((aligned (DefaultStructAlign))); } __attribute__ ((aligned (DefaultStructAlign)));
...@@ -725,7 +725,7 @@ __kernel void FOpenCL__transferInoutPassPerformMpi(__global unsigned char* curr ...@@ -725,7 +725,7 @@ __kernel void FOpenCL__transferInoutPassPerformMpi(__global unsigned char* curr
struct FWrappeCell interactions[343]; struct FWrappeCell interactions[343];
FSetToNullptr343(interactions); FSetToNullptr343(interactions);
interactions[outsideInteractions[outInterIdx].outPosition] = interCell; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = interCell;
const int counter = 1; const int counter = 1;
M2L( cell , interactions, counter, idxLevel, userkernel); M2L( cell , interactions, counter, idxLevel, userkernel);
} }
...@@ -800,12 +800,12 @@ __kernel void FOpenCL__transferInoutPassPerform(__global unsigned char* currentC ...@@ -800,12 +800,12 @@ __kernel void FOpenCL__transferInoutPassPerform(__global unsigned char* currentC
struct FWrappeCell interactions[343]; struct FWrappeCell interactions[343];
FSetToNullptr343(interactions); FSetToNullptr343(interactions);
interactions[outsideInteractions[outInterIdx].outPosition] = interCell; interactions[outsideInteractions[outInterIdx].relativeOutPosition] = interCell;
const int counter = 1; const int counter = 1;
M2L( cell , interactions, counter, idxLevel, userkernel); M2L( cell , interactions, counter, idxLevel, userkernel);
interactions[outsideInteractions[outInterIdx].outPosition].symb = NULLPTR; interactions[outsideInteractions[outInterIdx].relativeOutPosition].symb = NULLPTR;
interactions[FMGetOppositeInterIndex(outsideInteractions[outInterIdx].outPosition)] = cell; interactions[FMGetOppositeInterIndex(outsideInteractions[outInterIdx].relativeOutPosition)] = cell;
M2L( interCell , interactions, counter, idxLevel, userkernel); M2L( interCell , interactions, counter, idxLevel, userkernel);
} }
} }
...@@ -884,7 +884,7 @@ __kernel void FOpenCL__directInoutPassPerformMpi(__global unsigned char* contain ...@@ -884,7 +884,7 @@ __kernel void FOpenCL__directInoutPassPerformMpi(__global unsigned char* contain
struct FOpenCLGroupAttachedLeaf particles = FOpenCLGroupOfParticles_getLeaf(&containers, outsideInteractions[outInterIdx].insideIdxInBlock); struct FOpenCLGroupAttachedLeaf particles = FOpenCLGroupOfParticles_getLeaf(&containers, outsideInteractions[outInterIdx].insideIdxInBlock);
FOpenCLAssertLF(FOpenCLGroupOfParticles_getLeafMortonIndex(&containers, outsideInteractions[outInterIdx].insideIdxInBlock) == outsideInteractions[outInterIdx].insideIndex); FOpenCLAssertLF(FOpenCLGroupOfParticles_getLeafMortonIndex(&containers, outsideInteractions[outInterIdx].insideIdxInBlock) == outsideInteractions[outInterIdx].insideIndex);
P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), particles, particles , interParticles, outsideInteractions[outInterIdx].outPosition, userkernel); P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), particles, particles , interParticles, outsideInteractions[outInterIdx].relativeOutPosition, userkernel);
} }
} }
} }
...@@ -951,9 +951,9 @@ __kernel void FOpenCL__directInoutPassPerform(__global unsigned char* containers ...@@ -951,9 +951,9 @@ __kernel void FOpenCL__directInoutPassPerform(__global unsigned char* containers
FOpenCLAssertLF(particles.nbParticles); FOpenCLAssertLF(particles.nbParticles);
FOpenCLAssertLF(interParticles.nbParticles); FOpenCLAssertLF(interParticles.nbParticles);
P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), particles, particles , interParticles, outsideInteractions[outInterIdx].outPosition, userkernel ); P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].insideIndex, treeHeight-1), particles, particles , interParticles, outsideInteractions[outInterIdx].relativeOutPosition, userkernel );
P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].outIndex, treeHeight-1), interParticles, interParticles , particles, FMGetOppositeNeighIndex(outsideInteractions[outInterIdx].outPosition), userkernel); P2PRemote( GetPositionFromMorton(outsideInteractions[outInterIdx].outIndex, treeHeight-1), interParticles, interParticles , particles, FMGetOppositeNeighIndex(outsideInteractions[outInterIdx].relativeOutPosition), userkernel);
} }
} }
} }
......
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