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
6b062019
Commit
6b062019
authored
9 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Removed debugging information
parent
b6beeed3
No related branches found
No related tags found
2 merge requests
!136
Master
,
!131
Redistribute fixes
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/engine.c
+8
-28
8 additions, 28 deletions
src/engine.c
with
8 additions
and
28 deletions
src/engine.c
+
8
−
28
View file @
6b062019
...
@@ -212,12 +212,9 @@ void engine_redistribute(struct engine *e) {
...
@@ -212,12 +212,9 @@ void engine_redistribute(struct engine *e) {
/* We need to re-link the gpart partners of parts. */
/* We need to re-link the gpart partners of parts. */
int
current_dest
=
dest
[
0
];
int
current_dest
=
dest
[
0
];
size_t
count_this_dest
=
0
;
size_t
count_this_dest
=
0
;
size_t
count_links
=
0
;
for
(
size_t
k
=
0
;
k
<
s
->
nr_parts
;
++
k
)
{
for
(
size_t
k
=
0
;
k
<
s
->
nr_parts
;
++
k
)
{
if
(
s
->
parts
[
k
].
gpart
!=
NULL
)
{
if
(
s
->
parts
[
k
].
gpart
!=
NULL
)
{
++
count_links
;
/* As the addresses will be invalidated by the communications, we will */
/* As the addresses will be invalidated by the communications, we will */
/* instead store the absolute index from the start of the sub-array */
/* instead store the absolute index from the start of the sub-array */
/* of particles to be sent to a given node. */
/* of particles to be sent to a given node. */
...
@@ -228,16 +225,15 @@ void engine_redistribute(struct engine *e) {
...
@@ -228,16 +225,15 @@ void engine_redistribute(struct engine *e) {
count_this_dest
=
0
;
count_this_dest
=
0
;
}
}
if
(
s
->
parts
[
k
].
gpart
->
id
<
0
)
/* Debug */
error
(
"Trying to link a partnerless gpart !"
);
/* if(s->parts[k].gpart->id < 0) */
/* error("Trying to link a partnerless gpart !"); */
s
->
parts
[
k
].
gpart
->
id
=
count_this_dest
;
s
->
parts
[
k
].
gpart
->
id
=
count_this_dest
;
count_this_dest
++
;
count_this_dest
++
;
}
}
}
}
message
(
"Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)"
,
count_links
,
s
->
nr_parts
,
s
->
nr_gparts
);
/* Get destination of each g-particle */
/* Get destination of each g-particle */
for
(
size_t
k
=
0
;
k
<
s
->
nr_gparts
;
k
++
)
{
for
(
size_t
k
=
0
;
k
<
s
->
nr_gparts
;
k
++
)
{
...
@@ -262,13 +258,6 @@ void engine_redistribute(struct engine *e) {
...
@@ -262,13 +258,6 @@ void engine_redistribute(struct engine *e) {
/* Sort the gparticles according to their cell index. */
/* Sort the gparticles according to their cell index. */
space_gparts_sort
(
gparts
,
g_dest
,
s
->
nr_gparts
,
0
,
nr_nodes
-
1
);
space_gparts_sort
(
gparts
,
g_dest
,
s
->
nr_gparts
,
0
,
nr_nodes
-
1
);
count_links
=
0
;
for
(
size_t
k
=
0
;
k
<
s
->
nr_gparts
;
++
k
)
{
if
(
gparts
[
k
].
id
>=
0
)
++
count_links
;
}
message
(
"Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)"
,
count_links
,
s
->
nr_parts
,
s
->
nr_gparts
);
/* Get all the counts from all the nodes. */
/* Get all the counts from all the nodes. */
if
(
MPI_Allreduce
(
MPI_IN_PLACE
,
counts
,
nr_nodes
*
nr_nodes
,
MPI_INT
,
MPI_SUM
,
if
(
MPI_Allreduce
(
MPI_IN_PLACE
,
counts
,
nr_nodes
*
nr_nodes
,
MPI_INT
,
MPI_SUM
,
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
MPI_COMM_WORLD
)
!=
MPI_SUCCESS
)
...
@@ -324,8 +313,8 @@ void engine_redistribute(struct engine *e) {
...
@@ -324,8 +313,8 @@ void engine_redistribute(struct engine *e) {
/* Are we sending any part/xpart ? */
/* Are we sending any part/xpart ? */
if
(
counts
[
ind_send
]
>
0
)
{
if
(
counts
[
ind_send
]
>
0
)
{
message
(
"Sending %d part to node %d"
,
counts
[
ind_send
],
k
);
/*
message("Sending %d part to node %d", counts[ind_send], k);
*/
/* If the send is to the same node, just copy */
/* If the send is to the same node, just copy */
if
(
k
==
nodeID
)
{
if
(
k
==
nodeID
)
{
memcpy
(
&
parts_new
[
offset_recv
],
&
s
->
parts
[
offset_send
],
memcpy
(
&
parts_new
[
offset_recv
],
&
s
->
parts
[
offset_send
],
...
@@ -352,7 +341,7 @@ void engine_redistribute(struct engine *e) {
...
@@ -352,7 +341,7 @@ void engine_redistribute(struct engine *e) {
/* Are we sending any gpart ? */
/* Are we sending any gpart ? */
if
(
g_counts
[
ind_send
]
>
0
)
{
if
(
g_counts
[
ind_send
]
>
0
)
{
message
(
"Sending %d gpart to node %d"
,
g_counts
[
ind_send
],
k
);
/*
message("Sending %d gpart to node %d", g_counts[ind_send], k);
*/
/* If the send is to the same node, just copy */
/* If the send is to the same node, just copy */
if
(
k
==
nodeID
)
{
if
(
k
==
nodeID
)
{
...
@@ -444,13 +433,10 @@ void engine_redistribute(struct engine *e) {
...
@@ -444,13 +433,10 @@ void engine_redistribute(struct engine *e) {
/* Verify that the links are correct */
/* Verify that the links are correct */
/* MATTHIEU: To be commented out once we are happy */
/* MATTHIEU: To be commented out once we are happy */
count_links
=
0
;
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
++
k
)
{
for
(
size_t
k
=
0
;
k
<
nr_gparts
;
++
k
)
{
if
(
gparts_new
[
k
].
id
>
0
)
{
if
(
gparts_new
[
k
].
id
>
0
)
{
++
count_links
;
if
(
gparts_new
[
k
].
part
->
gpart
!=
&
gparts_new
[
k
])
if
(
gparts_new
[
k
].
part
->
gpart
!=
&
gparts_new
[
k
])
error
(
"Linking problem !"
);
error
(
"Linking problem !"
);
...
@@ -460,19 +446,13 @@ void engine_redistribute(struct engine *e) {
...
@@ -460,19 +446,13 @@ void engine_redistribute(struct engine *e) {
error
(
"Linked particles are not at the same position !"
);
error
(
"Linked particles are not at the same position !"
);
}
}
}
}
message
(
"Got %zd gparts with a link (n_parts=%zd n_gparts=%zd)"
,
count_links
,
nr_parts
,
nr_gparts
);
for
(
size_t
k
=
0
;
k
<
nr_parts
;
++
k
)
{
for
(
size_t
k
=
0
;
k
<
nr_parts
;
++
k
)
{
if
(
parts_new
[
k
].
gpart
!=
NULL
)
{
if
(
parts_new
[
k
].
gpart
!=
NULL
)
{
if
(
parts_new
[
k
].
gpart
->
part
!=
&
parts_new
[
k
])
if
(
parts_new
[
k
].
gpart
->
part
!=
&
parts_new
[
k
])
error
(
"Linking problem !"
);
error
(
"Linking problem !"
);
}
}
}
}
/* Set the new part data, free the old. */
/* Set the new part data, free the old. */
...
...
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