Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
3b1d2118
Commit
3b1d2118
authored
Aug 28, 2015
by
BRAMAS Berenger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the kernel interface to have more efficient iteration in sparse fmm
parent
f1c82ed0
Changes
47
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
4892 additions
and
3617 deletions
+4892
-3617
Src/Adaptive/FAdaptChebSymKernel.hpp
Src/Adaptive/FAdaptChebSymKernel.hpp
+1
-1
Src/Adaptive/FAdaptiveKernelWrapper.hpp
Src/Adaptive/FAdaptiveKernelWrapper.hpp
+75
-73
Src/Adaptive/FAdaptivePrintKernel.hpp
Src/Adaptive/FAdaptivePrintKernel.hpp
+6
-12
Src/BalanceTree/FChebSymCostKernel.hpp
Src/BalanceTree/FChebSymCostKernel.hpp
+17
-19
Src/BalanceTree/FDumbCostKernel.hpp
Src/BalanceTree/FDumbCostKernel.hpp
+15
-15
Src/BalanceTree/FFmmAlgorithmThreadBalanced.hpp
Src/BalanceTree/FFmmAlgorithmThreadBalanced.hpp
+8
-4
Src/Components/FAbstractKernels.hpp
Src/Components/FAbstractKernels.hpp
+24
-6
Src/Components/FBasicKernels.hpp
Src/Components/FBasicKernels.hpp
+12
-11
Src/Components/FTestKernels.hpp
Src/Components/FTestKernels.hpp
+11
-16
Src/Containers/FOctree.hpp
Src/Containers/FOctree.hpp
+395
-48
Src/Core/FFmmAlgorithm.hpp
Src/Core/FFmmAlgorithm.hpp
+8
-6
Src/Core/FFmmAlgorithmOmp4.hpp
Src/Core/FFmmAlgorithmOmp4.hpp
+1801
-912
Src/Core/FFmmAlgorithmPeriodic.hpp
Src/Core/FFmmAlgorithmPeriodic.hpp
+38
-32
Src/Core/FFmmAlgorithmSectionTask.hpp
Src/Core/FFmmAlgorithmSectionTask.hpp
+14
-11
Src/Core/FFmmAlgorithmTask.hpp
Src/Core/FFmmAlgorithmTask.hpp
+12
-9
Src/Core/FFmmAlgorithmThread.hpp
Src/Core/FFmmAlgorithmThread.hpp
+8
-6
Src/Core/FFmmAlgorithmThreadBalance.hpp
Src/Core/FFmmAlgorithmThreadBalance.hpp
+8
-6
Src/Core/FFmmAlgorithmThreadProc.hpp
Src/Core/FFmmAlgorithmThreadProc.hpp
+22
-17
Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp
Src/Core/FFmmAlgorithmThreadProcPeriodic.hpp
+48
-39
Src/Core/FFmmAlgorithmThreadTsm.hpp
Src/Core/FFmmAlgorithmThreadTsm.hpp
+12
-12
Src/Core/FFmmAlgorithmTsm.hpp
Src/Core/FFmmAlgorithmTsm.hpp
+12
-12
Src/GroupTree/Core/FGroupSeqAlgorithm.hpp
Src/GroupTree/Core/FGroupSeqAlgorithm.hpp
+23
-32
Src/GroupTree/Core/FGroupTaskAlgorithm.hpp
Src/GroupTree/Core/FGroupTaskAlgorithm.hpp
+29
-38
Src/GroupTree/Core/FGroupTaskDepAlgorithm.hpp
Src/GroupTree/Core/FGroupTaskDepAlgorithm.hpp
+23
-32
Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp
Src/GroupTree/StarPUUtils/FStarPUCpuWrapper.hpp
+28
-44
Src/Kernels/Chebyshev/FAbstractChebKernel.hpp
Src/Kernels/Chebyshev/FAbstractChebKernel.hpp
+5
-3
Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp
Src/Kernels/Chebyshev/FChebFlopsSymKernel.hpp
+15
-15
Src/Kernels/Chebyshev/FChebKernel.hpp
Src/Kernels/Chebyshev/FChebKernel.hpp
+25
-29
Src/Kernels/Chebyshev/FChebSymKernel.hpp
Src/Kernels/Chebyshev/FChebSymKernel.hpp
+94
-104
Src/Kernels/Chebyshev/FChebTensorialKernel.hpp
Src/Kernels/Chebyshev/FChebTensorialKernel.hpp
+20
-20
Src/Kernels/Interpolation/FInterpP2PKernels.hpp
Src/Kernels/Interpolation/FInterpP2PKernels.hpp
+12
-9
Src/Kernels/Rotation/FRotationKernel.hpp
Src/Kernels/Rotation/FRotationKernel.hpp
+965
-911
Src/Kernels/Rotation/FRotationOriginalKernel.hpp
Src/Kernels/Rotation/FRotationOriginalKernel.hpp
+46
-40
Src/Kernels/Spherical/FAbstractSphericalKernel.hpp
Src/Kernels/Spherical/FAbstractSphericalKernel.hpp
+28
-29
Src/Kernels/Spherical/FSphericalBlasKernel.hpp
Src/Kernels/Spherical/FSphericalBlasKernel.hpp
+7
-8
Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp
Src/Kernels/Spherical/FSphericalBlockBlasKernel.hpp
+7
-8
Src/Kernels/Spherical/FSphericalKernel.hpp
Src/Kernels/Spherical/FSphericalKernel.hpp
+122
-123
Src/Kernels/Spherical/FSphericalRotationKernel.hpp
Src/Kernels/Spherical/FSphericalRotationKernel.hpp
+6
-7
Src/Kernels/Taylor/FTaylorFlopsKernel.hpp
Src/Kernels/Taylor/FTaylorFlopsKernel.hpp
+9
-11
Src/Kernels/Taylor/FTaylorKernel.hpp
Src/Kernels/Taylor/FTaylorKernel.hpp
+44
-45
Src/Kernels/Taylor/FTaylorKernelSimple.hpp
Src/Kernels/Taylor/FTaylorKernelSimple.hpp
+754
-757
Src/Kernels/Uniform/FAbstractUnifKernel.hpp
Src/Kernels/Uniform/FAbstractUnifKernel.hpp
+6
-6
Src/Kernels/Uniform/FUnifDenseKernel.hpp
Src/Kernels/Uniform/FUnifDenseKernel.hpp
+21
-24
Src/Kernels/Uniform/FUnifKernel.hpp
Src/Kernels/Uniform/FUnifKernel.hpp
+25
-24
Src/Kernels/Uniform/FUnifTensorialKernel.hpp
Src/Kernels/Uniform/FUnifTensorialKernel.hpp
+20
-21
Tests/Utils/testFmmAdaptiveStats.cpp
Tests/Utils/testFmmAdaptiveStats.cpp
+7
-7
Tests/Utils/testFmmDemonstration.cpp
Tests/Utils/testFmmDemonstration.cpp
+4
-3
No files found.
Src/Adaptive/FAdaptChebSymKernel.hpp
View file @
3b1d2118
...
...
@@ -320,7 +320,7 @@ public:
}
void
P2P
(
ContainerClass
*
target
,
const
ContainerClass
*
sources
)
override
{
ContainerClass
*
sourcesArray
[
27
]
=
{
const_cast
<
ContainerClass
*>
(
sources
)
};
ContainerClass
*
sourcesArray
[
1
]
=
{
const_cast
<
ContainerClass
*>
(
sources
)
};
DirectInteractionComputer
<
FReal
,
MatrixKernelClass
::
NCMP
,
NVALS
>::
template
P2PRemote
(
target
,
sourcesArray
,
1
,
MatrixKernel
);
}
...
...
Src/Adaptive/FAdaptiveKernelWrapper.hpp
View file @
3b1d2118
...
...
@@ -174,10 +174,12 @@ public:
* Else we have to perform M2L or P2L.
*/
void
M2L
(
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
const
FRestrict
local
,
const
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
distantNeighbors
[
343
],
const
int
/*size*/
,
const
int
inLevel
)
override
{
const
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
distantNeighbors
[],
const
int
positions
[],
const
int
size
,
const
int
inLevel
)
override
{
// In case usual M2L can be done
const
CellClass
*
normalDistantNeighbors
[
343
];
const
CellClass
*
normalDistantNeighbors
[
189
];
int
normalPositions
[
189
];
int
normalSize
=
0
;
// The current Adaptive cell
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
currentAdaptiveCell
=
nullptr
;
...
...
@@ -187,7 +189,7 @@ public:
currentAdaptiveCell
=
local
;
currentAdaptiveLevel
=
inLevel
;
// Then we may have some M2L to do
memset
(
normalDistantNeighbors
,
0
,
343
*
sizeof
(
CellClass
*
));
memset
(
normalDistantNeighbors
,
0
,
189
*
sizeof
(
CellClass
*
));
}
else
{
// Else we are working with a lower cell
...
...
@@ -195,77 +197,77 @@ public:
currentAdaptiveLevel
=
local
->
getSubAdaptiveLevel
();
}
for
(
int
idxNeigh
=
0
;
idxNeigh
<
343
;
++
idxNeigh
){
if
(
distantNeighbors
[
idxNeigh
]){
// If the current cell is Adaptive and the neighbor too
if
(
distantNeighbors
[
idxNeigh
]
->
isAdaptive
()
&&
local
->
isAdaptive
()){
if
(
distantNeighbors
[
idxNeigh
]
->
hasDevelopment
()
&&
currentAdaptiveCell
->
hasDevelopment
()){
// If both have development than we can use usual M2L
normalDistantNeighbors
[
idxNeigh
]
=
distantNeighbors
[
idxNeigh
]
->
getRealCell
();
normalSize
+=
1
;
}
else
if
(
currentAdaptiveCell
->
hasDevelopment
()){
// If only current cell has development the neighbor has particles
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
distantNeighbors
[
idxNeigh
]
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
distantNeighbors
[
idxNeigh
]
->
getSubLeaf
(
idxLeafSrc
));
}
}
else
if
(
distantNeighbors
[
idxNeigh
]
->
hasDevelopment
()){
// If only current cell has particles the neighbor has development
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
kernel
.
M2P
(
distantNeighbors
[
idxNeigh
]
->
getRealCell
(),
currentAdaptiveLevel
,
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
));
}
}
else
{
// If both have particles
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
distantNeighbors
[
idxNeigh
]
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
distantNeighbors
[
idxNeigh
]
->
getSubLeaf
(
idxLeafSrc
));
}
}
}
}
else
{
const
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
lowerAdaptiveCell
=
distantNeighbors
[
idxNeigh
];
int
lowerAdaptiveLevel
=
inLevel
;
// If we need to look at lower level to find the Adaptive cell
if
(
!
distantNeighbors
[
idxNeigh
]
->
isAdaptive
()){
lowerAdaptiveCell
=
distantNeighbors
[
idxNeigh
]
->
getSubAdaptiveCell
();
lowerAdaptiveLevel
=
distantNeighbors
[
idxNeigh
]
->
getSubAdaptiveLevel
();
}
for
(
int
idxNeighExisting
=
0
;
idxNeighExisting
<
size
;
++
idxNeighExisting
){
const
int
idxNeigh
=
positions
[
idxNeighExisting
];
// If the current cell is Adaptive and the neighbor too
if
(
distantNeighbors
[
idxNeighExisting
]
->
isAdaptive
()
&&
local
->
isAdaptive
()){
if
(
distantNeighbors
[
idxNeighExisting
]
->
hasDevelopment
()
&&
currentAdaptiveCell
->
hasDevelopment
()){
// If both have development than we can use usual M2L
normalDistantNeighbors
[
normalSize
]
=
distantNeighbors
[
idxNeighExisting
]
->
getRealCell
();
normalPositions
[
normalSize
]
=
idxNeigh
;
normalSize
+=
1
;
}
else
if
(
currentAdaptiveCell
->
hasDevelopment
()){
// If only current cell has development the neighbor has particles
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
distantNeighbors
[
idxNeighExisting
]
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
distantNeighbors
[
idxNeighExisting
]
->
getSubLeaf
(
idxLeafSrc
));
}
}
else
if
(
distantNeighbors
[
idxNeighExisting
]
->
hasDevelopment
()){
// If only current cell has particles the neighbor has development
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
kernel
.
M2P
(
distantNeighbors
[
idxNeighExisting
]
->
getRealCell
(),
currentAdaptiveLevel
,
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
));
}
}
else
{
// If both have particles
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
distantNeighbors
[
idxNeighExisting
]
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
distantNeighbors
[
idxNeighExisting
]
->
getSubLeaf
(
idxLeafSrc
));
}
}
}
}
else
{
const
FAdaptiveCell
<
CellClass
,
ContainerClass
>*
lowerAdaptiveCell
=
distantNeighbors
[
idxNeighExisting
];
int
lowerAdaptiveLevel
=
inLevel
;
// If we need to look at lower level to find the Adaptive cell
if
(
!
distantNeighbors
[
idxNeighExisting
]
->
isAdaptive
()){
lowerAdaptiveCell
=
distantNeighbors
[
idxNeighExisting
]
->
getSubAdaptiveCell
();
lowerAdaptiveLevel
=
distantNeighbors
[
idxNeighExisting
]
->
getSubAdaptiveLevel
();
}
if
(
lowerAdaptiveCell
->
hasDevelopment
()
&&
currentAdaptiveCell
->
hasDevelopment
()){
// We are doing a M2L with distant interaction
kernel
.
M2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
lowerAdaptiveCell
->
getRealCell
(),
lowerAdaptiveLevel
);
}
else
if
(
currentAdaptiveCell
->
hasDevelopment
()){
// If only current cell has development the neighbor has particles
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
lowerAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
));
}
}
else
if
(
lowerAdaptiveCell
->
hasDevelopment
()){
// If only current cell has particles the neighbor has development
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
kernel
.
M2P
(
lowerAdaptiveCell
->
getRealCell
(),
lowerAdaptiveLevel
,
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
));
}
}
else
{
// If both have particles
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
lowerAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
));
}
}
}
}
if
(
lowerAdaptiveCell
->
hasDevelopment
()
&&
currentAdaptiveCell
->
hasDevelopment
()){
// We are doing a M2L with distant interaction
kernel
.
M2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
lowerAdaptiveCell
->
getRealCell
(),
lowerAdaptiveLevel
);
}
else
if
(
currentAdaptiveCell
->
hasDevelopment
()){
// If only current cell has development the neighbor has particles
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
lowerAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2L
(
currentAdaptiveCell
->
getRealCell
(),
currentAdaptiveLevel
,
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
));
}
}
else
if
(
lowerAdaptiveCell
->
hasDevelopment
()){
// If only current cell has particles the neighbor has development
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
kernel
.
M2P
(
lowerAdaptiveCell
->
getRealCell
(),
lowerAdaptiveLevel
,
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
));
}
}
else
{
// If both have particles
for
(
int
idxLeafTgt
=
0
;
idxLeafTgt
<
currentAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafTgt
){
for
(
int
idxLeafSrc
=
0
;
idxLeafSrc
<
lowerAdaptiveCell
->
getNbSubLeaves
()
;
++
idxLeafSrc
){
kernel
.
P2P
(
currentAdaptiveCell
->
getSubLeaf
(
idxLeafTgt
),
lowerAdaptiveCell
->
getSubLeaf
(
idxLeafSrc
));
}
}
}
}
}
// If we work on the current cell and it has development
if
(
normalSize
){
kernel
.
M2L
(
local
->
getRealCell
(),
normalDistantNeighbor
s
,
normalSize
,
inLevel
);
kernel
.
M2L
(
local
->
getRealCell
(),
normalDistantNeighbors
,
normalPosition
s
,
normalSize
,
inLevel
);
}
}
...
...
@@ -341,15 +343,15 @@ public:
/** This is a normal P2P */
void
P2P
(
const
FTreeCoordinate
&
inLeafPosition
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
sources
,
ContainerClass
*
const
directNeighborsParticles
[
27
],
const
int
size
)
override
{
kernel
.
P2P
(
inLeafPosition
,
targets
,
sources
,
directNeighborsParticle
s
,
size
);
ContainerClass
*
const
directNeighborsParticles
[],
const
int
positions
[
],
const
int
size
)
override
{
kernel
.
P2P
(
inLeafPosition
,
targets
,
sources
,
directNeighborsParticles
,
position
s
,
size
);
}
/** This is a normal P2P */
void
P2PRemote
(
const
FTreeCoordinate
&
inLeafPosition
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
sources
,
ContainerClass
*
const
directNeighborsParticles
[
27
],
const
int
size
)
override
{
kernel
.
P2PRemote
(
inLeafPosition
,
targets
,
sources
,
directNeighborsParticle
s
,
size
);
ContainerClass
*
const
directNeighborsParticles
[],
const
int
positions
[
],
const
int
size
)
override
{
kernel
.
P2PRemote
(
inLeafPosition
,
targets
,
sources
,
directNeighborsParticles
,
position
s
,
size
);
}
};
...
...
Src/Adaptive/FAdaptivePrintKernel.hpp
View file @
3b1d2118
...
...
@@ -34,12 +34,10 @@ public:
}
}
void
M2L
(
CellClass
*
const
FRestrict
local
,
const
CellClass
*
interactions
[],
const
int
counter
,
const
int
level
)
override
{
void
M2L
(
CellClass
*
const
FRestrict
local
,
const
CellClass
*
interactions
[],
const
int
/*positions*/
[],
const
int
counter
,
const
int
level
)
override
{
std
::
cout
<<
"Usual] M2L Idx = "
<<
local
->
getMortonIndex
()
<<
" at level "
<<
level
<<
" with
\n
"
;
for
(
int
idxInter
=
0
;
idxInter
<
8
;
++
idxInter
){
if
(
interactions
[
idxInter
]){
for
(
int
idxInter
=
0
;
idxInter
<
counter
;
++
idxInter
){
std
::
cout
<<
"
\t
Idx "
<<
interactions
[
idxInter
]
->
getMortonIndex
()
<<
"
\n
"
;
}
}
}
...
...
@@ -58,23 +56,19 @@ public:
void
P2P
(
const
FTreeCoordinate
&
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
,
ContainerClass
*
const
neighs
[
27
],
const
int
)
override
{
ContainerClass
*
const
neighs
[
],
const
int
/*positions*/
[],
const
int
size
)
override
{
std
::
cout
<<
"Usual] P2P @"
<<
targets
<<
" has "
<<
targets
->
getNbParticles
()
<<
" with
\n
"
;
for
(
int
idxNeigh
=
0
;
idxNeigh
<
27
;
++
idxNeigh
){
if
(
neighs
[
idxNeigh
]){
for
(
int
idxNeigh
=
0
;
idxNeigh
<
size
;
++
idxNeigh
){
std
::
cout
<<
"
\t
@"
<<
neighs
[
idxNeigh
]
<<
" has "
<<
neighs
[
idxNeigh
]
->
getNbParticles
()
<<
"
\n
"
;
}
}
}
void
P2PRemote
(
const
FTreeCoordinate
&
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
,
ContainerClass
*
const
neighs
[
27
],
const
int
)
override
{
ContainerClass
*
const
neighs
[
],
const
int
/*positions*/
[],
const
int
size
)
override
{
std
::
cout
<<
"Usual] P2P remote @"
<<
targets
<<
" has "
<<
targets
->
getNbParticles
()
<<
" with
\n
"
;
for
(
int
idxNeigh
=
0
;
idxNeigh
<
27
;
++
idxNeigh
){
if
(
neighs
[
idxNeigh
]){
for
(
int
idxNeigh
=
0
;
idxNeigh
<
size
;
++
idxNeigh
){
std
::
cout
<<
"
\t
@"
<<
neighs
[
idxNeigh
]
<<
" has "
<<
neighs
[
idxNeigh
]
->
getNbParticles
()
<<
"
\n
"
;
}
}
}
...
...
Src/BalanceTree/FChebSymCostKernel.hpp
View file @
3b1d2118
...
...
@@ -197,7 +197,7 @@ public:
}
void
P2M
(
CellClass
*
const
cell
,
const
ContainerClass
*
const
SourceParticles
)
{
void
P2M
(
CellClass
*
const
cell
,
const
ContainerClass
*
const
SourceParticles
)
override
{
FSize
tmpCost
=
countFlopsP2M
(
SourceParticles
->
getNbParticles
());
flopsP2M
+=
tmpCost
;
cell
->
addCost
(
tmpCost
);
...
...
@@ -208,7 +208,7 @@ public:
void
M2M
(
CellClass
*
const
FRestrict
cell
,
const
CellClass
*
const
FRestrict
*
const
FRestrict
ChildCells
,
const
int
/*TreeLevel*/
)
{
const
int
/*TreeLevel*/
)
override
{
FSize
flops
=
0
;
for
(
unsigned
int
ChildIndex
=
0
;
ChildIndex
<
8
;
++
ChildIndex
)
if
(
ChildCells
[
ChildIndex
])
flops
+=
countFlopsM2MorL2L
();
...
...
@@ -221,17 +221,18 @@ public:
void
M2L
(
CellClass
*
const
FRestrict
cell
,
const
CellClass
*
SourceCells
[
343
],
const
int
/* not needed */
,
const
int
/* TreeLevel */
)
const
CellClass
*
/*SourceCells*/
[],
const
int
positions
[],
const
int
size
,
const
int
/* TreeLevel */
)
override
{
FSize
flops
=
0
;
// count how ofter each of the 16 interactions is used
memset
(
countExp
,
0
,
sizeof
(
int
)
*
343
);
for
(
unsigned
int
idx
=
0
;
idx
<
343
;
++
idx
)
if
(
SourceCells
[
idx
])
countExp
[
SymHandler
->
pindices
[
idx
]]
++
;
for
(
int
idx
=
0
;
idx
<
size
;
++
idx
)
countExp
[
SymHandler
->
pindices
[
positions
[
idx
]
]]
++
;
// multiply (mat-mat-mul)
for
(
unsigned
int
pidx
=
0
;
pidx
<
343
;
++
pidx
)
for
(
int
pidx
=
0
;
pidx
<
343
;
++
pidx
)
if
(
countExp
[
pidx
])
flops
+=
countFlopsM2L
(
countExp
[
pidx
],
SymHandler
->
LowRank
[
pidx
])
+
countExp
[
pidx
]
*
nnodes
;
...
...
@@ -243,7 +244,7 @@ public:
void
L2L
(
const
CellClass
*
const
FRestrict
/* not needed */
,
CellClass
*
FRestrict
*
const
FRestrict
ChildCells
,
const
int
/* TreeLevel*/
)
{
const
int
/* TreeLevel*/
)
override
{
FSize
flops
=
0
;
FSize
tmpCost
=
0
;
for
(
unsigned
int
ChildIndex
=
0
;
ChildIndex
<
8
;
++
ChildIndex
)
...
...
@@ -260,7 +261,7 @@ public:
void
L2P
(
const
CellClass
*
const
cell
,
ContainerClass
*
const
TargetParticles
)
{
ContainerClass
*
const
TargetParticles
)
override
{
//// 1.a) apply Sx
//flopsL2P += countFlopsP2MorL2P(TargetParticlesParticles->getNbParticles()) + TargetParticles->getNbParticles();
//// 1.b) apply Px (grad Sx)
...
...
@@ -281,8 +282,9 @@ public:
void
P2P
(
const
FTreeCoordinate
&
LeafCellCoordinate
,
// needed for periodic boundary conditions
ContainerClass
*
const
FRestrict
TargetParticles
,
const
ContainerClass
*
const
FRestrict
SourceParticles
,
ContainerClass
*
const
NeighborSourceParticles
[
27
],
const
int
/* size */
)
{
ContainerClass
*
const
NeighborSourceParticles
[],
const
int
positions
[],
const
int
size
)
override
{
FSize
tmpCost
=
0
;
FSize
srcPartCount
=
SourceParticles
->
getNbParticles
();
FSize
tgtPartCount
=
TargetParticles
->
getNbParticles
();
...
...
@@ -290,13 +292,11 @@ public:
if
(
TargetParticles
!=
SourceParticles
)
{
tmpCost
+=
countFlopsP2P
()
*
tgtPartCount
*
srcPartCount
;
for
(
unsigned
int
idx
=
0
;
idx
<
27
;
++
idx
)
{
if
(
NeighborSourceParticles
[
idx
])
{
for
(
int
idx
=
0
;
idx
<
size
;
++
idx
)
{
tmpCost
+=
countFlopsP2P
()
*
tgtPartCount
*
NeighborSourceParticles
[
idx
]
->
getNbParticles
();
}
*
NeighborSourceParticles
[
idx
]
->
getNbParticles
();
}
}
else
{
tmpCost
+=
...
...
@@ -304,15 +304,13 @@ public:
*
((
tgtPartCount
*
tgtPartCount
+
tgtPartCount
)
/
2
);
for
(
unsigned
int
idx
=
0
;
idx
<=
13
;
++
idx
)
for
(
int
idx
=
0
;
idx
<
size
&&
positions
[
idx
]
<=
13
;
++
idx
)
{
if
(
NeighborSourceParticles
[
idx
])
{
tmpCost
+=
countFlopsP2Pmutual
()
*
tgtPartCount
*
NeighborSourceParticles
[
idx
]
->
getNbParticles
();
}
}
}
flopsP2P
+=
tmpCost
;
...
...
Src/BalanceTree/FDumbCostKernel.hpp
View file @
3b1d2118
...
...
@@ -113,7 +113,7 @@ public:
// delete [] _countExp;
}
void
P2M
(
CellClass
*
const
cell
,
const
ContainerClass
*
const
SourceParticles
)
{
void
P2M
(
CellClass
*
const
cell
,
const
ContainerClass
*
const
SourceParticles
)
override
{
FSize
tmpCost
=
SourceParticles
->
getNbParticles
();
flopsP2M
+=
tmpCost
;
cell
->
addCost
(
tmpCost
);
...
...
@@ -123,7 +123,7 @@ public:
void
M2M
(
CellClass
*
const
FRestrict
cell
,
const
CellClass
*
const
FRestrict
*
const
FRestrict
ChildrenCells
,
const
int
/*TreeLevel*/
)
{
const
int
/*TreeLevel*/
)
override
{
FSize
flops
=
0
;
for
(
unsigned
int
childIdx
=
0
;
childIdx
<
8
;
++
childIdx
)
if
(
ChildrenCells
[
childIdx
]
)
...
...
@@ -135,16 +135,15 @@ public:
void
M2L
(
CellClass
*
const
FRestrict
cell
,
const
CellClass
*
SourceCells
[
343
],
const
int
/* not needed */
,
const
int
/* TreeLevel */
)
{
const
CellClass
*
/*SourceCells*/
[],
const
int
/*positions*/
[],
const
int
size
,
const
int
/* TreeLevel */
)
override
{
FSize
flops
=
0
;
// count how often each of the 16 interactions is used
memset
(
_countExp
,
0
,
sizeof
(
int
)
*
343
);
for
(
unsigned
int
idx
=
0
;
idx
<
343
;
++
idx
)
{
if
(
SourceCells
[
idx
]
)
{
flops
+=
1
;
}
memset
(
_countExp
,
0
,
sizeof
(
int
)
*
343
);
for
(
int
idx
=
0
;
idx
<
size
;
++
idx
)
{
flops
+=
1
;
}
flopsM2L
+=
flops
;
...
...
@@ -155,7 +154,7 @@ public:
void
L2L
(
const
CellClass
*
const
FRestrict
/* not needed */
,
CellClass
*
FRestrict
*
const
FRestrict
ChildCells
,
const
int
/* TreeLevel*/
)
{
const
int
/* TreeLevel*/
)
override
{
FSize
flops
=
0
;
FSize
tmpCost
=
0
;
for
(
unsigned
int
childIdx
=
0
;
childIdx
<
8
;
++
childIdx
)
{
...
...
@@ -173,7 +172,7 @@ public:
void
L2P
(
const
CellClass
*
const
cell
,
ContainerClass
*
const
TargetParticles
)
{
ContainerClass
*
const
TargetParticles
)
override
{
FSize
tmpCost
=
TargetParticles
->
getNbParticles
();
flopsL2P
+=
tmpCost
;
cell
->
addCost
(
tmpCost
);
...
...
@@ -185,8 +184,9 @@ public:
void
P2P
(
const
FTreeCoordinate
&
LeafCellCoordinate
,
// needed for periodic boundary conditions
ContainerClass
*
const
FRestrict
TargetParticles
,
const
ContainerClass
*
const
FRestrict
SourceParticles
,
ContainerClass
*
const
NeighborSourceParticles
[
27
],
const
int
/* size */
)
{
ContainerClass
*
const
/*NeighborSourceParticles*/
[],
const
int
/*positions*/
[],
const
int
size
)
override
{
FSize
srcPartCount
=
SourceParticles
->
getNbParticles
();
FSize
tgtPartCount
=
TargetParticles
->
getNbParticles
();
...
...
Src/BalanceTree/FFmmAlgorithmThreadBalanced.hpp
View file @
3b1d2118
...
...
@@ -320,19 +320,21 @@ protected:
// Cell count in zone (for this level)
int
zoneCellCount
=
costzones
.
at
(
threadNum
).
at
(
level
).
second
;
// Array for cell neighbours
const
CellClass
*
neighbours
[
343
];
const
CellClass
*
neighbours
[
342
];
int
neighborPositions
[
342
];
// Call M2L kernel on cells
while
(
zoneCellCount
--
>
0
)
{
const
int
counter
=
tree
->
getInteractionNeighbors
(
neighbours
,
neighbours
,
neighborPositions
,
zoneIterator
.
getCurrentGlobalCoordinate
(),
level
);
if
(
counter
)
myThreadkernels
->
M2L
(
zoneIterator
.
getCurrentCell
(),
neighbours
,
neighborPositions
,
counter
,
level
);
zoneIterator
.
moveRight
();
...
...
@@ -439,7 +441,8 @@ protected:
// Cell count in zone (for this level)
int
zoneCellCount
;
// Cell neighbours
ContainerClass
*
neighbours
[
27
];
ContainerClass
*
neighbours
[
26
];
int
neighborPositions
[
26
];
// Cell data
LeafData
leafdata
;
...
...
@@ -474,7 +477,7 @@ protected:
if
(
p2pEnabled
)
{
// needs the current particles and neighbours particles
const
int
counter
=
tree
->
getLeafsNeighbors
(
neighbours
,
tree
->
getLeafsNeighbors
(
neighbours
,
neighborPositions
,
leafdata
.
cell
->
getCoordinate
(),
OctreeHeight
-
1
);
// Leaf level
...
...
@@ -482,6 +485,7 @@ protected:
leafdata
.
targets
,
leafdata
.
sources
,
neighbours
,
neighborPositions
,
counter
);
}
...
...
Src/Components/FAbstractKernels.hpp
View file @
3b1d2118
...
...
@@ -63,11 +63,25 @@ public:
* M2L
* Multipole to local
* @param local the element to fill using distant neighbors
* @param distantNeighbors is an array containing fathers's direct neighbors's child - direct neigbors
* @param distantNeighbors is an array containing fathers's direct neighbors's child - direct neigbors (max 189)
* @param neighborPositions the relative position of the neighbor (between O and 342)
* @param size the number of neighbors
* @param inLevel the current level of the computation
*
* @code // the code was:
* @code for(int idxNeigh = 0 ; idxNeigh < 343 ; ++idxNeigh){
* @code if(distantNeighbors[idxNeigh]){
* @code ...
* @code }
* @code }
* @code // Now it must be :
* @code for(int idxExistingNeigh = 0 ; idxExistingNeigh < size ; ++idxExistingNeigh){
* @code const int idxNeigh = neighborPositions[idxExistingNeigh]
* @code distantNeighbors[idxExistingNeigh]...
* @code }
*/
virtual
void
M2L
(
CellClass
*
const
FRestrict
local
,
const
CellClass
*
distantNeighbors
[
343
],
virtual
void
M2L
(
CellClass
*
const
FRestrict
local
,
const
CellClass
*
distantNeighbors
[],
const
int
neighborPositions
[],
const
int
size
,
const
int
inLevel
)
=
0
;
...
...
@@ -113,12 +127,14 @@ public:
* @param inLeafPosition tree coordinate of the leaf
* @param targets current boxe targets particles
* @param sources current boxe sources particles (can be == to targets)
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list)
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list) max length = 26
* @param neighborPositions the relative position of the neighbors (between O and 25) max length = 26
* @param size the number of direct neighbors
*/
virtual
void
P2P
(
const
FTreeCoordinate
&
inLeafPosition
,
ContainerClass
*
const
FRestrict
targets
,
const
ContainerClass
*
const
FRestrict
sources
,
ContainerClass
*
const
directNeighborsParticles
[
27
],
const
int
size
)
=
0
;
ContainerClass
*
const
directNeighborsParticles
[],
const
int
neighborPositions
[],
const
int
size
)
=
0
;
/**
* P2P
...
...
@@ -126,7 +142,8 @@ public:
* @param inLeafPosition tree coordinate of the leaf
* @param targets current boxe targets particles
* @param sources current boxe sources particles (can be == to targets)
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list)
* @param directNeighborsParticles the particles from direct neighbors (this is an array of list) max length = 26
* @param neighborPositions the relative position of the neighbors (between 0 and 25) max length = 26
* @param size the number of direct neighbors
*
* This method is called by the MPI algorithm with leaves from other hosts.
...
...
@@ -135,7 +152,8 @@ public:
*/
virtual
void
P2PRemote
(
const
FTreeCoordinate
&
/*inLeafPosition*/
,
ContainerClass
*
const
FRestrict
/*targets*/
,
const
ContainerClass
*
const
FRestrict
/*sources*/
,
ContainerClass
*
const
/*directNeighborsParticles*/
[
27
],
const
int
/*size*/
)
{
ContainerClass
*
const
/*directNeighborsParticles*/
[],
const
int
/*neighborPositions*/
[],
const
int
/*size*/
)
{
FLOG
(
FLog
::
Controller
.
write
(
"Warning, P2P remote is used but not implemented!"
).
write
(
FLog
::
Flush
)
);
}
...
...
Src/Components/FBasicKernels.hpp
View file @
3b1d2118
...
...
@@ -35,42 +35,43 @@ public:
}
/** Do nothing */
virtual
void
P2M
(
CellClass
*
const
,
const
ContainerClass
*
const
)
{
virtual
void
P2M
(
CellClass
*
const
/*targetCell*/
,
const
ContainerClass
*
const
/*sourceParticles*/
)
override
{
}
/** Do nothing */
virtual
void
M2M
(
CellClass
*
const
FRestrict
,
const
CellClass
*
const
FRestrict
*
const
FRestrict
,
const
int
)
{
virtual
void
M2M
(
CellClass
*
const
FRestrict
/*parentCell*/
,
const
CellClass
*
const
FRestrict
*
const
FRestrict
/*children*/
,
const
int
/*level*/
)
override
{
}
/** Do nothing */
virtual
void
M2L
(
CellClass
*
const
FRestrict
,
const
CellClass
*
[],
const
int
,
const
int
)
{
virtual
void
M2L
(
CellClass
*
const
FRestrict
/*targetLocal*/
,
const
CellClass
*
/*sourceMultipoles*/
[],
const
int
/*relativePostions*/
[],
const
int
/*nbInteractions*/
,
const
int
/*level*/
)
override
{
}
/** Do nothing */
virtual
void
L2L
(
const
CellClass
*
const
FRestrict
,
CellClass
*
FRestrict
*
const
FRestrict
,
const
int
)
{
virtual
void
L2L
(
const
CellClass
*
const
FRestrict
/*parentCell*/
,
CellClass
*
FRestrict
*
const
FRestrict
/*children*/
,
const
int
/*level*/
)
override
{
}
/** Do nothing */
virtual
void
L2P
(
const
CellClass
*
const
,
ContainerClass
*
const
)
{
virtual
void
L2P
(
const
CellClass
*
const
/*sourceCell*/
,
ContainerClass
*
const
/*targetPaticles*/
)
override
{
}
/** Do nothing */
virtual
void
P2P
(
const
FTreeCoordinate
&
,
ContainerClass
*
const
FRestrict
,
const
ContainerClass
*
const
FRestrict
,
ContainerClass
*
const
[
27
],
const
int
)
{
virtual
void
P2P
(
const
FTreeCoordinate
&
/*treeCoord*/
,
ContainerClass
*
const
FRestrict
/*targetParticles*/
,
const
ContainerClass
*
const
FRestrict
/*sourceParticles*/