Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
swiftmpistepsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
swiftmpistepsim
Commits
d75d43fd
Commit
d75d43fd
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Use MPI_Waitall to see if that helps or not. It does neither
parent
5ae4842f
Branches
Branches containing commit
No related tags found
1 merge request
!4
Use MPI_Waitall instead of MPI_Test polling.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+5
-0
5 additions, 0 deletions
README.md
swiftmpistepsim.c
+38
-36
38 additions, 36 deletions
swiftmpistepsim.c
with
43 additions
and
36 deletions
README.md
+
5
−
0
View file @
d75d43fd
SWIFTmpistepsim
===============
Variation: this branch uses an
`MPI_Waitall`
call to synchronously wait
for all the available requests, rather than polling using MPI_Test.
The result runs slightly slower, but takes roughly similar times as
the MPI_Test version.
This project is a standalone part of
[
SWIFT
](
http://www.swiftsim.com
)
that
aims to roughly simulate the MPI interactions that taking a single step of a
SWIFT simulation makes. Making it possible to more easily see the performance
...
...
This diff is collapsed.
Click to expand it.
swiftmpistepsim.c
+
38
−
36
View file @
d75d43fd
...
...
@@ -175,7 +175,7 @@ static void *inject_thread(void *arg) {
/**
* @brief main loop to run over a queue of MPI requests and test for when they
* complete. Returns the total amount of time spent in calls to MPI_
Test
and
* complete. Returns the total amount of time spent in calls to MPI_
Waitall
and
* the number of times it was called.
*
* @param logs the list of logs pointing to requests.
...
...
@@ -183,16 +183,16 @@ static void *inject_thread(void *arg) {
* logs.
* @param todos pointer to the variable containing the number of requests that
* are still active.
* @param sum the total number of ticks spent in calls to MPI_
Test
.
* @param ncalls the total number of calls to MPI_
Test
.
* @param mint the minimum ticks an MPI_
Test
call took.
* @param maxt the maximum ticks an MPI_
Test
call took.
* @param sum the total number of ticks spent in calls to MPI_
Waitall
.
* @param ncalls the total number of calls to MPI_
Waitall
.
* @param mint the minimum ticks an MPI_
Waitall
call took.
* @param maxt the maximum ticks an MPI_
Waitall
call took.
*/
static
void
queue_runner
(
struct
mpiuse_log_entry
**
logs
,
int
volatile
*
nr_logs
,
int
volatile
*
todos
,
double
*
sum
,
int
*
ncalls
,
ticks
*
mint
,
ticks
*
maxt
)
{
/* Global MPI_
Test
statistics. */
/* Global MPI_
Waitall
statistics. */
int
lncalls
=
0
;
double
lsum
=
0
.
0
;
ticks
lmint
=
INT_MAX
;
...
...
@@ -201,40 +201,42 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
/* We loop while new requests are being injected and we still have requests
* to complete. */
while
(
injecting
||
(
!
injecting
&&
*
todos
>
0
))
{
/* Make a list of active requests. */
int
nlogs
=
*
nr_logs
;
MPI_Request
*
reqs
=
(
MPI_Request
*
)
calloc
(
nlogs
,
sizeof
(
MPI_Request
));
int
*
inds
=
(
int
*
)
calloc
(
nlogs
,
sizeof
(
int
));
int
nactlogs
=
0
;
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
logs
[
k
];
if
(
log
!=
NULL
&&
!
log
->
done
)
{
ticks
tics
=
getticks
();
int
res
;
MPI_Status
stat
;
int
err
=
MPI_Test
(
&
log
->
req
,
&
res
,
&
stat
);
if
(
err
!=
MPI_SUCCESS
)
{
error
(
"MPI_Test call failed"
);
}
/* Increment etc. of statistics about time in MPI_Test. */
ticks
dt
=
getticks
()
-
tics
;
log
->
tsum
+=
(
double
)
dt
;
lsum
+=
(
double
)
dt
;
log
->
nr_tests
++
;
lncalls
++
;
if
(
dt
<
log
->
tmin
)
log
->
tmin
=
dt
;
if
(
dt
>
log
->
tmax
)
log
->
tmax
=
dt
;
if
(
dt
<
lmint
)
lmint
=
dt
;
if
(
dt
>
lmaxt
)
lmaxt
=
dt
;
if
(
res
)
{
/* Done, clean up. */
log
->
done
=
1
;
log
->
endtic
=
getticks
();
free
(
log
->
data
);
atomic_dec
(
todos
);
}
reqs
[
nactlogs
]
=
logs
[
k
]
->
req
;
inds
[
nactlogs
]
=
k
;
nactlogs
++
;
}
}
if
(
nactlogs
>
0
)
{
ticks
tics
=
getticks
();
int
err
=
MPI_Waitall
(
nactlogs
,
reqs
,
MPI_STATUSES_IGNORE
);
if
(
err
!=
MPI_SUCCESS
)
error
(
"MPI_Waitall call failed"
);
/* Done, clean up. */
for
(
int
k
=
0
;
k
<
nactlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
logs
[
inds
[
k
]];
log
->
done
=
1
;
log
->
endtic
=
getticks
();
free
(
log
->
data
);
}
atomic_sub
(
todos
,
nactlogs
);
lncalls
++
;
ticks
dt
=
getticks
()
-
tics
;
if
(
dt
>
lmaxt
)
lmaxt
=
dt
;
if
(
dt
<
lmint
)
lmint
=
dt
;
lsum
+=
dt
;
}
free
(
reqs
);
free
(
inds
);
}
/* All done. */
...
...
@@ -260,7 +262,7 @@ static void *send_thread(void *arg) {
queue_runner
(
sends_queue
,
&
nr_sends
,
&
todo_send
,
&
sum
,
&
ncalls
,
&
mint
,
&
maxt
);
message
(
"%d MPI_
Test
calls took: %.3f, mean time %.3f, min time %.3f, max time "
"%d MPI_
Waitall
calls took: %.3f, mean time %.3f, min time %.3f, max time "
"%.3f (%s)"
,
ncalls
,
clocks_from_ticks
(
sum
),
clocks_from_ticks
(
sum
/
ncalls
),
clocks_from_ticks
(
mint
),
clocks_from_ticks
(
maxt
),
clocks_getunit
());
...
...
@@ -287,7 +289,7 @@ static void *recv_thread(void *arg) {
queue_runner
(
recvs_queue
,
&
nr_recvs
,
&
todo_recv
,
&
sum
,
&
ncalls
,
&
mint
,
&
maxt
);
message
(
"%d MPI_
Test
calls took: %.3f, mean time %.3f, min time %.3f, max time "
"%d MPI_
Waitall
calls took: %.3f, mean time %.3f, min time %.3f, max time "
"%.3f (%s)"
,
ncalls
,
clocks_from_ticks
(
sum
),
clocks_from_ticks
(
sum
/
ncalls
),
clocks_from_ticks
(
mint
),
clocks_from_ticks
(
maxt
),
clocks_getunit
());
...
...
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