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
ed926dce
Commit
ed926dce
authored
9 years ago
by
Pedro Gonnet
Browse files
Options
Downloads
Patches
Plain Diff
re-format modified files.
parent
fdef9841
No related branches found
No related tags found
2 merge requests
!136
Master
,
!117
Engine exchange strays
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/engine.c
+19
-14
19 additions, 14 deletions
src/engine.c
src/proxy.c
+12
-11
12 additions, 11 deletions
src/proxy.c
src/proxy.h
+1
-1
1 addition, 1 deletion
src/proxy.h
src/space.c
+2
-2
2 additions, 2 deletions
src/space.c
src/space.h
+2
-1
2 additions, 1 deletion
src/space.h
with
36 additions
and
29 deletions
src/engine.c
+
19
−
14
View file @
ed926dce
...
...
@@ -596,29 +596,32 @@ void engine_exchange_cells(struct engine *e) {
* @brief Exchange straying parts with other nodes.
*
* @param e The #engine.
* @param offset_parts The index in the parts array as of which the foreign parts
* @param offset_parts The index in the parts array as of which the foreign
*parts
*reside.
* @param ind_part The foreign #cell ID of each part.
* @param Npart The number of stray parts, contains the number of parts received
* on return.
* @param offset_gparts The index in the gparts array as of which the foreign parts
* @param offset_gparts The index in the gparts array as of which the foreign
*parts
*reside.
* @param ind_gpart The foreign #cell ID of each gpart.
* @param Ngpart The number of stray gparts, contains the number of gparts received
* @param Ngpart The number of stray gparts, contains the number of gparts
*received
* on return.
*
* @return The number of arrived parts copied to parts and xparts.
*/
void
engine_exchange_strays
(
struct
engine
*
e
,
size_t
offset_parts
,
int
*
ind_part
,
size_t
*
Npart
,
size_t
offset_gparts
,
int
*
ind_gpart
,
size_t
*
Ngpart
)
{
void
engine_exchange_strays
(
struct
engine
*
e
,
size_t
offset_parts
,
int
*
ind_part
,
size_t
*
Npart
,
size_t
offset_gparts
,
int
*
ind_gpart
,
size_t
*
Ngpart
)
{
#ifdef WITH_MPI
struct
space
*
s
=
e
->
s
;
ticks
tic
=
getticks
();
/* Re-set the proxies. */
for
(
int
k
=
0
;
k
<
e
->
nr_proxies
;
k
++
)
e
->
proxies
[
k
].
nr_parts_out
=
0
;
...
...
@@ -632,8 +635,9 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, int *ind_part
error
(
"Do not have a proxy for the requested nodeID %i for part with "
"id=%llu, x=[%e,%e,%e]."
,
node_id
,
s
->
parts
[
offset_parts
+
k
].
id
,
s
->
parts
[
offset_parts
+
k
].
x
[
0
],
s
->
parts
[
offset_parts
+
k
].
x
[
1
],
s
->
parts
[
offset_parts
+
k
].
x
[
2
]);
node_id
,
s
->
parts
[
offset_parts
+
k
].
id
,
s
->
parts
[
offset_parts
+
k
].
x
[
0
],
s
->
parts
[
offset_parts
+
k
].
x
[
1
],
s
->
parts
[
offset_parts
+
k
].
x
[
2
]);
proxy_parts_load
(
&
e
->
proxies
[
pid
],
&
s
->
parts
[
offset_parts
+
k
],
&
s
->
xparts
[
offset_parts
+
k
],
1
);
}
...
...
@@ -646,8 +650,9 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, int *ind_part
error
(
"Do not have a proxy for the requested nodeID %i for part with "
"id=%zi, x=[%e,%e,%e]."
,
node_id
,
s
->
gparts
[
offset_parts
+
k
].
id
,
s
->
gparts
[
offset_gparts
+
k
].
x
[
0
],
s
->
gparts
[
offset_parts
+
k
].
x
[
1
],
s
->
gparts
[
offset_gparts
+
k
].
x
[
2
]);
node_id
,
s
->
gparts
[
offset_parts
+
k
].
id
,
s
->
gparts
[
offset_gparts
+
k
].
x
[
0
],
s
->
gparts
[
offset_parts
+
k
].
x
[
1
],
s
->
gparts
[
offset_gparts
+
k
].
x
[
2
]);
proxy_gparts_load
(
&
e
->
proxies
[
pid
],
&
s
->
gparts
[
offset_gparts
+
k
],
1
);
}
...
...
@@ -685,7 +690,7 @@ void engine_exchange_strays(struct engine *e, size_t offset_parts, int *ind_part
}
if
(
e
->
verbose
)
{
message
(
"sent out %zi/%zi parts/gparts, got %i/%i back."
,
*
Npart
,
*
Ngpart
,
count_parts_in
,
count_gparts_in
);
count_parts_in
,
count_gparts_in
);
}
if
(
offset_parts
+
count_parts_in
>
s
->
size_parts
)
{
s
->
size_parts
=
(
offset_parts
+
count_parts_in
)
*
1
.
05
;
...
...
@@ -1231,8 +1236,8 @@ void engine_print_task_counts(struct engine *e) {
else
counts
[
task_type_count
]
+=
1
;
#ifdef WITH_MPI
printf
(
"[%04i] %s engine_print_task_counts: task counts are [ %s=%i"
,
e
->
nodeID
,
clocks_get_timesincestart
(),
taskID_names
[
0
],
counts
[
0
]);
printf
(
"[%04i] %s engine_print_task_counts: task counts are [ %s=%i"
,
e
->
nodeID
,
clocks_get_timesincestart
(),
taskID_names
[
0
],
counts
[
0
]);
#else
printf
(
"%s engine_print_task_counts: task counts are [ %s=%i"
,
clocks_get_timesincestart
(),
taskID_names
[
0
],
counts
[
0
]);
...
...
This diff is collapsed.
Click to expand it.
src/proxy.c
+
12
−
11
View file @
ed926dce
...
...
@@ -249,7 +249,7 @@ void proxy_parts_exch2(struct proxy *p) {
/* Unpack the incomming parts counts. */
p
->
nr_parts_in
=
p
->
buff_in
[
0
];
p
->
nr_gparts_in
=
p
->
buff_in
[
1
];
/* Is there enough space in the buffer? */
if
(
p
->
nr_parts_in
>
p
->
size_parts_in
)
{
do
{
...
...
@@ -268,8 +268,8 @@ void proxy_parts_exch2(struct proxy *p) {
p
->
size_gparts_in
*=
proxy_buffgrow
;
}
while
(
p
->
nr_gparts_in
>
p
->
size_gparts_in
);
free
(
p
->
gparts_in
);
if
((
p
->
gparts_in
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_in
))
==
NULL
)
if
((
p
->
gparts_in
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_in
))
==
NULL
)
error
(
"Failed to re-allocate gparts_in buffers."
);
}
...
...
@@ -286,8 +286,9 @@ void proxy_parts_exch2(struct proxy *p) {
// p->nodeID ); fflush(stdout);
}
if
(
p
->
nr_gparts_in
>
0
)
{
if
(
MPI_Irecv
(
p
->
gparts_in
,
sizeof
(
struct
gpart
)
*
p
->
nr_gparts_in
,
MPI_BYTE
,
p
->
nodeID
,
p
->
nodeID
*
proxy_tag_shift
+
proxy_tag_gparts
,
if
(
MPI_Irecv
(
p
->
gparts_in
,
sizeof
(
struct
gpart
)
*
p
->
nr_gparts_in
,
MPI_BYTE
,
p
->
nodeID
,
p
->
nodeID
*
proxy_tag_shift
+
proxy_tag_gparts
,
MPI_COMM_WORLD
,
&
p
->
req_gparts_in
)
!=
MPI_SUCCESS
)
error
(
"Failed to irecv gpart data."
);
// message( "irecv gpart data (%i) from node %i." , p->nr_gparts_in ,
...
...
@@ -355,8 +356,8 @@ void proxy_gparts_load(struct proxy *p, struct gpart *gparts, int N) {
p
->
size_gparts_out
*=
proxy_buffgrow
;
}
while
(
p
->
nr_gparts_out
+
N
>
p
->
size_gparts_out
);
struct
gpart
*
tp
;
if
((
tp
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_out
))
==
NULL
)
if
((
tp
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_out
))
==
NULL
)
error
(
"Failed to re-allocate gparts_out buffers."
);
memcpy
(
tp
,
p
->
gparts_out
,
sizeof
(
struct
gpart
)
*
p
->
nr_gparts_out
);
free
(
p
->
gparts_out
);
...
...
@@ -423,15 +424,15 @@ void proxy_init(struct proxy *p, int mynodeID, int nodeID) {
/* Allocate the gpart send and receive buffers, if needed. */
if
(
p
->
gparts_in
==
NULL
)
{
p
->
size_gparts_in
=
proxy_buffinit
;
if
((
p
->
gparts_in
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_in
))
==
NULL
)
if
((
p
->
gparts_in
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_in
))
==
NULL
)
error
(
"Failed to allocate gparts_in buffers."
);
}
p
->
nr_gparts_in
=
0
;
if
(
p
->
gparts_out
==
NULL
)
{
p
->
size_gparts_out
=
proxy_buffinit
;
if
((
p
->
gparts_out
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_out
))
==
NULL
)
if
((
p
->
gparts_out
=
(
struct
gpart
*
)
malloc
(
sizeof
(
struct
gpart
)
*
p
->
size_gparts_out
))
==
NULL
)
error
(
"Failed to allocate gparts_out buffers."
);
}
p
->
nr_gparts_out
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/proxy.h
+
1
−
1
View file @
ed926dce
...
...
@@ -59,7 +59,7 @@ struct proxy {
int
nr_parts_in
,
nr_parts_out
;
int
size_gparts_in
,
size_gparts_out
;
int
nr_gparts_in
,
nr_gparts_out
;
/* Buffer to hold the incomming/outgoing particle counts. */
int
buff_out
[
2
],
buff_in
[
2
];
...
...
This diff is collapsed.
Click to expand it.
src/space.c
+
2
−
2
View file @
ed926dce
...
...
@@ -374,8 +374,8 @@ void space_rebuild(struct space *s, double cell_max, int verbose) {
until they are fully implemented. */
size_t
nr_parts_exchanged
=
s
->
nr_parts
-
nr_parts
;
size_t
nr_gparts_exchanged
=
0
;
engine_exchange_strays
(
s
->
e
,
nr_parts
,
&
ind
[
nr_parts
],
&
nr_parts_exchanged
,
0
,
NULL
,
&
nr_gparts_exchanged
);
engine_exchange_strays
(
s
->
e
,
nr_parts
,
&
ind
[
nr_parts
],
&
nr_parts_exchanged
,
0
,
NULL
,
&
nr_gparts_exchanged
);
s
->
nr_parts
=
nr_parts
+
nr_parts_exchanged
;
/* Re-allocate the index array if needed.. */
...
...
This diff is collapsed.
Click to expand it.
src/space.h
+
2
−
1
View file @
ed926dce
...
...
@@ -129,7 +129,8 @@ extern struct parallel_sort space_sort_struct;
/* function prototypes. */
void
space_parts_sort
(
struct
space
*
s
,
int
*
ind
,
size_t
N
,
int
min
,
int
max
,
int
verbose
);
void
space_gparts_sort
(
struct
gpart
*
gparts
,
int
*
ind
,
size_t
N
,
int
min
,
int
max
);
void
space_gparts_sort
(
struct
gpart
*
gparts
,
int
*
ind
,
size_t
N
,
int
min
,
int
max
);
struct
cell
*
space_getcell
(
struct
space
*
s
);
int
space_getsid
(
struct
space
*
s
,
struct
cell
**
ci
,
struct
cell
**
cj
,
double
*
shift
);
...
...
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