Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
hyteg
hyteg
Commits
acc0eff4
Commit
acc0eff4
authored
Oct 14, 2021
by
Marcel Koch
Browse files
simplify roundrobinvolume redistribution
parent
2e83a2a1
Pipeline
#34774
failed with stages
in 7 minutes and 11 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/hyteg/primitivestorage/loadbalancing/DistributedBalancer.cpp
View file @
acc0eff4
...
...
@@ -388,6 +388,7 @@ MigrationInfo roundRobinVolume( PrimitiveStorage& storage, uint_t minRank, uint_
const
uint_t
numProcesses
=
walberla
::
mpi
::
MPIManager
::
instance
()
->
numProcesses
();
const
uint_t
numReceivingProcesses
=
maxRank
-
minRank
+
1
;
const
uint_t
rank
=
uint_c
(
walberla
::
mpi
::
MPIManager
::
instance
()
->
rank
()
);
const
auto
reduction
=
static_cast
<
double
>
(
numReceivingProcesses
)
/
static_cast
<
double
>
(
numProcesses
);
MigrationMap_T
migrationMap
;
uint_t
numReceivingPrimitives
=
0
;
...
...
@@ -404,27 +405,13 @@ MigrationInfo roundRobinVolume( PrimitiveStorage& storage, uint_t minRank, uint_
// Heuristic: let's assign primitives with consecutive IDs to the same process.
// Often, meshes are generated in a way that primitives with consecutive IDs are located next to each other.
// We are assuming here, that the current distribution was already obtained from loadbalancing::roundRobinVolume.
auto
setup_volume_ids
=
[
&
](
const
auto
&
ids
)
{
auto
it
=
ids
.
begin
();
for
(
uint_t
currentRank
=
0
;
currentRank
<
numReceivingProcesses
;
currentRank
++
)
{
uint_t
numVolumesOnThisRank
=
0
;
while
(
numVolumesOnThisRank
<
ids
.
size
()
/
numReceivingProcesses
)
{
migrationMap
[
it
->
getID
()]
=
minRank
+
currentRank
;
numVolumesOnThisRank
++
;
it
++
;
}
if
(
currentRank
<
ids
.
size
()
%
numReceivingProcesses
)
{
migrationMap
[
it
->
getID
()]
=
minRank
+
currentRank
;
it
++
;
}
numPrimitivesPerRank
[
minRank
+
currentRank
]
=
ids
.
size
()
/
numReceivingProcesses
+
(
currentRank
<
ids
.
size
()
%
numReceivingProcesses
);
auto
target_rank
=
minRank
+
static_cast
<
uint_t
>
(
static_cast
<
double
>
(
rank
)
*
reduction
);
for
(
const
auto
&
p
:
ids
){
migrationMap
[
p
.
getID
()]
=
target_rank
;
}
WALBERLA_CHECK
(
it
==
ids
.
end
()
);
numPrimitivesPerRank
[
target_rank
]
=
ids
.
size
(
);
};
if
(
storage
.
hasGlobalCells
()
)
{
...
...
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