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
40b2e1fc
Commit
40b2e1fc
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Undo last commit
parent
0883c5a2
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/proxy.c
+40
-12
40 additions, 12 deletions
src/proxy.c
with
40 additions
and
12 deletions
src/proxy.c
+
40
−
12
View file @
40b2e1fc
...
@@ -323,6 +323,40 @@ void proxy_cells_exchange_first_mapper(void *map_data, int num_elements,
...
@@ -323,6 +323,40 @@ void proxy_cells_exchange_first_mapper(void *map_data, int num_elements,
}
}
}
}
struct
unpack_mapper_data
{
struct
space
*
s
;
const
int
with_gravity
;
MPI_Request
*
reqs_in
;
struct
proxy
*
proxies
;
};
void
proxy_cells_wait_and_unpack_mapper
(
void
*
map_data
,
int
num_elements
,
void
*
extra_data
)
{
MPI_Request
*
reqs
=
(
MPI_Request
*
)
map_data
;
struct
unpack_mapper_data
*
data
=
(
struct
unpack_mapper_data
*
)
extra_data
;
struct
space
*
s
=
data
->
s
;
const
int
with_gravity
=
data
->
with_gravity
;
MPI_Request
*
reqs_in
=
data
->
reqs_in
;
struct
proxy
*
proxies
=
data
->
proxies
;
for
(
int
k
=
0
;
k
<
num_elements
;
++
k
)
{
/* Wait for the data to arrive */
MPI_Status
status
;
if
(
MPI_Wait
(
&
reqs
[
k
],
&
status
)
!=
MPI_SUCCESS
)
error
(
"MPI_Wait failed!"
);
const
int
i
=
&
reqs
[
k
]
-
reqs_in
;
/* Un-pack the cells received in this proxy */
int
count
=
0
;
for
(
int
j
=
0
;
j
<
proxies
[
i
].
nr_cells_in
;
j
++
)
count
+=
cell_unpack
(
&
proxies
[
i
].
pcells_in
[
count
],
proxies
[
i
].
cells_in
[
j
],
s
,
with_gravity
);
}
}
#endif // WITH_MPI
#endif // WITH_MPI
/**
/**
...
@@ -417,18 +451,12 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies,
...
@@ -417,18 +451,12 @@ void proxy_cells_exchange(struct proxy *proxies, int num_proxies,
tic2
=
getticks
();
tic2
=
getticks
();
/* Wait for each pcell array to come in from the proxies. */
/* Wait for each pcell array to come in from the proxies
for
(
int
k
=
0
;
k
<
num_proxies
;
k
++
)
{
* and unpack the cells. */
int
pid
=
MPI_UNDEFINED
;
struct
unpack_mapper_data
unpack_data
=
{
s
,
with_gravity
,
reqs_in
,
proxies
};
MPI_Status
status
;
threadpool_map
(
&
s
->
e
->
threadpool
,
proxy_cells_wait_and_unpack_mapper
,
reqs_in
,
if
(
MPI_Waitany
(
num_proxies
,
reqs_in
,
&
pid
,
&
status
)
!=
MPI_SUCCESS
||
num_proxies
,
sizeof
(
MPI_Request
),
/*chunk_size=*/
1
,
pid
==
MPI_UNDEFINED
)
/*extra_data=*/
&
unpack_data
);
error
(
"MPI_Waitany failed."
);
// message( "cell data from proxy %i has arrived." , pid );
for
(
int
count
=
0
,
j
=
0
;
j
<
proxies
[
pid
].
nr_cells_in
;
j
++
)
count
+=
cell_unpack
(
&
proxies
[
pid
].
pcells_in
[
count
],
proxies
[
pid
].
cells_in
[
j
],
s
,
with_gravity
);
}
if
(
s
->
e
->
verbose
)
if
(
s
->
e
->
verbose
)
message
(
"Un-packing cells took %.3f %s."
,
message
(
"Un-packing cells took %.3f %s."
,
...
...
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