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
f26ba2de
Commit
f26ba2de
authored
2 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add option to randomize sends and recvs independently
parent
ea3fbee7
No related branches found
No related tags found
1 merge request
!6
Version with faked data
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
swiftmpifakestepsim.c
+65
-23
65 additions, 23 deletions
swiftmpifakestepsim.c
with
65 additions
and
23 deletions
swiftmpifakestepsim.c
+
65
−
23
View file @
f26ba2de
...
...
@@ -304,8 +304,9 @@ static int cmp_logs(const void *p1, const void *p2) {
* The final list is sorted into increasing time of activation if required,
* otherwise the order is randomized.
*
* @param random randomize injection order, otherwise use order of the
* original logs.
* @param random randomize injection order of sends or sends and recvs,
* otherwise use order of the original logs. Just sends
* are randomized when 1, 2 randomizes both, 0 neither.
*/
static
void
pick_logs
(
int
random
)
{
size_t
nlogs
=
mpiuse_nr_logs
();
...
...
@@ -321,30 +322,65 @@ static void pick_logs(int random) {
nlogs
,
sizeof
(
struct
mpiuse_log_entry
*
));
nr_recvs
=
0
;
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
mpiuse_get_log
(
k
);
if
(
log
->
rank
==
myrank
&&
log
->
activation
)
{
log
->
data
=
NULL
;
reqs_queue
[
nr_reqs
]
=
log
;
nr_reqs
++
;
if
(
random
==
0
||
random
==
2
)
{
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
mpiuse_get_log
(
k
);
if
(
log
->
rank
==
myrank
&&
log
->
activation
)
{
log
->
data
=
NULL
;
reqs_queue
[
nr_reqs
]
=
log
;
nr_reqs
++
;
}
}
if
(
random
==
0
)
{
/* Sort into increasing time. */
qsort
(
reqs_queue
,
nr_reqs
,
sizeof
(
struct
mpiuse_log_entry
*
),
cmp_logs
);
}
else
{
/* Randomize the order, so ranks do not all work in sequence. */
mpiuse_shuffle_logs
(
reqs_queue
,
nr_reqs
);
}
}
if
(
!
random
)
{
/* Sort into increasing time. */
qsort
(
reqs_queue
,
nr_reqs
,
sizeof
(
struct
mpiuse_log_entry
*
),
cmp_logs
);
/* Check. */
if
(
random
==
0
)
{
for
(
int
k
=
0
;
k
<
nr_reqs
-
1
;
k
++
)
{
if
(
reqs_queue
[
k
]
->
tic
>
reqs_queue
[
k
+
1
]
->
tic
)
message
(
"reqs_queue: %lld > %lld"
,
reqs_queue
[
k
]
->
tic
,
reqs_queue
[
k
+
1
]
->
tic
);
}
}
}
else
{
/* Randomize the order, so ranks do not all work in sequence. */
mpiuse_shuffle_logs
(
reqs_queue
,
nr_reqs
);
}
/* Check. */
if
(
!
random
)
{
for
(
int
k
=
0
;
k
<
nr_reqs
-
1
;
k
++
)
{
if
(
reqs_queue
[
k
]
->
tic
>
reqs_queue
[
k
+
1
]
->
tic
)
message
(
"reqs_queue: %lld > %lld"
,
reqs_queue
[
k
]
->
tic
,
reqs_queue
[
k
+
1
]
->
tic
);
/* Randomizing the sends, but injecting the recvs first. */
/* Get recvs. */
int
nrecv
=
0
;
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
mpiuse_get_log
(
k
);
if
(
log
->
rank
==
myrank
&&
log
->
activation
&&
log
->
type
==
RECV_TYPE
)
{
log
->
data
=
NULL
;
reqs_queue
[
nr_reqs
]
=
log
;
nr_reqs
++
;
nrecv
++
;
}
}
/* These are sorted into log time order. */
qsort
(
reqs_queue
,
nrecv
,
sizeof
(
struct
mpiuse_log_entry
*
),
cmp_logs
);
/* Now the sends. */
int
nsend
=
0
;
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
struct
mpiuse_log_entry
*
log
=
mpiuse_get_log
(
k
);
if
(
log
->
rank
==
myrank
&&
log
->
activation
&&
log
->
type
==
SEND_TYPE
)
{
log
->
data
=
NULL
;
reqs_queue
[
nr_reqs
]
=
log
;
nr_reqs
++
;
nsend
++
;
}
}
/* These are randomized. */
mpiuse_shuffle_logs
(
&
reqs_queue
[
nrecv
],
nsend
);
}
}
...
...
@@ -395,7 +431,7 @@ int main(int argc, char *argv[]) {
char
*
odata
=
NULL
;
int
opt
;
unsigned
int
seed
=
default_seed
;
while
((
opt
=
getopt
(
argc
,
argv
,
"vds:rgx:c:o:f"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"vds:rgx:c:o:f
:
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'd'
:
datacheck
=
1
;
...
...
@@ -404,7 +440,7 @@ int main(int argc, char *argv[]) {
cdf
=
optarg
;
break
;
case
'f'
:
randomorder
=
1
;
randomorder
=
atoi
(
optarg
)
;
break
;
case
'g'
:
uniform
=
0
;
...
...
@@ -481,6 +517,12 @@ int main(int argc, char *argv[]) {
}
/* Each rank requires its own queue, so extract them. */
if
(
verbose
&&
myrank
==
0
)
{
if
(
randomorder
==
0
)
message
(
"Message order same as generated"
);
if
(
randomorder
==
1
)
message
(
"Message send order randomized"
);
if
(
randomorder
==
2
)
message
(
"Message send and recv order randomized"
);
}
pick_logs
(
randomorder
);
/* Time to start time. Try to make it synchronous across the ranks. */
...
...
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