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
4540806e
Commit
4540806e
authored
Dec 17, 2017
by
COULAUD Olivier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Now Let and duplicated are merged
parent
c3e0c4a8
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
314 additions
and
331 deletions
+314
-331
CMakeLists.txt
CMakeLists.txt
+1
-1
Examples/sharedMemoryInterpolationFMM.hpp
Examples/sharedMemoryInterpolationFMM.hpp
+1
-1
Src/Files/FMpiFmaGenericLoader.hpp
Src/Files/FMpiFmaGenericLoader.hpp
+2
-4
Src/GroupTree/Core/FBuildGroupTree.hpp
Src/GroupTree/Core/FBuildGroupTree.hpp
+19
-10
Src/GroupTree/Core/FCheckResults.hpp
Src/GroupTree/Core/FCheckResults.hpp
+3
-3
Src/GroupTree/Core/FGroupOfCells.hpp
Src/GroupTree/Core/FGroupOfCells.hpp
+10
-10
Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp
Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp
+47
-43
Src/GroupTree/Core/FGroupTools.hpp
Src/GroupTree/Core/FGroupTools.hpp
+15
-10
Src/GroupTree/Core/FGroupTree.hpp
Src/GroupTree/Core/FGroupTree.hpp
+64
-46
Src/Utils/FMath.hpp
Src/Utils/FMath.hpp
+4
-4
Src/Utils/FValidationAlgorithm.hpp
Src/Utils/FValidationAlgorithm.hpp
+9
-8
Tests/GroupTree/testBlockedImplicitUniform.cpp
Tests/GroupTree/testBlockedImplicitUniform.cpp
+106
-160
Tests/LET_STF_Implicit/testFMMInterpolationStarPU.hpp
Tests/LET_STF_Implicit/testFMMInterpolationStarPU.hpp
+33
-31
No files found.
CMakeLists.txt
View file @
4540806e
...
...
@@ -386,7 +386,7 @@ if (MORSE_DISTRIB_DIR OR EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/morse/
endif
()
message
(
STATUS
"check BLAS Fortran mangling"
)
# add options to let the user be able to force a behavior
option
(
SCALFMM_BLAS_ADD_
"Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)"
O
FF
)
option
(
SCALFMM_BLAS_ADD_
"Set to ON to force calls to BLAS Fortran symbols with _ (ex: dgemm_)"
O
N
)
option
(
SCALFMM_BLAS_UPCASE
"Set to ON to force calls to BLAS Fortran symbols in capital (ex: DGEMM)"
OFF
)
option
(
SCALFMM_BLAS_NOCHANGE
"Set to ON to force calls to BLAS Fortran symbols with no change (ex: dgemm)"
OFF
)
# if options not changed by user then auto-detection
...
...
Examples/sharedMemoryInterpolationFMM.hpp
View file @
4540806e
...
...
@@ -44,7 +44,7 @@
//
//
// Order of the Interpolation approximation
static
const
unsigned
ORDER
=
7
;
static
const
unsigned
ORDER
=
6
;
using
FReal
=
double
;
// 1/r kernel
//
...
...
Src/Files/FMpiFmaGenericLoader.hpp
View file @
4540806e
...
...
@@ -220,7 +220,7 @@ public:
// Construct the local number of particles on my process
FSize
nbLocalParticles
=
0
,
maxPartLeaf
=
0
;
MortonIndex
starIndex
=
mortonLeafDistribution
[
2
*
myRank
],
endIndex
=
mortonLeafDistribution
[
2
*
myRank
+
1
];
myOctree
.
template
forEachCell
My
Leaf
<
typename
OCTREECLASS
::
LeafClass_T
>(
myOctree
.
template
forEachCellLeaf
<
typename
OCTREECLASS
::
LeafClass_T
>(
[
&
](
typename
OCTREECLASS
::
GroupSymbolCellClass_T
*
gsymb
,
typename
OCTREECLASS
::
GroupCellUpClass_T
*
/* gmul */
,
typename
OCTREECLASS
::
GroupCellDownClass_T
*
/* gloc */
,
...
...
@@ -242,7 +242,7 @@ public:
MPI_Offset
offset
=
_headerSize
+
sizeType
*
_nbDataTowritePerRecord
*
before
;
//
// Write particles in file
myOctree
.
template
forEachCell
My
Leaf
<
typename
OCTREECLASS
::
LeafClass_T
>(
myOctree
.
template
forEachCellLeaf
<
typename
OCTREECLASS
::
LeafClass_T
>(
[
&
](
typename
OCTREECLASS
::
GroupSymbolCellClass_T
*
gsymb
,
typename
OCTREECLASS
::
GroupCellUpClass_T
*
/* gmul */
,
typename
OCTREECLASS
::
GroupCellDownClass_T
*
/* gloc */
,
...
...
@@ -333,7 +333,5 @@ public:
}
;
#ifdef __EXPRIMENTAL_DOESNT_WORK
#endif
#endif //FMPIFMAGENERICLOADER_HPP
Src/GroupTree/Core/FBuildGroupTree.hpp
View file @
4540806e
...
...
@@ -52,7 +52,6 @@ namespace groupTree {
){
//
const
std
::
size_t
max_level
=
sizeof
(
MortonIndex
)
*
8
/
3
;
const
FSize
totalNumberOfParticles
=
loader
.
getNumberOfParticles
()
;
const
FSize
localNumberOfParticles
=
loader
.
getMyNumberOfParticles
()
;
myParticles
.
resize
(
localNumberOfParticles
)
;
...
...
@@ -74,11 +73,12 @@ namespace groupTree {
inria
::
sort
(
mpi_comm
,
myParticles
,
[](
const
auto
&
p1
,
const
auto
&
p2
)
{
return
p1
.
morton_index
<
p2
.
morton_index
;
});
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
const
FSize
totalNumberOfParticles
=
loader
.
getNumberOfParticles
()
;
std
::
cout
<<
" I have "
<<
myParticles
.
size
()
<<
" particles ..."
<<
std
::
endl
;
std
::
cout
<<
"For a total of "
<<
totalNumberOfParticles
<<
" particles ..."
<<
std
::
endl
;
#endif
// create the linear tree
// a linear tree is a tree, with only the leaf
int
level
=
TreeHeight
-
1
;
...
...
@@ -120,7 +120,9 @@ namespace groupTree {
width
,
width
/
FReal
(
1
<<
(
TreeHeight
-
1
)));
// Now i can fill the localGroupTree
localGroupTree
->
create_tree
(
group_linear_tree
,
myParticles
);
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
localGroupTree
->
printInfoBlocks
();
#endif
// get the index particle distribution (needed by the algorithm)
m_idx_distribution
=
group_linear_tree
.
get_index_particle_distribution_implicit
();
...
...
@@ -151,10 +153,12 @@ namespace groupTree {
//
// Build the groupe size of all groups in the Tree (sequential one)
//
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
std
::
cout
<<
"Morton distribution inside BuilddMortonDistributionForCGroupCellInTree "
<<
std
::
endl
;
for
(
auto
v
:
MortonIndexDistribution
)
std
::
cout
<<
" "
<<
v
;
std
::
cout
<<
std
::
endl
;
#endif
int
processId
;
for
(
processId
=
0
;
processId
<
nproc
;
++
processId
)
{
...
...
@@ -176,7 +180,7 @@ namespace groupTree {
int
countCellsInTheGroup
=
0
;
MortonIndex
previousMortonCell
=
-
1
;
std
::
cout
<<
"Compute Level "
<<
idxLevel
<<
std
::
endl
;
//
std::cout << "Compute Level " << idxLevel << std::endl;
for
(
std
::
size_t
idxLeaf
=
0
;
idxLeaf
<
mortonLeaves
.
size
();
++
idxLeaf
)
{
MortonIndex
mortonCell
=
(
mortonLeaves
[
idxLeaf
])
>>
(
3
*
(
TreeHeight
-
1
-
idxLevel
));
...
...
@@ -205,10 +209,12 @@ namespace groupTree {
if
(
countCellsInTheGroup
>
0
)
sizeForEachGroup
[
idxLevel
].
push_back
(
countCellsInTheGroup
);
//
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
// Print sizeForEachGroup at the current level
for
(
auto
v
:
sizeForEachGroup
[
idxLevel
])
std
::
cout
<<
" "
<<
v
;
std
::
cout
<<
std
::
endl
;
#endif
}
...
...
@@ -257,10 +263,10 @@ namespace groupTree {
//
//loader
std
::
cout
<<
"Opening : "
<<
filename
<<
" ..."
;
//
std::cout << "Opening : " << filename << " ...";
FFmaGenericLoader
<
FReal
>
loader
(
filename
);
FAssertLF
(
loader
.
isOpen
());
std
::
cout
<<
" done."
<<
std
::
endl
;
//
std::cout << " done." << std::endl;
const
FSize
totalNbParticles
=
loader
.
getNumberOfParticles
();
//
const
std
::
size_t
max_level
=
sizeof
(
PARTICLE_T
::
morton_index
)
*
8
/
3
;
...
...
@@ -302,7 +308,7 @@ namespace groupTree {
++
nbLeaves
;
}
}
std
::
cout
<<
"Number of leaves"
<<
nbLeaves
<<
std
::
endl
;
//
std::cout<< "Number of leaves" << nbLeaves <<std::endl ;
std
::
vector
<
MortonIndex
>
mortonLeaves
(
nbLeaves
,
-
1
)
;
previousMorton
=
myParticles
[
0
].
morton_index
;
...
...
@@ -351,14 +357,17 @@ namespace groupTree {
//
}
// otherwise we use the given Morton distribution
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
std
::
cout
<<
" Morton distribution to build the duplicated tree "
<<
MortonIndexDistribution
.
size
()
<<
" "
<<
std
::
endl
<<
std
::
flush
;
for
(
auto
v
:
MortonIndexDistribution
)
std
::
cout
<<
" "
<<
v
;
std
::
cout
<<
std
::
endl
;
#endif
//////////////////////////////////////////////////////////////////////////
std
::
vector
<
std
::
vector
<
std
::
vector
<
MortonIndex
>>>
nodeRepartition
;
std
::
vector
<
std
::
vector
<
int
>>
sizeForEachGroup
(
TreeHeight
);
createNodeRepartition
(
MortonIndexDistribution
,
nodeRepartition
,
nproc
,
TreeHeight
)
;
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
for
(
std
::
size_t
idLevel
=
0
;
idLevel
<
nodeRepartition
.
size
()
;
++
idLevel
){
std
::
cout
<<
" nodeRepartition at level "
<<
idLevel
<<
std
::
endl
;
for
(
std
::
size_t
procID
=
0
;
procID
<
nodeRepartition
[
idLevel
].
size
();
++
procID
){
...
...
@@ -367,10 +376,11 @@ namespace groupTree {
<<
nodeRepartition
[
idLevel
][
procID
][
1
]
<<
" ]"
<<
std
::
endl
;
}
}
#endif
BuilddMortonDistributionForCGroupCellInTree
(
parallelManager
,
mortonLeaves
,
TreeHeight
,
groupSize
,
MortonIndexDistribution
,
nodeRepartition
,
sizeForEachGroup
)
;
#ifdef FMM_VERBOSE_DATA_DISTRIUTION
//
// Print group size per level
std
::
cout
<<
std
::
endl
<<
" Group size at the leaf level "
<<
std
::
endl
;
...
...
@@ -384,13 +394,12 @@ namespace groupTree {
}
std
::
cout
<<
std
::
endl
;
std
::
cout
<<
" Total number of leaves: "
<<
totalLeaves
<<
std
::
endl
;
}
#endif
//
GroupTree
=
new
OCTREEGRPOUPCLASS
(
TreeHeight
,
loader
.
getBoxWidth
(),
loader
.
getCenterOfBox
(),
groupSize
,
&
allParticles
,
sizeForEachGroup
,
true
);
//
//
}
}
...
...
Src/GroupTree/Core/FCheckResults.hpp
View file @
4540806e
...
...
@@ -79,9 +79,9 @@ void checkWithDuplicatedTree( const int& myrank, const PARTICLE &arrayParticles,
// Compute a sequential FMM
algorithm
.
execute
(
operationsToProceed
);
//
std
::
string
fileName
(
"output-Let-"
)
;
fileName
+=
std
::
to_string
(
myrank
)
+
".fma"
;
groupTree
::
saveSolutionInFile
(
fileName
,
arrayParticles
.
size
()
,
treeCheck
)
;
//
std::string fileName("output-Let-") ;
//
fileName += std::to_string(myrank) + ".fma" ;
//
groupTree::saveSolutionInFile(fileName, arrayParticles.size() ,treeCheck) ;
groupTree
::
checkCellTree
(
grouptree
,
groupalgo
,
treeCheck
,
epsilon
)
;
groupTree
::
checkLeaves
(
grouptree
,
groupalgo
,
treeCheck
,
epsilon
)
;
...
...
Src/GroupTree/Core/FGroupOfCells.hpp
View file @
4540806e
...
...
@@ -3,9 +3,9 @@
#ifndef FGROUPOFCELLS_HPP
#define FGROUPOFCELLS_HPP
#include "
../../
Utils/FAssert.hpp"
#include "
../../
Utils/FAlignedMemory.hpp"
#include "
../../
Containers/FTreeCoordinate.hpp"
#include "Utils/FAssert.hpp"
#include "Utils/FAlignedMemory.hpp"
#include "Containers/FTreeCoordinate.hpp"
#include "../StarPUUtils/FStarPUDefaultAlign.hpp"
#include <list>
...
...
@@ -20,9 +20,9 @@ class FGroupOfCells {
struct
alignas
(
FStarPUDefaultAlign
::
StructAlign
)
BlockHeader
{
MortonIndex
startingIndex
;
MortonIndex
endingIndex
;
int
numberOfCellsInBlock
;
int
idxGlobal
;
bool
isMine
;
int
numberOfCellsInBlock
;
int
idxGlobal
;
///< Global index of the group in the Octree
bool
isMine
;
///< true if I own the group
};
protected:
...
...
@@ -155,11 +155,11 @@ public:
FAssertLF
(
size_t
(
ptrBuff
-
memoryBuffer
)
==
allocatedMemoryInByte
);
// Init header
blockHeader
->
startingIndex
=
inStartingIndex
;
blockHeader
->
endingIndex
=
inEndingIndex
;
blockHeader
->
startingIndex
=
inStartingIndex
;
blockHeader
->
endingIndex
=
inEndingIndex
;
blockHeader
->
numberOfCellsInBlock
=
inNumberOfCells
;
blockHeader
->
idxGlobal
=
-
1
;
blockHeader
->
isMine
=
false
;
blockHeader
->
idxGlobal
=
-
1
;
blockHeader
->
isMine
=
false
;
#ifndef SCALFMM_SIMGRID_NODATA
cellMultipoles
=
(
PoleCellClass
*
)
FAlignedMemory
::
AllocateBytes
<
32
>
(
inNumberOfCells
*
sizeof
(
PoleCellClass
));
cellLocals
=
(
LocalCellClass
*
)
FAlignedMemory
::
AllocateBytes
<
32
>
(
inNumberOfCells
*
sizeof
(
LocalCellClass
));
...
...
Src/GroupTree/Core/FGroupTaskStarpuImplicitAlgorithm.hpp
View file @
4540806e
...
...
@@ -11,14 +11,15 @@
#include <memory>
#include <iostream>
#include "../../Utils/FGlobal.hpp"
#include "../../Core/FCoreCommon.hpp"
#include "../../Utils/FQuickSort.hpp"
#include "../../Containers/FTreeCoordinate.hpp"
#include "../../Utils/FLog.hpp"
#include "../../Utils/FTic.hpp"
#include "../../Utils/FAssert.hpp"
#include "../../Utils/FEnv.hpp"
#include "Utils/FGlobal.hpp"
#include "Utils/FMpi.hpp"
#include "Core/FCoreCommon.hpp"
#include "Utils/FQuickSort.hpp"
#include "Containers/FTreeCoordinate.hpp"
#include "Utils/FLog.hpp"
#include "Utils/FTic.hpp"
#include "Utils/FAssert.hpp"
#include "Utils/FEnv.hpp"
#include "FOutOfBlockInteraction.hpp"
...
...
@@ -61,9 +62,14 @@
#include "Containers/FBoolArray.hpp"
//using namespace std;
//#define STARPU_USE_REDUX
//
//
// Variables
// SCALFMM_NO_COMMUTE_LAST_L2L ??
// SCALFMM_NO_COMMUTE_M2L_L2L ??
//
template
<
class
OctreeClass
,
class
CellContainerClass
,
class
KernelClass
,
class
ParticleGroupClass
,
class
StarPUCpuWrapperClass
#ifdef SCALFMM_ENABLE_CUDA_KERNEL
,
class
StarPUCudaWrapperClass
=
FStarPUCudaWrapper
<
KernelClass
,
FCudaEmptyCellSymb
,
int
,
int
,
FCudaGroupOfCells
<
FCudaEmptyCellSymb
,
int
,
int
>,
...
...
@@ -184,7 +190,7 @@ protected:
// Parallel data
int
mpi_rank
;
//< rank of the current processus
int
nproc
;
//< number of mpi processes
std
::
vector
<
std
::
vector
<
std
::
vector
<
MortonIndex
>
>
>
_nodeRepartition
;
//< The morton index distributions level by level
std
::
vector
<
std
::
vector
<
std
::
vector
<
MortonIndex
>
>
>
_nodeRepartition
;
//< The morton index distributions level by level
#ifdef SCALFMM_USE_STARPU_EXTRACT
struct
ParticleExtractedHandles
{
starpu_data_handle_t
symb
;
...
...
@@ -236,11 +242,10 @@ protected:
#endif
public:
FGroupTaskStarPUImplicitAlgorithm
(
OctreeClass
*
const
inTree
,
KernelClass
*
inKernels
,
FGroupTaskStarPUImplicitAlgorithm
(
/*const FMpi& paralleManager, */
OctreeClass
*
const
inTree
,
KernelClass
*
inKernels
,
std
::
vector
<
MortonIndex
>&
distributedMortonIndex
,
const
int
nb_block_in
=
-
1
)
:
tree
(
inTree
),
nb_block
(
nb_block_in
),
originalCpuKernel
(
inKernels
),
cellHandles
(
nullptr
),
:
tree
(
inTree
),
originalCpuKernel
(
inKernels
),
cellHandles
(
nullptr
),
nb_block
(
nb_block_in
),
noCommuteAtLastLevel
(
FEnv
::
GetBool
(
"SCALFMM_NO_COMMUTE_LAST_L2L"
,
true
)),
noCommuteBetweenLevel
(
FEnv
::
GetBool
(
"SCALFMM_NO_COMMUTE_M2L_L2L"
,
false
)),
#ifdef STARPU_USE_CPU
...
...
@@ -447,15 +452,15 @@ public:
#pragma omp single
buildExternalInteractionVecs
();
if
(
this
->
nb_block
<=
0
){
std
::
cout
<<
" buildHandles "
<<
std
::
endl
;
//
std::cout << " buildHandles " <<std::endl;
buildHandles
();
}
else
{
std
::
cout
<<
" buildDistributedHandles "
<<
std
::
endl
;
//
std::cout << " buildDistributedHandles " <<std::endl;
buildDistributedHandles
();
}
std
::
cout
<<
" end rebuildInteractions "
<<
std
::
endl
;
this
->
printCellHandels
();
//
std::cout << " end rebuildInteractions " << std::endl;
//
this->printCellHandels ();
}
...
...
@@ -563,7 +568,8 @@ public:
}
}
//
//
// getOppositeInterIndex
// \brief ??
//
int
getOppositeInterIndex
(
const
int
index
)
const
{
// ((( (xdiff+3) * 7) + (ydiff+3))) * 7 + zdiff + 3
...
...
@@ -594,10 +600,10 @@ protected:
if
(
operationsToProceed
&
FFmmM2M
&&
!
directOnly
){
if
(
this
->
nb_block
>
0
&&
nproc
>
1
){
std
::
cout
<<
" upwardPassNoDuplicate"
<<
std
::
endl
;
//
std::cout << " upwardPassNoDuplicate"<<std::endl;
upwardPassNoDuplicate
();
}
else
{
std
::
cout
<<
" upwardPassDuplicate"
<<
std
::
endl
;
//
std::cout << " upwardPassDuplicate" <<std::endl;
upwardPassDuplicate
();
}
}
...
...
@@ -609,15 +615,13 @@ protected:
if
(
operationsToProceed
&
FFmmL2L
&&
!
directOnly
){
if
(
this
->
nb_block
>
0
&&
nproc
>
1
){
std
::
cout
<<
" downardPassNoDuplicate "
<<
std
::
endl
;
//
std::cout << " downardPassNoDuplicate " <<std::endl;
this
->
downardPassNoDuplicate
();
}
else
{
std
::
cout
<<
" downardPassDuplicate "
<<
std
::
endl
;
//downardPass() ;
// std::cout << " downardPassDuplicate " <<std::endl;
this
->
downardPassDuplicate
();
}
}
//if(operationsToProceed & FFmmL2L && !directOnly) this->downardPassDuplicate();
if
(
operationsToProceed
&
FFmmM2L
&&
!
directOnly
)
transferPass
(
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
,
FAbstractAlgorithm
::
lowerWorkingLevel
,
true
,
true
);
...
...
@@ -1196,20 +1200,20 @@ protected:
}
}
void
buildHandles
(){
std
::
cout
<<
" BEGIN buildHandles() "
<<
std
::
endl
;
//
std::cout << " BEGIN buildHandles() " << std::endl;
cleanHandle
();
int
tag
=
0
;
int
where
;
for
(
int
idxLevel
=
2
;
idxLevel
<
tree
->
getHeight
()
;
++
idxLevel
){
std
::
cout
<<
" Level "
<<
idxLevel
<<
std
::
endl
;
//
std::cout << " Level " << idxLevel << std::endl;
cellHandles
[
idxLevel
].
resize
(
tree
->
getNbCellGroupAtLevel
(
idxLevel
));
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
const
CellContainerClass
*
currentCells
=
tree
->
getCellGroup
(
idxLevel
,
idxGroup
);
int
registeringNode
=
dataMappingBerenger
(
currentCells
->
getStartingIndex
(),
idxLevel
);
int
idx_global
=
currentCells
->
getIdxGlobal
();
//
int idx_global = currentCells->getIdxGlobal();
where
=
(
registeringNode
==
mpi_rank
)
?
STARPU_MAIN_RAM
:
-
1
;
std
::
cout
<<
" idxGroup "
<<
idxGroup
<<
" registeringNode "
<<
registeringNode
<<
" idx_global "
<<
idx_global
<<
" where "
<<
where
<<
std
::
endl
<<
std
::
flush
;
//
std::cout << " idxGroup " << idxGroup << " registeringNode " << registeringNode
//
<< " idx_global "<< idx_global << " where "<< where << std::endl<<std::flush;
starpu_variable_data_register
(
&
cellHandles
[
idxLevel
][
idxGroup
].
symb
,
where
,
(
uintptr_t
)
currentCells
->
getRawBuffer
(),
currentCells
->
getBufferSizeInByte
());
starpu_variable_data_register
(
&
cellHandles
[
idxLevel
][
idxGroup
].
up
,
where
,
...
...
@@ -1253,18 +1257,18 @@ protected:
particleHandles
[
idxGroup
].
intervalSize
=
int
(
containers
->
getNumberOfLeavesInBlock
());
}
}
std
::
cout
<<
" END buildHandles() "
<<
std
::
endl
;
//
std::cout << " END buildHandles() " << std::endl;
}
/*
* this function bind block when the tree is distributed (LET)
* we use the global index of every block
*/
void
buildDistributedHandles
(){
std
::
cout
<<
" BEGIN buildDistributedHandles() "
<<
std
::
endl
;
//
std::cout << " BEGIN buildDistributedHandles() " << std::endl;
cleanHandle
();
int
where
;
for
(
int
idxLevel
=
2
;
idxLevel
<
tree
->
getHeight
()
;
++
idxLevel
){
std
::
cout
<<
" Level "
<<
idxLevel
<<
std
::
endl
;
//
std::cout << " Level " << idxLevel << std::endl;
cellHandles
[
idxLevel
].
resize
(
tree
->
getNbCellGroupAtLevel
(
idxLevel
));
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
...
...
@@ -1272,8 +1276,8 @@ protected:
int
registeringNode
=
dataMappingBerenger
(
currentCells
->
getStartingIndex
(),
idxLevel
);
int
idx_global
=
currentCells
->
getIdxGlobal
();
where
=
(
registeringNode
==
mpi_rank
)
?
STARPU_MAIN_RAM
:
-
1
;
std
::
cout
<<
" idxGroup "
<<
idxGroup
<<
" registeringNode "
<<
registeringNode
<<
" idx_global "
<<
idx_global
<<
" where "
<<
where
<<
std
::
endl
<<
std
::
flush
;
//
std::cout << " idxGroup " << idxGroup << " registeringNode " << registeringNode
//
<< " idx_global "<< idx_global << " where "<< where << std::endl<<std::flush;
starpu_variable_data_register
(
&
cellHandles
[
idxLevel
][
idxGroup
].
symb
,
where
,
(
uintptr_t
)
currentCells
->
getRawBuffer
(),
currentCells
->
getBufferSizeInByte
());
...
...
@@ -1326,7 +1330,7 @@ protected:
particleHandles
[
idxGroup
].
intervalSize
=
int
(
containers
->
getNumberOfLeavesInBlock
());
}
}
std
::
cout
<<
" END buildDistributedHandles() "
<<
std
::
endl
;
//
std::cout << " END buildDistributedHandles() " << std::endl;
}
...
...
@@ -2234,24 +2238,24 @@ protected:
FLOG
(
FTic
timer
;
);
for
(
int
idxLevel
=
FAbstractAlgorithm
::
upperWorkingLevel
;
idxLevel
<
FAbstractAlgorithm
::
lowerWorkingLevel
-
1
;
++
idxLevel
){
int
idxSubGroup
=
0
;
std
::
cout
<<
" Level "
<<
idxLevel
<<
" -> "
<<
idxLevel
+
1
<<
" nbGroupCell "
<<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
<<
std
::
endl
;
//
std::cout << " Level "<< idxLevel << " -> " << idxLevel+1<<" nbGroupCell " << tree->getNbCellGroupAtLevel(idxLevel) << std::endl;
for
(
int
idxGroup
=
0
;
idxGroup
<
tree
->
getNbCellGroupAtLevel
(
idxLevel
)
;
++
idxGroup
){
CellContainerClass
*
const
currentCells
=
tree
->
getCellGroup
(
idxLevel
,
idxGroup
);
// Skip current group if needed
std
::
cout
<<
" IF "
<<
tree
->
getCellGroup
(
idxLevel
+
1
,
idxSubGroup
)
->
getEndingIndex
()
<<
" <= "
<<
(
currentCells
->
getStartingIndex
()
<<
3
)
<<
std
::
endl
;
//
std::cout <<" IF " << tree->getCellGroup(idxLevel+1, idxSubGroup)->getEndingIndex() << " <= " <<(currentCells->getStartingIndex()<<3)<< std::endl;
if
(
tree
->
getCellGroup
(
idxLevel
+
1
,
idxSubGroup
)
->
getEndingIndex
()
<=
(
currentCells
->
getStartingIndex
()
<<
3
)
){
++
idxSubGroup
;
FAssertLF
(
idxSubGroup
!=
tree
->
getNbCellGroupAtLevel
(
idxLevel
+
1
)
);
FAssertLF
(
(
tree
->
getCellGroup
(
idxLevel
+
1
,
idxSubGroup
)
->
getStartingIndex
()
>>
3
)
==
currentCells
->
getStartingIndex
()
);
}
std
::
cout
<<
" idxSubGroup "
<<
idxSubGroup
<<
std
::
endl
;
//
std::cout << " idxSubGroup " << idxSubGroup << std::endl;
// Copy at max 8 groups
{
// put the right codelet
if
((
noCommuteAtLastLevel
&&
(
idxLevel
==
FAbstractAlgorithm
::
lowerWorkingLevel
-
2
))
||
noCommuteBetweenLevel
){
std
::
cout
<<
" (noCommuteAtLastLevel) ID "
<<
cellHandles
[
idxLevel
][
idxGroup
].
groupID
<<
" intervalSize "
<<
cellHandles
[
idxLevel
][
idxGroup
].
intervalSize
<<
std
::
endl
;
//
std::cout << " (noCommuteAtLastLevel) ID "<<cellHandles[idxLevel][idxGroup].groupID << " intervalSize " <<cellHandles[idxLevel][idxGroup].intervalSize <<std::endl;
starpu_mpi_insert_task
(
MPI_COMM_WORLD
,
&
l2l_cl_nocommute
,
STARPU_VALUE
,
&
wrapperptr
,
sizeof
(
wrapperptr
),
...
...
@@ -2287,7 +2291,7 @@ protected:
0
);
}
else
{
std
::
cout
<<
" (CommuteAtLastLevel) ID "
<<
cellHandles
[
idxLevel
][
idxGroup
].
groupID
<<
" intervalSize "
<<
cellHandles
[
idxLevel
][
idxGroup
].
intervalSize
<<
std
::
endl
;
//
std::cout << " (CommuteAtLastLevel) ID "<<cellHandles[idxLevel][idxGroup].groupID << " intervalSize " <<cellHandles[idxLevel][idxGroup].intervalSize <<std::endl;
starpu_mpi_insert_task
(
MPI_COMM_WORLD
,
&
l2l_cl
,
STARPU_VALUE
,
&
wrapperptr
,
sizeof
(
wrapperptr
),
...
...
@@ -2324,7 +2328,7 @@ protected:
}
}
std
::
cout
<<
" while loop "
<<
std
::
endl
;
//
std::cout << " while loop " << std::endl;
while
(
tree
->
getCellGroup
(
idxLevel
+
1
,
idxSubGroup
)
->
getEndingIndex
()
<=
(((
currentCells
->
getEndingIndex
()
-
1
)
<<
3
)
+
7
)
&&
(
idxSubGroup
+
1
)
!=
tree
->
getNbCellGroupAtLevel
(
idxLevel
+
1
)
&&
tree
->
getCellGroup
(
idxLevel
+
1
,
idxSubGroup
+
1
)
->
getStartingIndex
()
<=
((
currentCells
->
getEndingIndex
()
-
1
)
<<
3
)
+
7
){
...
...
@@ -2332,7 +2336,7 @@ protected:
// put the right codelet
if
((
noCommuteAtLastLevel
&&
(
idxLevel
==
FAbstractAlgorithm
::
lowerWorkingLevel
-
2
))
||
noCommuteBetweenLevel
){
std
::
cout
<<
" (noCommuteAtLastLevel) ID "
<<
cellHandles
[
idxLevel
][
idxGroup
].
groupID
<<
" intervalSize "
<<
cellHandles
[
idxLevel
][
idxGroup
].
intervalSize
<<
std
::
endl
;
//
std::cout << " (noCommuteAtLastLevel) ID "<<cellHandles[idxLevel][idxGroup].groupID << " intervalSize " <<cellHandles[idxLevel][idxGroup].intervalSize <<std::endl;
starpu_mpi_insert_task
(
MPI_COMM_WORLD
,
&
l2l_cl_nocommute
,
STARPU_VALUE
,
&
wrapperptr
,
sizeof
(
wrapperptr
),
...
...
@@ -2368,7 +2372,7 @@ protected:
0
);
}
else
{
std
::
cout
<<
" (CommuteAtLastLevel) ID "
<<
cellHandles
[
idxLevel
][
idxGroup
].
groupID
<<
" intervalSize "
<<
cellHandles
[
idxLevel
][
idxGroup
].
intervalSize
<<
std
::
endl
;
//
std::cout << " (CommuteAtLastLevel) ID "<<cellHandles[idxLevel][idxGroup].groupID << " intervalSize " <<cellHandles[idxLevel][idxGroup].intervalSize <<std::endl;
starpu_mpi_insert_task
(
MPI_COMM_WORLD
,
&
l2l_cl
,
STARPU_VALUE
,
&
wrapperptr
,
sizeof
(
wrapperptr
),
...
...
Src/GroupTree/Core/FGroupTools.hpp
View file @
4540806e
#ifndef FGROUPTOOLS_HPP
#define FGROUPTOOLS_HPP
#include <vector>
#include "ScalFmmConfig.h"
#include "Utils/FGlobal.hpp"
#include "Utils/FPoint.hpp"
...
...
@@ -26,12 +28,10 @@ namespace groupTree {
const
FPoint
<
FReal
>&
getPosition
()
const
{
return
pos
;
}
const
auto
&
physicalValue
()
const
{
const
FReal
&
physicalValue
()
const
{
return
phi
;
}
const
auto
&
getPositions
()
const
{
return
pos
;
}
void
fill
(
const
position_t
&
inPos
,
const
FReal
&
inPhyVal
,
MortonIndex
&
inMortonIndex
){
pos
=
inPos
;
phi
=
inPhyVal
;
morton_index
=
inMortonIndex
;
}
...
...
@@ -138,8 +138,8 @@ namespace groupTree {
//
std
::
vector
<
bool
>
OK
(
groupedTree
.
getHeight
(),
true
)
;
groupedTree
.
forEachCellWithLevel
(
[
&
](
typename
GROUPTREE_T
::
GroupSymbolCellClass_T
*
gsymb
,
groupedTree
.
forEach
My
CellWithLevel
(
[
&
](
typename
GROUPTREE_T
::
GroupSymbolCellClass_T
*
gsymb
,
typename
GROUPTREE_T
::
GroupCellUpClass_T
*
gmul
,
typename
GROUPTREE_T
::
GroupCellDownClass_T
*
gloc
,
const
int
level
)
...
...
@@ -155,6 +155,11 @@ namespace groupTree {
FMath
::
FAccurater
<
FReal
>
diffUp
;
diffUp
.
add
(
cell
->
getMultipoleData
().
get
(
0
),
gmul
->
get
(
0
),
gmul
->
getVectorSize
());
if
(
diffUp
.
getRelativeInfNorm
()
>
epsilon
||
diffUp
.
getRelativeL2Norm
()
>
epsilon
){
auto
*
data1
=
gmul
->
get
(
0
);
auto
*
data2
=
cell
->
getMultipoleData
().
get
(
0
);
for
(
int
i
=
0
;
i
<
gmul
->
getVectorSize
();
++
i
)
{
std
::
cout
<<
i
<<
" "
<<
data1
[
i
]
<<
" seq "
<<
data2
[
i
]
<<
std
::
endl
;
}
std
::
cout
<<
"[Up] Up is different at index "
<<
gsymb
->
getMortonIndex
()
<<
" level "
<<
level
<<
" is "
<<
diffUp
<<
"
\n
"
;
OK
[
level
]
=
false
;
...
...
@@ -179,9 +184,9 @@ namespace groupTree {
void
checkLeaves
(
GROUPTREE_T
&
groupedTree
,
GROUPALGO_T
&
groupalgo
,
OCTTREE_T
&
treeCheck
,
const
FReal
&
epsilon
){
//
FMath
::
FAccurater
<
FReal
>
potentialGlobalDiff
;
const
int
NbLevels
=
groupedTree
.
getHeight
()
;
const
int
leafLevel
=
groupedTree
.
getHeight
()
-
1
;
bool
OK
=
true
;
groupedTree
.
template
forEachCell
My
Leaf
<
typename
GROUPTREE_T
::
LeafClass_T
>(
groupedTree
.
template
forEachCellLeaf
<
typename
GROUPTREE_T
::
LeafClass_T
>(
[
&
](
typename
GROUPTREE_T
::
GroupSymbolCellClass_T
*
gsymb
,
typename
GROUPTREE_T
::
GroupCellUpClass_T
*
/* gmul */
,
typename
GROUPTREE_T
::
GroupCellDownClass_T
*
/* gloc */
,
...
...
@@ -189,7 +194,7 @@ namespace groupTree {
)
{
if
(
groupalgo
.
isDataOwnedBerenger
(
gsymb
->
getMortonIndex
(),
NbLevels
-
1
))
if
(
groupalgo
.
isDataOwnedBerenger
(
gsymb
->
getMortonIndex
(),
leafLevel
)
)
// just needed if we have duplicated tree
{
const
auto
*
targets
=
treeCheck
.
getLeafSrc
(
gsymb
->
getMortonIndex
());
if
(
targets
==
nullptr
){
...
...
@@ -225,7 +230,7 @@ namespace groupTree {
FMath
::
FAccurater
<
FReal
>
fx
,
fy
,
fz
;
for
(
FSize
idxPart
=
0
;
idxPart
<
nbPartsInLeafTarget
;
++
idxPart
){
if
(
gposX
[
idxPart
]
!=
posX
[
idxPart
]
||
gposY
[
idxPart
]
!=
posY
[
idxPart
]
||
gposZ
[
idxPart
]
!=
posZ
[
idxPart
]){
std
::
cout
<<
"[Empty] Not the same particle
a
at "
<<
gsymb
->
getMortonIndex
()
<<
" idx "
<<
idxPart
<<
" "
std
::
cout
<<
"[Empty] Not the same particle at "
<<
gsymb
->
getMortonIndex
()
<<
" idx "
<<
idxPart
<<
" "
<<
gposX
[
idxPart
]
<<
" "
<<
posX
[
idxPart
]
<<
" "
<<
gposY
[
idxPart
]
<<
" "
<<
posY
[
idxPart
]
<<
" "
<<
gposZ
[
idxPart
]
<<
" "
<<
posZ
[
idxPart
]
<<
"
\n
"
;
OK
=
false
;
...
...
Src/GroupTree/Core/FGroupTree.hpp
View file @
4540806e
...
...
@@ -16,7 +16,7 @@
#include "FGroupOfCells.hpp"
#include "FGroupOfParticles.hpp"
#include "FGroupAttachedLeaf.hpp"
#include "../../Kernels/P2P/FP2PParticleContainer.hpp"
#include "../../
Src/
Kernels/P2P/FP2PParticleContainer.hpp"
#ifdef SCALFMM_USE_MPI
#include "FDistributedGroupTreeBuilder.hpp"
#endif
...
...
@@ -681,12 +681,13 @@ public:
const
FTreeCoordinate
host
=
FCoordinateComputer
::
GetCoordinateFromPositionAndCorner
<
FReal
>
(
this
->
boxCorner
,
this
->
boxWidth
,
_treeHeight
,
FPoint
<
FReal
>
(
xpos
[
idxPart
],
ypos
[
idxPart
],
zpos
[
idxPart
])
);
const
MortonIndex
particleIndex
=
host
.
getMortonIndex
();
particlesToSort
[
idxPart
].
mindex
=
particleIndex
;
// const MortonIndex particleIndex
= host.getMortonIndex();
particlesToSort
[
idxPart
].
mindex
=
host
.
getMortonIndex
()
;
particlesToSort
[
idxPart
].
originalIndex
=
idxPart
;
}
}
// Sort if needed
if
(
particlesAreSorted
==
false
){
FQuickSort
<
ParticleSortingStruct
,
FSize
>::
QsOmp
(
particlesToSort
,
nbParticles
,
[](
const
ParticleSortingStruct
&
v1
,
const
ParticleSortingStruct
&
v2
){
...
...
@@ -729,10 +730,10 @@ public:
sizeOfBlock
,
lastParticle
-
firstParticle
);
///////////////////////// TO REMOVE ?? //////////////
#include <iostream>
using
namespace
std
;
if
(
currentBlockIndexes
[
sizeOfBlock
-
1
]
+
1
==
511
)
cout
<<
"Suricate"
<<
endl
;
//
#include <iostream>
//
using namespace std;
//
if(currentBlockIndexes[sizeOfBlock-1]+1 == 511)
//
cout << "Suricate" << endl;
/////////////////////////////////////////////////////
// Init cells
...
...
@@ -761,6 +762,7 @@ public: