Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
5
Issues
5
List
Boards
Labels
Milestones
Packages
Packages
Container Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
0e30f4d3
Commit
0e30f4d3
authored
Jan 30, 2019
by
COULAUD Olivier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix some problems
parent
fec0225f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
54 deletions
+54
-54
Examples/MPIInterpolationFMM.hpp
Examples/MPIInterpolationFMM.hpp
+54
-54
No files found.
Examples/MPIInterpolationFMM.hpp
View file @
0e30f4d3
...
...
@@ -24,8 +24,6 @@
#include "Utils/FLeafBalance.hpp"
#include "Kernels/Interpolation/FInterpMatrixKernel.hpp"
#include "Kernels/Chebyshev/FChebSymKernel.hpp"
#include "Kernels/Chebyshev/FChebCell.hpp"
#include "Components/FSimpleLeaf.hpp"
#include "Kernels/P2P/FP2PParticleContainerIndexed.hpp"
...
...
@@ -80,9 +78,12 @@ int main(int argc, char* argv[])
FParameterDefinitions
::
NbThreads
,
FParameterDefinitions
::
PeriodicityNbLevels
,
localIncreaseBox
)
;
)
;
// Initialize values for MPI
FMpi
app
(
argc
,
argv
);
const
bool
masterIO
=
(
app
.
global
().
processId
()
==
0
);
//
const
std
::
string
defaultFile
(
"../Data/test20k.fma"
);
const
std
::
string
filename
=
FParameters
::
getStr
(
argc
,
argv
,
FParameterDefinitions
::
InputFile
.
options
,
defaultFile
.
c_str
());
const
unsigned
int
TreeHeight
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
OctreeHeight
.
options
,
5
);
...
...
@@ -95,27 +96,25 @@ int main(int argc, char* argv[])
const
unsigned
int
aboveTree
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
PeriodicityNbLevels
.
options
,
5
);
omp_set_num_threads
(
NbThreads
);
std
::
cout
<<
"
\n
>> Using "
<<
omp_get_max_threads
()
<<
" threads.
\n
"
<<
std
::
endl
;
//
std
::
cout
<<
"Parameters"
<<
std
::
endl
<<
" Octree Depth "
<<
TreeHeight
<<
std
::
endl
<<
" SubOctree depth "
<<
SubTreeHeight
<<
std
::
endl
;
if
(
periodicCondition
){
if
(
masterIO
){
std
::
cout
<<
"
\n
>> Using "
<<
omp_get_max_threads
()
<<
" threads.
\n
"
<<
std
::
endl
;
//
std
::
cout
<<
"Parameters"
<<
std
::
endl
<<
" Octree Depth "
<<
TreeHeight
<<
std
::
endl
<<
" SubOctree depth "
<<
SubTreeHeight
<<
std
::
endl
;
if
(
periodicCondition
){
std
::
cout
<<
" AboveTree "
<<
aboveTree
<<
std
::
endl
;
}
std
::
cout
<<
" Input file name: "
<<
filename
<<
std
::
endl
<<
" Thread count : "
<<
NbThreads
<<
std
::
endl
<<
std
::
endl
;
std
::
cout
<<
" Input file name: "
<<
filename
<<
std
::
endl
<<
" Thread count : "
<<
NbThreads
<<
std
::
endl
<<
std
::
endl
;
}
///////// VAR INIT /////////////////////////////////////////////////
// Initialize values for MPI
FMpi
app
(
argc
,
argv
);
const
bool
masterIO
=
(
app
.
global
().
processId
()
==
0
);
//
// Initialize timer
FTic
time
;
...
...
@@ -221,21 +220,19 @@ int main(int argc, char* argv[])
}
// -----------------------------------------------------
std
::
vector
<
MortonIndex
>
mortonLeafDistribution
(
2
*
app
.
global
().
processCount
());
FAbstractAlgorithm
*
algorithm
=
nullptr
;
FAlgorithmTimers
*
timer
=
nullptr
;
{
// -----------------------------------------------------
// -----------------------------------------------------
if
(
masterIO
)
{
std
::
cout
<<
"
\n
"
<<
interpolationType
<<
" FMM Proc (ORDER="
<<
ORDER
<<
") ... "
<<
std
::
endl
;
}
time
.
tic
();
// Kernels to use (pointer because of the limited size of the stack)
// non periodic FMM algorithm
std
::
unique_ptr
<
KernelClass
>
kernelsNoPer
(
new
KernelClass
(
TreeHeight
,
boxWidth
,
loader
.
getCenterOfBox
(),
&
MatrixKernel
));
loader
.
getCenterOfBox
(),
&
MatrixKernel
));
FmmClassProc
algoNoPer
(
app
.
global
(),
&
tree
,
kernelsNoPer
.
get
());
//
// periodic FMM algorithm
...
...
@@ -256,20 +253,20 @@ int main(int argc, char* argv[])
}
//
// FMM exectution FFmmFarField FFmmNearField FFmmP2M|FFmmM2M|FFmmM2L|FFmmL2L
time
.
tic
();
algorithm
->
execute
();
time
.
tac
();
//
algorithm
->
getMortonLeafDistribution
(
mortonLeafDistribution
);
if
(
masterIO
)
{
std
::
cout
<<
app
.
global
().
processId
()
<<
" Morton distribution "
<<
std
::
endl
;
for
(
auto
v
:
mortonLeafDistribution
)
std
::
cout
<<
v
<<
" "
;
//
if(masterIO)
//
{
//
std::cout << app.global().processId() <<" Morton distribution "<< std::endl ;
//
for(auto v : mortonLeafDistribution)
//
std::cout << v << " ";
std
::
cout
<<
std
::
endl
;
}
app
.
global
().
barrier
();
time
.
tac
();
// std::cout << std::endl;
// }
// app.global().barrier();
timeUsed
=
time
.
elapsed
();
MPI_Reduce
(
&
timeUsed
,
&
minTime
,
1
,
MPI_DOUBLE
,
MPI_MIN
,
0
,
app
.
global
().
getComm
());
MPI_Reduce
(
&
timeUsed
,
&
maxTime
,
1
,
MPI_DOUBLE
,
MPI_MAX
,
0
,
app
.
global
().
getComm
());
...
...
@@ -287,7 +284,7 @@ int main(int argc, char* argv[])
<<
std
::
endl
;
}
}
// -----------------------------------------------------
//
...
...
@@ -321,33 +318,36 @@ int main(int argc, char* argv[])
const
FVector
<
FSize
>&
indexes
=
leaf
->
getTargets
()
->
getIndexes
();
for
(
FSize
idxPart
=
0
;
idxPart
<
nbParticlesInLeaf
;
++
idxPart
){
const
FSize
indexPartOrig
=
indexes
[
idxPart
];
if
((
indexPartOrig
==
N1
)
||
(
indexPartOrig
==
N2
)
||
(
indexPartOrig
==
N3
)
)
{
std
::
cout
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Index "
<<
indexPartOrig
<<
" potential "
<<
potentials
[
idxPart
]
<<
" Pos "
<<
posX
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
}
energy
+=
potentials
[
idxPart
]
*
physicalValues
[
idxPart
]
;
locTotalPhysicalValue
+=
physicalValues
[
idxPart
]
;
}
});
const
FSize
indexPartOrig
=
indexes
[
idxPart
];
if
((
indexPartOrig
==
N1
)
||
(
indexPartOrig
==
N2
)
||
(
indexPartOrig
==
N3
)
)
{
std
::
cout
<<
"Proc "
<<
app
.
global
().
processId
()
<<
" Index "
<<
indexPartOrig
<<
" potential "
<<
potentials
[
idxPart
]
<<
" Pos "
<<
posX
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
" Forces: "
<<
forcesX
[
idxPart
]
<<
" "
<<
forcesY
[
idxPart
]
<<
" "
<<
forcesZ
[
idxPart
]
<<
std
::
endl
;
}
energy
+=
potentials
[
idxPart
]
*
physicalValues
[
idxPart
]
;
locTotalPhysicalValue
+=
physicalValues
[
idxPart
]
;
}
});
FReal
gloEnergy
=
app
.
global
().
reduceSum
(
energy
);
FReal
TotalPhysicalValue
=
app
.
global
().
reduceSum
(
locTotalPhysicalValue
);
if
(
masterIO
){
std
::
cout
<<
std
::
endl
<<
"aboveRoot: "
<<
aboveTree
<<
" Energy: "
<<
gloEnergy
<<
" TotalPhysicalValue: "
<<
TotalPhysicalValue
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
<<
std
::
endl
;
}
std
::
cout
<<
std
::
endl
<<
"aboveRoot: "
<<
aboveTree
<<
" Energy: "
<<
gloEnergy
<<
" TotalPhysicalValue: "
<<
TotalPhysicalValue
<<
std
::
endl
;
std
::
cout
<<
std
::
endl
<<
" &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& "
<<
std
::
endl
<<
std
::
endl
;
}
}
// -----------------------------------------------------
if
(
FParameters
::
existParameter
(
argc
,
argv
,
FParameterDefinitions
::
OutputFile
.
options
)){
std
::
string
name
(
FParameters
::
getStr
(
argc
,
argv
,
FParameterDefinitions
::
OutputFile
.
options
,
"output.fma"
));
FMpiFmaGenericWriter
<
FReal
>
paraWriter
(
name
,
app
);
paraWriter
.
writeDistributionOfParticlesFromOctree
(
tree
,
loader
.
getNumberOfParticles
(),
localParticlesNumber
,
mortonLeafDistribution
);
std
::
vector
<
MortonIndex
>
mortonLeafDistribution
(
2
*
app
.
global
().
processCount
());
algorithm
->
getMortonLeafDistribution
(
mortonLeafDistribution
);
std
::
string
name
(
FParameters
::
getStr
(
argc
,
argv
,
FParameterDefinitions
::
OutputFile
.
options
,
"output.fma"
));
FMpiFmaGenericWriter
<
FReal
>
paraWriter
(
name
,
app
);
paraWriter
.
writeDistributionOfParticlesFromOctree
(
tree
,
loader
.
getNumberOfParticles
(),
localParticlesNumber
,
mortonLeafDistribution
);
}
}
return
0
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment