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
4531aa6b
Commit
4531aa6b
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Plain Diff
Merge branch 'multi-injectors' into multi-injectors-many
Conflicts: Makefile swiftmpistepsim.c
parents
a3489d86
86ad8813
No related branches found
No related tags found
2 merge requests
!9
Draft: Multiple threads for inject, send and recv.
,
!3
Draft: Multi injectors many
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+3
-4
3 additions, 4 deletions
Makefile
swiftmpistepsim.c
+56
-4
56 additions, 4 deletions
swiftmpistepsim.c
with
59 additions
and
8 deletions
Makefile
+
3
−
4
View file @
4531aa6b
CFLAGS
=
-g
-O0
-Wall
CFLAGS
=
-g
-O0
-Wall
all
:
swiftmpistepsim
all
:
swiftmpistepsim
swiftmpistepsim
:
swiftmpistepsim.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
Makefile
swiftmpistepsim
:
swiftmpistepsim.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
$(
CC
)
$(
CFLAGS
)
-o
swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c
-I
/usr/include/mpi
-lmpi
-lpthread
mpicc
$(
CFLAGS
)
-o
swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c
clean
:
clean
:
rm
swiftmpistepsim
rm
-f
swiftmpistepsim
This diff is collapsed.
Click to expand it.
swiftmpistepsim.c
+
56
−
4
View file @
4531aa6b
...
@@ -41,6 +41,9 @@ static int usetics = 1;
...
@@ -41,6 +41,9 @@ static int usetics = 1;
/* The wait between injections, nanosecs. */
/* The wait between injections, nanosecs. */
static
long
long
waitns
=
0
;
static
long
long
waitns
=
0
;
/* Set a data pattern and check we get this back, slow... */
static
int
datacheck
=
0
;
/* Integer types of send and recv tasks, must match log. */
/* Integer types of send and recv tasks, must match log. */
static
const
int
task_type_send
=
22
;
static
const
int
task_type_send
=
22
;
static
const
int
task_type_recv
=
23
;
static
const
int
task_type_recv
=
23
;
...
@@ -70,7 +73,37 @@ static int volatile todo_send = 0;
...
@@ -70,7 +73,37 @@ static int volatile todo_send = 0;
// XXX need to store this in the data file.
// XXX need to store this in the data file.
static
double
log_clocks_cpufreq
=
2194844448
.
0
;
static
double
log_clocks_cpufreq
=
2194844448
.
0
;
/**
* @brief fill a data area with a pattern that can be checked for changes.
*
* @param size size of data in bytes.
* @param data the data to fill.
*/
static
void
datacheck_fill
(
size_t
size
,
void
*
data
)
{
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
p
[
i
]
=
170
;
/* 10101010 in bits. */
}
}
/**
* @brief test a filled data area for our pattern.
*
* @param size size of data in bytes.
* @param data the data to fill.
*
* @result 1 on success, 0 otherwise.
*/
static
int
datacheck_test
(
size_t
size
,
void
*
data
)
{
unsigned
char
*
p
=
(
unsigned
char
*
)
data
;
for
(
size_t
i
=
0
;
i
<
size
;
i
++
)
{
if
(
p
[
i
]
!=
170
)
return
0
;
}
return
1
;
}
static
void
injection_runner
(
int
qid
)
{
static
void
injection_runner
(
int
qid
)
{
if
(
verbose
)
message
(
"%d: injection thread starts"
,
qid
);
if
(
verbose
)
message
(
"%d: injection thread starts"
,
qid
);
ticks
starttics
=
getticks
();
ticks
starttics
=
getticks
();
struct
mpiuse_log_entry
**
reqs
=
reqs_queue
[
qid
];
struct
mpiuse_log_entry
**
reqs
=
reqs_queue
[
qid
];
...
@@ -132,6 +165,11 @@ static void injection_runner(int qid) {
...
@@ -132,6 +165,11 @@ static void injection_runner(int qid) {
int
err
=
0
;
int
err
=
0
;
if
(
log
->
type
==
task_type_send
)
{
if
(
log
->
type
==
task_type_send
)
{
log
->
data
=
calloc
(
log
->
size
,
1
);
log
->
data
=
calloc
(
log
->
size
,
1
);
/* Fill data with pattern. */
if
(
datacheck
)
datacheck_fill
(
log
->
size
,
log
->
data
);
/* And send. */
err
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
err
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
...
@@ -141,6 +179,8 @@ static void injection_runner(int qid) {
...
@@ -141,6 +179,8 @@ static void injection_runner(int qid) {
atomic_inc
(
&
todo_send
);
atomic_inc
(
&
todo_send
);
}
else
{
}
else
{
/* Ready to receive. */
log
->
data
=
calloc
(
log
->
size
,
1
);
log
->
data
=
calloc
(
log
->
size
,
1
);
err
=
MPI_Irecv
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
err
=
MPI_Irecv
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
...
@@ -244,6 +284,12 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
...
@@ -244,6 +284,12 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
if
(
dt
>
lmaxt
)
lmaxt
=
dt
;
if
(
dt
>
lmaxt
)
lmaxt
=
dt
;
if
(
res
)
{
if
(
res
)
{
/* Check data sent data is unchanged and received data is as
* expected. */
if
(
datacheck
&&
!
datacheck_test
(
log
->
size
,
log
->
data
))
{
error
(
"Data mismatch on completion"
);
}
/* Done, clean up. */
/* Done, clean up. */
log
->
done
=
1
;
log
->
done
=
1
;
log
->
endtic
=
getticks
();
log
->
endtic
=
getticks
();
...
@@ -355,9 +401,8 @@ static void pick_logs(void) {
...
@@ -355,9 +401,8 @@ static void pick_logs(void) {
/* And keep this log. */
/* And keep this log. */
log
->
data
=
NULL
;
log
->
data
=
NULL
;
reqs_queue
[
nr_reqs
]
=
log
;
reqs
[
nreqs
]
=
log
;
nr_reqs
++
;
nreqs
++
;
}
else
{
}
else
{
error
(
"task type '%d' is not a known send or recv task"
,
log
->
type
);
error
(
"task type '%d' is not a known send or recv task"
,
log
->
type
);
}
}
...
@@ -430,8 +475,11 @@ int main(int argc, char *argv[]) {
...
@@ -430,8 +475,11 @@ int main(int argc, char *argv[]) {
/* Handle the command-line, we expect a mpiuse data file to read and various
/* Handle the command-line, we expect a mpiuse data file to read and various
* options. */
* options. */
int
opt
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"vfn:"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"vf
d
n:"
))
!=
-
1
)
{
switch
(
opt
)
{
switch
(
opt
)
{
case
'd'
:
datacheck
=
1
;
break
;
case
'f'
:
case
'f'
:
usetics
=
0
;
usetics
=
0
;
break
;
break
;
...
@@ -480,6 +528,10 @@ int main(int argc, char *argv[]) {
...
@@ -480,6 +528,10 @@ int main(int argc, char *argv[]) {
message
(
"Start of MPI tests"
);
message
(
"Start of MPI tests"
);
message
(
"=================="
);
message
(
"=================="
);
if
(
waitns
>
0
)
message
(
"adding fixed waits of %lld ns"
,
waitns
);
if
(
waitns
>
0
)
message
(
"adding fixed waits of %lld ns"
,
waitns
);
if
(
verbose
)
{
if
(
!
usetics
)
message
(
"using fast untimed injections"
);
if
(
datacheck
)
message
(
"checking data pattern on send and recv completion"
);
}
}
}
/* Make three threads, one for injecting tasks and two to check for
/* Make three threads, one for injecting tasks and two to check for
...
...
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