Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
SWIFT
SWIFTsim
Commits
62d44ea9
Commit
62d44ea9
authored
9 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Force range of METIS task weights to 1-1000
Stops silly ranges of 2E6 when starting bad ICs
parent
bab203b4
No related branches found
No related tags found
1 merge request
!61
METIS fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+24
-3
24 additions, 3 deletions
src/engine.c
with
24 additions
and
3 deletions
src/engine.c
+
24
−
3
View file @
62d44ea9
...
...
@@ -303,7 +303,8 @@ void engine_repartition(struct engine *e) {
int
nr_nodes
=
e
->
nr_nodes
,
nodeID
=
e
->
nodeID
;
float
wscale
=
1e-3
,
vscale
=
1e-3
,
wscale_buff
;
idx_t
wtot
=
0
;
const
idx_t
wmax
=
1e9
/
e
->
nr_nodes
;
idx_t
wmax
=
1e9
/
e
->
nr_nodes
;
idx_t
wmin
;
/* Clear the repartition flag. */
e
->
forcerepart
=
0
;
...
...
@@ -454,7 +455,7 @@ void engine_repartition(struct engine *e) {
for
(
k
=
0
;
k
<
nr_cells
;
k
++
)
weights_v
[
k
]
*=
scale
;
}
/* Merge the weights arrays ac
c
ross all nodes. */
/* Merge the weights arrays across all nodes. */
#if IDXTYPEWIDTH == 32
if
((
res
=
MPI_Reduce
((
nodeID
==
0
)
?
MPI_IN_PLACE
:
weights_v
,
weights_v
,
nr_cells
,
MPI_INT
,
MPI_SUM
,
0
,
MPI_COMM_WORLD
))
!=
...
...
@@ -482,6 +483,26 @@ void engine_repartition(struct engine *e) {
/* As of here, only one node needs to compute the partition. */
if
(
nodeID
==
0
)
{
/* Soften weights to avoid a large range. This seems to be problematic
* with initial partitions from very inhomogeneous distributions that
* also have bad h_max. */
wmin
=
wmax
;
wmax
=
0
.
0
;
for
(
k
=
0
;
k
<
26
*
nr_cells
;
k
++
)
{
wmax
=
weights_e
[
k
]
>
wmax
?
weights_e
[
k
]
:
wmax
;
wmin
=
weights_e
[
k
]
<
wmin
?
weights_e
[
k
]
:
wmin
;
}
if
(
wmax
>
1000
)
{
wscale
=
1000
.
0
f
/
(
wmax
-
wmin
);
message
(
"wscale = %f"
,
wscale
);
for
(
k
=
0
;
k
<
26
*
nr_cells
;
k
++
)
{
weights_e
[
k
]
=
(
weights_e
[
k
]
-
wmin
)
*
wscale
+
1
;
}
for
(
k
=
0
;
k
<
nr_cells
;
k
++
)
{
weights_v
[
k
]
=
(
weights_v
[
k
]
-
wmin
)
*
wscale
+
1
;
}
}
/* Check that the edge weights are fully symmetric. */
/* for ( cid = 0 ; cid < nr_cells ; cid++ )
for ( k = 0 ; k < 26 ; k++ ) {
...
...
@@ -543,7 +564,7 @@ void engine_repartition(struct engine *e) {
/* Dump graph in METIS format */
dumpMETISGraph
(
"metis_graph"
,
idx_nr_cells
,
one
,
offsets
,
inds
,
weights_v
,
NULL
,
weights_e
);
weights_v
,
NULL
,
weights_e
);
if
(
METIS_PartGraphRecursive
(
&
idx_nr_cells
,
&
one
,
offsets
,
inds
,
weights_v
,
NULL
,
weights_e
,
&
idx_nr_nodes
,
NULL
,
NULL
,
...
...
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