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
56bbc3c0
Commit
56bbc3c0
authored
5 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Formatting
parent
5222090f
No related branches found
No related tags found
No related merge requests found
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
error.h
+11
-11
11 additions, 11 deletions
error.h
inject.c
+1
-10
1 addition, 10 deletions
inject.c
mpistalls.c
+33
-36
33 additions, 36 deletions
mpistalls.c
mpiuse.c
+6
-11
6 additions, 11 deletions
mpiuse.c
mpiuse.h
+0
-1
0 additions, 1 deletion
mpiuse.h
readlog.c
+0
-1
0 additions, 1 deletion
readlog.c
with
51 additions
and
70 deletions
error.h
+
11
−
11
View file @
56bbc3c0
...
...
@@ -4,18 +4,18 @@
extern
int
myrank
;
/* Exit in error macro. */
#define error(s, ...) \
({ \
fflush(stdout); \
fprintf(stderr, "[%03i] %s %s:%s():%i: " s "\n", myrank, \
clocks_get_timesincestart(),
\
__FILE__, __FUNCTION__, __LINE__, ##__VA_ARGS__);
\
MPI_Abort(MPI_COMM_WORLD, -1); \
#define error(s, ...)
\
({
\
fflush(stdout);
\
fprintf(stderr, "[%03i] %s %s:%s():%i: " s "\n", myrank,
\
clocks_get_timesincestart(),
__FILE__, __FUNCTION__, __LINE__,
\
##__VA_ARGS__);
\
MPI_Abort(MPI_COMM_WORLD, -1);
\
})
/* Print a message */
#define message(s, ...) \
({ \
printf("[%04i] %s %s: " s "\n", myrank,
\
clocks_get_timesincestart(),
__FUNCTION__, ##__VA_ARGS__); \
#define message(s, ...)
\
({
\
printf("[%04i] %s %s: " s "\n", myrank,
clocks_get_timesincestart(),
\
__FUNCTION__, ##__VA_ARGS__);
\
})
This diff is collapsed.
Click to expand it.
inject.c
+
1
−
10
View file @
56bbc3c0
#include
<stdio.h>
/* Injection of MPI_Isends and MPI_Irecvs into the queues. */
void
inject_one
(
void
)
{
}
void
inject_one
(
void
)
{}
This diff is collapsed.
Click to expand it.
mpistalls.c
+
33
−
36
View file @
56bbc3c0
...
...
@@ -8,9 +8,9 @@
* exchanges of various data sizes and continuously checks the requests for
* completion. Also need timers to record the time taken by all this...
*/
#include
<stdio.h>
#include
<mpi.h>
#include
<pthread.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
"atomic.h"
...
...
@@ -32,7 +32,7 @@ static const int task_type_send = 22;
static
const
int
task_type_recv
=
23
;
/* Global communicators for each of the subtypes. */
static
const
int
task_subtype_count
=
30
;
// Just some upper limit on subtype.
static
const
int
task_subtype_count
=
30
;
// Just some upper limit on subtype.
static
MPI_Comm
subtypeMPI_comms
[
30
];
/* The local queues. */
...
...
@@ -62,8 +62,7 @@ static double log_clocks_cpufreq = 2194844448.0;
*/
static
void
*
inject_thread
(
void
*
arg
)
{
if
(
verbose
)
message
(
"%d: injection thread starts"
,
*
((
int
*
)
arg
));
if
(
verbose
)
message
(
"%d: injection thread starts"
,
*
((
int
*
)
arg
));
ticks
starttics
=
getticks
();
/* Ticks of our last attempt and ticks the first loop takes (usetics == 1). */
...
...
@@ -92,11 +91,11 @@ static void *inject_thread(void *arg) {
* nanoseconds. */
double
ns
=
(
double
)(
dt
-
looptics
)
/
log_clocks_cpufreq
*
1.0e9
;
if
(
ns
<
1.0e9
)
{
sleep
.
tv_nsec
=
(
long
)
ns
;
sleep
.
tv_nsec
=
(
long
)
ns
;
}
else
{
/* Wait more than one second. Must be an error, but complain and
* continue. */
sleep
.
tv_nsec
=
(
long
)
1.0e9
;
sleep
.
tv_nsec
=
(
long
)
1.0e9
;
message
(
"wait greater than one second"
);
}
nanosleep
(
&
sleep
,
NULL
);
...
...
@@ -106,8 +105,8 @@ static void *inject_thread(void *arg) {
// Differences to SWIFT: MPI_BYTE might overflow, should use MPI_Type(?).
int
err
=
0
;
if
(
log
->
type
==
task_type_send
)
{
err
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
err
=
MPI_Isend
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
/* Add a new send request. */
int
ind
=
atomic_inc
(
&
nr_sends
);
...
...
@@ -115,8 +114,8 @@ static void *inject_thread(void *arg) {
atomic_inc
(
&
todo_send
);
}
else
{
err
=
MPI_Irecv
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
err
=
MPI_Irecv
(
log
->
data
,
log
->
size
,
MPI_BYTE
,
log
->
otherrank
,
log
->
tag
,
subtypeMPI_comms
[
log
->
subtype
],
&
log
->
req
);
/* Add a new recv request. */
int
ind
=
atomic_inc
(
&
nr_recvs
);
...
...
@@ -166,7 +165,7 @@ static void *inject_thread(void *arg) {
*/
static
void
queue_runner
(
struct
mpiuse_log_entry
**
logs
,
int
volatile
*
nr_logs
,
int
volatile
*
todos
,
double
*
sum
,
int
*
ncalls
,
ticks
*
mint
,
ticks
*
maxt
)
{
ticks
*
mint
,
ticks
*
maxt
)
{
/* MPI_Test statistics. */
int
lncalls
=
0
;
...
...
@@ -217,8 +216,7 @@ static void queue_runner(struct mpiuse_log_entry **logs, int volatile *nr_logs,
*/
static
void
*
send_thread
(
void
*
arg
)
{
if
(
verbose
)
message
(
"%d: send thread starts (%d)"
,
*
((
int
*
)
arg
),
injecting
);
if
(
verbose
)
message
(
"%d: send thread starts (%d)"
,
*
((
int
*
)
arg
),
injecting
);
ticks
starttics
=
getticks
();
int
ncalls
;
...
...
@@ -227,9 +225,11 @@ static void *send_thread(void *arg) {
ticks
maxt
;
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 %.3f (%s)"
,
ncalls
,
clocks_from_ticks
(
sum
),
clocks_from_ticks
(
sum
/
ncalls
),
clocks_from_ticks
(
mint
),
clocks_from_ticks
(
maxt
),
clocks_getunit
());
message
(
"%d MPI_Test 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
());
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
starttics
),
clocks_getunit
());
...
...
@@ -242,8 +242,7 @@ static void *send_thread(void *arg) {
*/
static
void
*
recv_thread
(
void
*
arg
)
{
if
(
verbose
)
message
(
"%d: recv thread starts"
,
*
((
int
*
)
arg
));
if
(
verbose
)
message
(
"%d: recv thread starts"
,
*
((
int
*
)
arg
));
ticks
starttics
=
getticks
();
int
ncalls
;
...
...
@@ -252,9 +251,11 @@ static void *recv_thread(void *arg) {
ticks
maxt
;
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 %.3f (%s)"
,
ncalls
,
clocks_from_ticks
(
sum
),
clocks_from_ticks
(
sum
/
ncalls
),
clocks_from_ticks
(
mint
),
clocks_from_ticks
(
maxt
),
clocks_getunit
());
message
(
"%d MPI_Test 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
());
message
(
"took %.3f %s."
,
clocks_from_ticks
(
getticks
()
-
starttics
),
clocks_getunit
());
...
...
@@ -270,10 +271,8 @@ static int cmp_logs(const void *p1, const void *p2) {
struct
mpiuse_log_entry
*
l2
=
*
(
struct
mpiuse_log_entry
**
)
p2
;
/* Large unsigned values, so take care. */
if
(
l1
->
tic
>
l2
->
tic
)
return
1
;
if
(
l1
->
tic
<
l2
->
tic
)
return
-
1
;
if
(
l1
->
tic
>
l2
->
tic
)
return
1
;
if
(
l1
->
tic
<
l2
->
tic
)
return
-
1
;
return
0
;
}
...
...
@@ -286,14 +285,14 @@ static void pick_logs(void) {
size_t
nlogs
=
mpiuse_nr_logs
();
/* Duplicate of logs. */
reqs_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
nr_reqs
=
0
;
sends_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
nr_sends
=
0
;
recvs_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
reqs_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
nr_reqs
=
0
;
sends_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
nr_sends
=
0
;
recvs_queue
=
(
struct
mpiuse_log_entry
**
)
malloc
(
sizeof
(
struct
mpiuse_log_entry
*
)
*
nlogs
);
nr_recvs
=
0
;
for
(
int
k
=
0
;
k
<
nlogs
;
k
++
)
{
...
...
@@ -318,7 +317,6 @@ static void pick_logs(void) {
qsort
(
reqs_queue
,
nr_reqs
,
sizeof
(
struct
mpiuse_log_entry
*
),
cmp_logs
);
}
/**
* @brief main function.
*/
...
...
@@ -338,8 +336,7 @@ int main(int argc, char *argv[]) {
int
nr_nodes
=
0
;
res
=
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
nr_nodes
);
if
(
res
!=
MPI_SUCCESS
)
error
(
"MPI_Comm_size failed with error %i."
,
res
);
if
(
res
!=
MPI_SUCCESS
)
error
(
"MPI_Comm_size failed with error %i."
,
res
);
/* This should match the expected size. */
if
(
nr_nodes
!=
nranks
)
...
...
This diff is collapsed.
Click to expand it.
mpiuse.c
+
6
−
11
View file @
56bbc3c0
...
...
@@ -141,8 +141,7 @@ void mpiuse_log_restore(const char *filename) {
/* Open the input file. */
FILE
*
fd
;
if
((
fd
=
fopen
(
filename
,
"r"
))
==
NULL
)
{
message
(
"Failed to open the MPI use log file '%s'."
,
filename
);
message
(
"Failed to open the MPI use log file '%s'."
,
filename
);
return
;
}
...
...
@@ -155,9 +154,9 @@ void mpiuse_log_restore(const char *filename) {
while
(
!
feof
(
fd
))
{
if
(
fgets
(
line
,
132
,
fd
)
!=
NULL
)
{
if
(
line
[
0
]
!=
'#'
)
{
sscanf
(
line
,
"%zd %zd %zd %d %d %d %s %d %s %d %d %d %zd %zd"
,
&
stic
,
&
etic
,
&
dtic
,
&
step
,
&
rank
,
&
otherrank
,
type
,
&
itype
,
subtype
,
&
isubtype
,
&
activation
,
&
tag
,
&
size
,
&
sum
);
sscanf
(
line
,
"%zd %zd %zd %d %d %d %s %d %s %d %d %d %zd %zd"
,
&
stic
,
&
etic
,
&
dtic
,
&
step
,
&
rank
,
&
otherrank
,
type
,
&
itype
,
subtype
,
&
isubtype
,
&
activation
,
&
tag
,
&
size
,
&
sum
);
mpiuse_log_allocation
(
rank
,
step
,
stic
,
itype
,
isubtype
,
activation
,
size
,
otherrank
,
tag
);
...
...
@@ -172,18 +171,14 @@ void mpiuse_log_restore(const char *filename) {
*
* @result the number of log entries.
*/
int
mpiuse_nr_logs
(
void
)
{
return
mpiuse_log_count
;
}
int
mpiuse_nr_logs
(
void
)
{
return
mpiuse_log_count
;
}
/**
* @brief return the number of ranks in log.
*
* @result the number of ranks we've seen.
*/
int
mpiuse_nr_ranks
(
void
)
{
return
mpiuse_max_rank
+
1
;
}
int
mpiuse_nr_ranks
(
void
)
{
return
mpiuse_max_rank
+
1
;
}
/**
* @brief get a log entry.
...
...
This diff is collapsed.
Click to expand it.
mpiuse.h
+
0
−
1
View file @
56bbc3c0
...
...
@@ -58,7 +58,6 @@ struct mpiuse_log_entry {
/* The request associated with the call. */
MPI_Request
req
;
};
/* API. */
...
...
This diff is collapsed.
Click to expand it.
readlog.c
+
0
−
1
View file @
56bbc3c0
#include
<stdio.h>
/**
*
@
brief
read
the
output
from
a
run
of
SWIFT
with
the
MPI
communication
*
logger
enabled
.
...
...
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