Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
b91a5ff3
Commit
b91a5ff3
authored
Dec 07, 2016
by
Peter W. Draper
Browse files
Improve descriptive content
parent
19f735d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/engine.c
View file @
b91a5ff3
...
...
@@ -317,7 +317,7 @@ void engine_redistribute(struct engine *e) {
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
error
(
"Failed to allreduce particle transfer counts."
);
/* Report how many particles
have
be
en
moved. */
/* Report how many particles
will
be moved. */
if
(
e
->
verbose
)
{
if
(
e
->
nodeID
==
0
)
{
size_t
total
=
0
;
...
...
@@ -329,8 +329,8 @@ void engine_redistribute(struct engine *e) {
r
++
;
}
}
message
(
"of %ld
particles %ld are not transferred (%.2f%%)"
,
total
,
unmoved
,
100
.
0
*
(
double
)
unmoved
/
(
double
)
total
);
message
(
"
%ld
of %ld
(%.2f%%) of particles moved"
,
total
-
unmoved
,
total
,
100
.
0
*
(
double
)
(
total
-
unmoved
)
/
(
double
)
total
);
}
}
...
...
src/partition.c
View file @
b91a5ff3
...
...
@@ -396,17 +396,18 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
/* We want a solution in which the current regions of the space are
* preserved when possible, to avoid unneccesary particle movement.
* So try mapping the current regions to the new regions and reassigning
* those with the greatest number of common cells... */
int
keymax
=
nregions
*
nregions
;
struct
indexval
*
ivs
=
malloc
(
sizeof
(
struct
indexval
)
*
keymax
);
bzero
(
ivs
,
sizeof
(
struct
indexval
)
*
keymax
);
* So create a 2d-array of cells counts that are common to all pairs
* of old and new ranks. Each element of the array has a cell count and
* an unique index so we can sort into decreasing counts. */
int
indmax
=
nregions
*
nregions
;
struct
indexval
*
ivs
=
malloc
(
sizeof
(
struct
indexval
)
*
indmax
);
bzero
(
ivs
,
sizeof
(
struct
indexval
)
*
indmax
);
for
(
int
k
=
0
;
k
<
ncells
;
k
++
)
{
int
index
=
regionid
[
k
]
+
nregions
*
s
->
cells_top
[
k
].
nodeID
;
ivs
[
index
].
count
++
;
ivs
[
index
].
index
=
index
;
}
qsort
(
ivs
,
key
max
,
sizeof
(
struct
indexval
),
indexvalcmp
);
qsort
(
ivs
,
ind
max
,
sizeof
(
struct
indexval
),
indexvalcmp
);
/* Go through the ivs using the largest counts first, these are the
* regions with the most cells in common, old partition to new. */
...
...
@@ -416,7 +417,7 @@ static void pick_metis(struct space *s, int nregions, int *vertexw, int *edgew,
oldmap
[
k
]
=
-
1
;
newmap
[
k
]
=
-
1
;
}
for
(
int
k
=
0
;
k
<
key
max
;
k
++
)
{
for
(
int
k
=
0
;
k
<
ind
max
;
k
++
)
{
/* Stop when all regions with common cells have been considered. */
if
(
ivs
[
k
].
count
==
0
)
break
;
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment