Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
solverstack
ScalFMM
Commits
11dfe6d8
Commit
11dfe6d8
authored
9 years ago
by
BRAMAS Berenger
Browse files
Options
Downloads
Patches
Plain Diff
Add a rotation mpi test
parent
e3ce6854
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Tests/Kernels/testRotationAlgorithmProc.cpp
+153
-0
153 additions, 0 deletions
Tests/Kernels/testRotationAlgorithmProc.cpp
with
153 additions
and
0 deletions
Tests/Kernels/testRotationAlgorithmProc.cpp
0 → 100644
+
153
−
0
View file @
11dfe6d8
// ===================================================================================
// Copyright ScalFmm 2011 INRIA, Olivier Coulaud, Berenger Bramas
// olivier.coulaud@inria.fr, berenger.bramas@inria.fr
// This software is a computer program whose purpose is to compute the FMM.
//
// This software is governed by the CeCILL-C and LGPL licenses and
// abiding by the rules of distribution of free software.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public and CeCILL-C Licenses for more details.
// "http://www.cecill.info".
// "http://www.gnu.org/licenses".
// ===================================================================================
// ==== CMAKE =====
// @FUSE_MPI
// @FUSE_BLAS
// ================
#include
<iostream>
#include
<cstdio>
#include
<cstdlib>
#include
"../../Src/Kernels/Rotation/FRotationCell.hpp"
#include
"../../Src/Kernels/Rotation/FRotationKernel.hpp"
#include
"../../Src/Components/FSimpleLeaf.hpp"
#include
"../../Src/Kernels/P2P/FP2PParticleContainerIndexed.hpp"
#include
"../../Src/Utils/FParameters.hpp"
#include
"../../Src/Utils/FMemUtils.hpp"
#include
"../../Src/Containers/FOctree.hpp"
#include
"../../Src/Containers/FVector.hpp"
#include
"../../Src/Files/FRandomLoader.hpp"
#include
"../../Src/Files/FMpiTreeBuilder.hpp"
#include
"../../Src/Core/FFmmAlgorithm.hpp"
#include
"../../Src/Core/FFmmAlgorithmThread.hpp"
#include
"../../Src/Core/FFmmAlgorithmThreadProc.hpp"
#include
"../../Src/BalanceTree/FLeafBalance.hpp"
#include
"../../Src/Utils/FParameterNames.hpp"
/**
* This program runs the FMM Algorithm Distributed with the Rotation kernel
*/
// Simply create particles and try the kernels
int
main
(
int
argc
,
char
*
argv
[])
{
FHelpDescribeAndExit
(
argc
,
argv
,
"Test with MPI the chebyshev FMM and compare it to the direct computation for debugging purpose."
,
FParameterDefinitions
::
NbParticles
,
FParameterDefinitions
::
OctreeHeight
,
FParameterDefinitions
::
OctreeSubHeight
,
FParameterDefinitions
::
NbThreads
);
typedef
double
FReal
;
const
unsigned
int
ORDER
=
5
;
typedef
FP2PParticleContainerIndexed
<
FReal
>
ContainerClass
;
typedef
FSimpleLeaf
<
FReal
,
ContainerClass
>
LeafClass
;
typedef
FRotationCell
<
FReal
,
ORDER
>
CellClass
;
typedef
FOctree
<
FReal
,
CellClass
,
ContainerClass
,
LeafClass
>
OctreeClass
;
typedef
FRotationKernel
<
FReal
,
CellClass
,
ContainerClass
,
ORDER
>
KernelClass
;
typedef
FFmmAlgorithmThreadProc
<
OctreeClass
,
CellClass
,
ContainerClass
,
KernelClass
,
LeafClass
>
FmmClass
;
FMpi
app
(
argc
,
argv
);
const
FSize
nbParticles
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
NbParticles
.
options
,
10000000ULL
);
const
unsigned
int
TreeHeight
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
OctreeHeight
.
options
,
5
);
const
unsigned
int
SubTreeHeight
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
OctreeSubHeight
.
options
,
2
);
const
unsigned
int
NbThreads
=
FParameters
::
getValue
(
argc
,
argv
,
FParameterDefinitions
::
NbThreads
.
options
,
omp_get_max_threads
());
FTic
time
;
std
::
cout
<<
">> This executable has to be used to test Proc Rotation Algorithm.
\n
"
;
omp_set_num_threads
(
NbThreads
);
std
::
cout
<<
"
\n
>> Using "
<<
omp_get_max_threads
()
<<
" threads.
\n
"
<<
std
::
endl
;
// init particles position and physical value
struct
TestParticle
{
FPoint
<
FReal
>
position
;
FReal
physicalValue
;
const
FPoint
<
FReal
>&
getPosition
(){
return
position
;
}
};
// open particle file
std
::
cout
<<
"Creating : "
<<
nbParticles
<<
"
\n
"
<<
std
::
endl
;
FRandomLoader
<
FReal
>
loader
(
nbParticles
,
1.0
,
FPoint
<
FReal
>
(
0
,
0
,
0
),
app
.
global
().
processId
());
OctreeClass
tree
(
TreeHeight
,
SubTreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
time
.
tic
();
TestParticle
*
particles
=
new
TestParticle
[
loader
.
getNumberOfParticles
()];
memset
(
particles
,
0
,(
unsigned
int
)
(
sizeof
(
TestParticle
)
*
loader
.
getNumberOfParticles
()));
for
(
FSize
idxPart
=
0
;
idxPart
<
loader
.
getNumberOfParticles
()
;
++
idxPart
){
loader
.
fillParticle
(
&
particles
[
idxPart
].
position
);
particles
[
idxPart
].
physicalValue
=
1.0
;
}
FVector
<
TestParticle
>
finalParticles
;
FLeafBalance
balancer
;
FMpiTreeBuilder
<
FReal
,
TestParticle
>::
DistributeArrayToContainer
(
app
.
global
(),
particles
,
loader
.
getNumberOfParticles
(),
tree
.
getBoxCenter
(),
tree
.
getBoxWidth
(),
tree
.
getHeight
(),
&
finalParticles
,
&
balancer
);
{
// -----------------------------------------------------
std
::
cout
<<
"Creating & Inserting "
<<
loader
.
getNumberOfParticles
()
<<
" particles ..."
<<
std
::
endl
;
std
::
cout
<<
"For a total of "
<<
loader
.
getNumberOfParticles
()
*
app
.
global
().
processCount
()
<<
" particles ..."
<<
std
::
endl
;
std
::
cout
<<
"
\t
Height : "
<<
TreeHeight
<<
"
\t
sub-height : "
<<
SubTreeHeight
<<
std
::
endl
;
time
.
tic
();
for
(
FSize
idxPart
=
0
;
idxPart
<
finalParticles
.
getSize
()
;
++
idxPart
){
// put in tree
tree
.
insert
(
finalParticles
[
idxPart
].
position
,
idxPart
,
finalParticles
[
idxPart
].
physicalValue
);
}
time
.
tac
();
std
::
cout
<<
"Done "
<<
"(@Creating and Inserting Particles = "
<<
time
.
elapsed
()
<<
"s)."
<<
std
::
endl
;
}
// -----------------------------------------------------
delete
[]
particles
;
particles
=
0
;
{
// -----------------------------------------------------
std
::
cout
<<
"
\n
Rotation FMM (ORDER="
<<
ORDER
<<
") ... "
<<
std
::
endl
;
time
.
tic
();
KernelClass
kernels
(
TreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
());
FmmClass
algorithm
(
app
.
global
(),
&
tree
,
&
kernels
);
time
.
tac
();
std
::
cout
<<
"Done "
<<
"(@Init = "
<<
time
.
elapsed
()
<<
"s)."
<<
std
::
endl
;
time
.
tic
();
algorithm
.
execute
();
time
.
tac
();
std
::
cout
<<
"Done "
<<
"(@Algorithm = "
<<
time
.
elapsed
()
<<
"s)."
<<
std
::
endl
;
}
// -----------------------------------------------------
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment