Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
solverstack
ScalFMM
Commits
0ec7b837
Commit
0ec7b837
authored
Jul 05, 2017
by
DUFOYER Benjamin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix LET at leaf level + Adding split MPI message for message too big
parent
a2154f09
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
1160 additions
and
434 deletions
+1160
-434
Src/GroupTree/Core/FDistributedGroupTreeBuilder.hpp
Src/GroupTree/Core/FDistributedGroupTreeBuilder.hpp
+1080
-370
Src/GroupTree/Core/FGroupLinearTree.hpp
Src/GroupTree/Core/FGroupLinearTree.hpp
+45
-36
Src/GroupTree/Core/FGroupTree.hpp
Src/GroupTree/Core/FGroupTree.hpp
+35
-28
No files found.
Src/GroupTree/Core/FDistributedGroupTreeBuilder.hpp
View file @
0ec7b837
This diff is collapsed.
Click to expand it.
Src/GroupTree/Core/FGroupLinearTree.hpp
View file @
0ec7b837
...
...
@@ -20,8 +20,8 @@ protected:
const
inria
::
mpi_config
&
mpi_conf
;
std
::
vector
<
node_t
>*
linear_tree
;
std
::
vector
<
std
::
pair
<
unsigned
long
long
int
,
unsigned
long
long
int
>>
particle_
reparti
tion
;
bool
unknow_particle_
reparti
tion
=
true
;
std
::
vector
<
std
::
pair
<
MortonIndex
,
MortonIndex
>>
index_
particle_
distribu
tion
;
bool
unknow_
index_
particle_
distribu
tion
=
true
;
public:
...
...
@@ -39,7 +39,7 @@ public:
*/
FGroupLinearTree
(
const
inria
::
mpi_config
&
conf
)
:
mpi_conf
(
conf
),
particle_
reparti
tion
(
conf
.
comm
.
size
())
index_
particle_
distribu
tion
(
conf
.
comm
.
size
())
{
linear_tree
=
new
std
::
vector
<
node_t
>
[
1
];
}
...
...
@@ -52,7 +52,7 @@ public:
* @param in_linear_tree linear tree
* @param in_block_size block size
*/
void
create_local_
blocked
_linear_tree
(
void
create_local_
group
_linear_tree
(
std
::
vector
<
node_t
>*
in_linear_tree
,
int
in_block_size
){
...
...
@@ -67,7 +67,7 @@ public:
* @param in_linear_tree linear tree
* @param in_block_size blocksize needed
*/
void
create_global_
blocked
_linear_tree
(
void
create_global_
group
_linear_tree
(
std
::
vector
<
node_t
>*
in_linear_tree
,
int
in_block_size
){
...
...
@@ -209,34 +209,34 @@ public:
}
/**
* This function fill the particle_
reparti
tion with a call of the function
* This function fill the
index_
particle_
distribu
tion with a call of the function
* from FDistributedGroupTreeBuilder
* @author benjamin.dufoyer@inria.fr
* @param particle_container [description]
*/
template
<
class
particle_t
>
void
set_particle_
reparti
tion
(
void
set_
index_
particle_
distribu
tion
(
std
::
vector
<
particle_t
>
particle_container
)
{
unknow_particle_
reparti
tion
=
false
;
dstr_grp_tree_builder
::
know
_particle_division
(
unknow_
index_
particle_
distribu
tion
=
false
;
dstr_grp_tree_builder
::
share
_particle_division
(
this
->
mpi_conf
,
particle_container
,
particle_
reparti
tion
);
index_
particle_
distribu
tion
);
}
std
::
vector
<
std
::
pair
<
unsigned
long
long
int
,
unsigned
long
long
int
>>*
get_particle_
reparti
tion
(){
std
::
vector
<
std
::
pair
<
MortonIndex
,
MortonIndex
>>*
get_
index_
particle_
distribu
tion
(){
// TO get the particle repartition, you will compute it before
FAssert
(
!
unknow_particle_
reparti
tion
);
return
&
this
->
particle_
reparti
tion
;
FAssert
(
!
unknow_
index_
particle_
distribu
tion
);
return
&
this
->
index_
particle_
distribu
tion
;
}
std
::
pair
<
unsigned
long
long
int
,
unsigned
long
long
int
>
get
_particle_
reparti
tion_at
(
unsigned
i
){
std
::
pair
<
MortonIndex
,
MortonIndex
>
get_index
_particle_
distribu
tion_at
(
unsigned
i
){
// TO get the particle repartition, you will compute it before
FAssert
(
!
unknow_particle_
reparti
tion
);
FAssert
(
i
<
this
->
particle_
reparti
tion
.
size
());
return
this
->
particle_
reparti
tion
.
data
()[
i
];
FAssert
(
!
unknow_
index_
particle_
distribu
tion
);
FAssert
(
i
<
this
->
index_
particle_
distribu
tion
.
size
());
return
this
->
index_
particle_
distribu
tion
.
data
()[
i
];
}
/**
...
...
@@ -246,13 +246,13 @@ public:
* @author benjamin.dufoyer@inria.fr
* @return max left morton index, -1 if he doesn't exist
*/
long
long
int
get_left_limit
(){
MortonIndex
get_left_limit
(){
// Check if the repartition have been compute
FAssert
(
!
unknow_particle_
reparti
tion
);
FAssert
(
!
unknow_
index_
particle_
distribu
tion
);
int
my_rank
=
this
->
mpi_conf
.
comm
.
rank
();
long
long
int
left_limit
=
-
1
;
MortonIndex
left_limit
=
-
1
;
if
(
my_rank
!=
0
){
left_limit
=
(
long
long
int
)
this
->
particle_
reparti
tion
[
my_rank
-
1
].
second
;
left_limit
=
(
MortonIndex
)
this
->
index_
particle_
distribu
tion
[
my_rank
-
1
].
second
;
}
return
left_limit
;
}
...
...
@@ -267,64 +267,73 @@ public:
* @param dim Dimension of coordinate of particle
*/
template
<
class
GroupTreeClass
>
void
create_let_group_tree
(
void
create_let_group_tree
_leaf
(
GroupTreeClass
&
tree
,
int
dim
=
3
){
FAssert
(
particle_
reparti
tion
.
size
()
!=
0
);
FAssert
(
index_
particle_
distribu
tion
.
size
()
!=
0
);
FAssert
(
dim
>
0
);
// Compute min and max global morton index
const
MortonIndex
global_min_m_idx
=
this
->
particle_
reparti
tion
.
front
().
first
;
const
MortonIndex
global_max_m_idx
=
this
->
particle_
reparti
tion
.
back
().
second
;
const
MortonIndex
global_min_m_idx
=
this
->
index_
particle_
distribu
tion
.
front
().
first
;
const
MortonIndex
global_max_m_idx
=
this
->
index_
particle_
distribu
tion
.
back
().
second
;
// Compute min and max local morton index
const
MortonIndex
local_min_m_idx
=
tree
.
getParticleGroup
(
0
)
->
getStartingIndex
();
const
MortonIndex
local_max_m_idx
=
tree
.
getParticleGroup
(
(
tree
.
getNbParticleGroup
()
-
1
)
)
->
getEndingIndex
();
// IDEA : can be a task
// This function compute the leaf needed by the P2P operation
// This function return a vector with all leaf needed
// get leaf P2P
std
::
vector
<
size_t
>
leaf_P2P
=
dstr_grp_tree_builder
::
get_leaf_P2P_interaction
(
std
::
vector
<
MortonIndex
>
leaf_P2P
=
dstr_grp_tree_builder
::
get_leaf_P2P_interaction
(
tree
,
global_min_m_idx
,
global_max_m_idx
,
local_min_m_idx
,
local_max_m_idx
);
// IDEA can be a task
// This function compute the leaf needed by the M2L operation
// This function return a vector with all leaf needed
// get leaf M2L
std
::
vector
<
size_t
>
leaf_M2L
=
dstr_grp_tree_builder
::
get_leaf_M2L_interaction
(
std
::
vector
<
MortonIndex
>
leaf_M2L
=
dstr_grp_tree_builder
::
get_leaf_M2L_interaction
_at_level
(
global_min_m_idx
,
global_max_m_idx
,
local_min_m_idx
,
local_max_m_idx
,
tree
.
getHeight
()
-
1
,
tree
,
dim
);
// concat result
std
::
vector
<
size_t
>
needed_leaf
=
dstr_grp_tree_builder
::
concat_M2L_P2P
(
leaf_P2P
,
leaf_M2L
);
// this function return the concatenation of the leaf for the P2P and
// the leaf for the M2L
std
::
vector
<
MortonIndex
>
needed_leaf
=
dstr_grp_tree_builder
::
concat_M2L_P2P
(
leaf_P2P
,
leaf_M2L
);
// Creation of interaction matrice
// TODO Expliquer pourquoi on est obliger de faire ça
// TODO réfléchir comment faire
std
::
vector
<
size_t
>
global_matrix_interaction
=
dstr_grp_tree_builder
::
get_matrix_interaction
(
needed_leaf
,
particle_
reparti
tion
,
index_
particle_
distribu
tion
,
this
->
mpi_conf
);
// Send and get leaf
// Auto is used to get the block more easly
// it's a vector<vector<block_t>>
// block_t is a struct define on FDistributedGroupTreeBuilder.hpp
auto
let_block
=
dstr_grp_tree_builder
::
send_get_symbolic_
leaf
(
auto
let_block
=
dstr_grp_tree_builder
::
send_get_symbolic_
block
(
needed_leaf
,
global_matrix_interaction
,
tree
,
this
->
mpi_conf
);
// Add the block recev to the local group tree
dstr_grp_tree_builder
::
add_let_block_to_tree
(
dstr_grp_tree_builder
::
add_let_
leaf_
block_to_tree
(
tree
,
let_block
,
local_min_m_idx
);
}
/**
...
...
Src/GroupTree/Core/FGroupTree.hpp
View file @
0ec7b837
...
...
@@ -1067,6 +1067,10 @@ public:
CellGroupClass
*
getCellGroup
(
const
int
inLevel
,
const
int
inIdx
){
FAssertLF
(
inLevel
<
_treeHeight
);
if
(
inIdx
>=
int
(
_cellBlocksPerLevel
[
inLevel
].
size
())){
std
::
cout
<<
"level : "
<<
inLevel
<<
std
::
endl
;
std
::
cout
<<
" idx :"
<<
inIdx
<<
std
::
endl
;
}
FAssertLF
(
inIdx
<
int
(
_cellBlocksPerLevel
[
inLevel
].
size
()));
return
_cellBlocksPerLevel
[
inLevel
][
inIdx
];
}
...
...
@@ -1214,7 +1218,7 @@ MortonIndex* create_leaf_level(Blocked_Linear_tree* in_lin_tree,
// Initialise each cell of the block
size_t
nb_particles_offset_before_leaf
=
0
;
size_t
idx_particules
=
0
;
for
(
unsigned
cell_id_in_block
=
0
;
cell_id_in_block
<
size_of_block
;
++
cell_id_in_block
){
// Adding cell into leaf block
new_block
->
newCell
(
...
...
@@ -1241,19 +1245,18 @@ MortonIndex* create_leaf_level(Blocked_Linear_tree* in_lin_tree,
);
BasicAttachedClass
attached_leaf
=
new_particle_block
->
template
getLeaf
<
BasicAttachedClass
>(
cell_id_in_block
);
// Adding particle
for
(
size_t
idxPart
=
0
;
idxPart
<
nb_particle_per_leaf
[
leaf_number_min
+
cell_id_in_block
]
;
++
idxPart
){
attached_leaf
.
setParticle
(
idxPart
,
nb_particles_offset_before_leaf
+
idxPart
,
&
particle_container
);
idxPart
,
idx_particules
,
//nb_particles_offset_before_leaf+idxPart,
&
particle_container
);
++
idx_particules
;
}
// Setting the offset to don't use particle twice
//offset_particles += nb_particle_per_leaf[idx_nb_particle_in_block];
//idx_nb_particle_in_block += 1;
...
...
@@ -1355,7 +1358,7 @@ void create_block_nodes_level(MortonIndex* currentBlockIndexes,
/**
* Add block
putted in parameter into
the local
g
roup
t
ree
* Add
LET
block
at leaf level of
the local
G
roup
T
ree
* @author benjamin.dufoyer@inria.fr
* @param block_to_insert list symbolic information of block
* to add
...
...
@@ -1364,34 +1367,38 @@ void create_block_nodes_level(MortonIndex* currentBlockIndexes,
* @param level level to add
*/
template
<
class
block_t
>
void
create_LET_block
(
std
::
vector
<
block_t
>
block_to_insert
,
bool
start
,
int
level
){
// declaration of buffer to insertion
void
add_LET_block
(
std
::
vector
<
block_t
>&
block_to_insert
,
int
level
,
const
MortonIndex
&
local_min_m_idx
){
if
(
block_to_insert
.
size
()
==
0
)
return
;
// Allocate vector of new block
std
::
vector
<
CellGroupClass
*>
vect_block
(
block_to_insert
.
size
());
// prepare block for insertion
// Fill the vector of new block
unsigned
block_at_begin
=
0
;
for
(
unsigned
i
=
0
;
i
<
vect_block
.
size
();
++
i
){
vect_block
[
i
]
=
new
CellGroupClass
(
block_to_insert
[
i
].
start_index
,
block_to_insert
[
i
].
end_index
,
(
int
)
block_to_insert
[
i
].
nb_leaf_in_block
);
if
(
block_to_insert
[
i
].
end_index
<
local_min_m_idx
){
++
block_at_begin
;
}
}
// add at the end or at the beginning of current block
if
(
start
){
// inserting blocks
_cellBlocksPerLevel
[
level
].
insert
(
_cellBlocksPerLevel
[
level
].
begin
(),
vect_block
.
begin
(),
vect_block
.
end
()
);
}
else
{
// inserting blocks
_cellBlocksPerLevel
[
level
].
insert
(
_cellBlocksPerLevel
[
level
].
end
(),
vect_block
.
begin
(),
vect_block
.
end
());
}
// Add block at beginning of the level
_cellBlocksPerLevel
[
level
].
insert
(
_cellBlocksPerLevel
[
level
].
begin
(),
vect_block
.
begin
(),
vect_block
.
begin
()
+
block_at_begin
);
// Add block a the end of the level
_cellBlocksPerLevel
[
level
].
insert
(
_cellBlocksPerLevel
[
level
].
end
(),
vect_block
.
begin
()
+
block_at_begin
,
vect_block
.
end
());
}
};
#endif // FGROUPTREE_HPP
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