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
fe6ad7b8
Commit
fe6ad7b8
authored
3 years ago
by
Peter W. Draper
Browse files
Options
Downloads
Patches
Plain Diff
Add upper gaussian size distribution
parent
6edf9246
Branches
Branches containing commit
No related tags found
1 merge request
!6
Version with faked data
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+2
-2
2 additions, 2 deletions
Makefile
mpiuse.c
+35
-3
35 additions, 3 deletions
mpiuse.c
mpiuse.h
+1
-1
1 addition, 1 deletion
mpiuse.h
swiftmpifakestepsim.c
+16
-6
16 additions, 6 deletions
swiftmpifakestepsim.c
with
54 additions
and
12 deletions
Makefile
+
2
−
2
View file @
fe6ad7b8
...
...
@@ -3,10 +3,10 @@ CFLAGS = -g -O0 -Wall
all
:
swiftmpistepsim swiftmpifakestepsim
swiftmpistepsim
:
swiftmpistepsim.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
mpicc
$(
CFLAGS
)
-o
swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c
-lpthread
mpicc
$(
CFLAGS
)
-o
swiftmpistepsim swiftmpistepsim.c mpiuse.c clocks.c
-lpthread
-lm
swiftmpifakestepsim
:
swiftmpifakestepsim.c mpiuse.c mpiuse.h atomic.h cycle.h clocks.h clocks.c
mpicc
$(
CFLAGS
)
-o
swiftmpifakestepsim swiftmpifakestepsim.c mpiuse.c clocks.c
-lpthread
mpicc
$(
CFLAGS
)
-o
swiftmpifakestepsim swiftmpifakestepsim.c mpiuse.c clocks.c
-lpthread
-lm
clean
:
rm
-f
swiftmpistepsim
...
...
This diff is collapsed.
Click to expand it.
mpiuse.c
+
35
−
3
View file @
fe6ad7b8
...
...
@@ -22,6 +22,7 @@
*/
/* Standard includes. */
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
...
...
@@ -258,18 +259,39 @@ struct mpiuse_log_entry *mpiuse_get_log(int ind) {
return
NULL
;
}
/**
* @brief return random number from a upper part of gaussian distribution.
*
* @result the random.
*/
static
double
gauss_rand_upper
(
void
)
{
double
V1
,
V2
,
S
;
do
{
double
U1
=
drand48
();
double
U2
=
drand48
();
V1
=
U1
-
1
.
0
;
V2
=
U2
-
1
.
0
;
S
=
V1
*
V1
+
V2
*
V2
;
}
while
(
S
>=
1
.
0
||
S
==
0
.
0
);
return
fabs
(
V1
*
sqrt
(
-
2
.
0
*
log
(
S
)
/
S
));
}
/**
* @brief generate a list of fake exchanges as mpiuse logs.
*
* @param nr_nodes the number of ranks that will be used.
* @param nr_logs the number of logs to generate per rank.
* @param size bytes per message, unless random when this is the maximum
* and the minimum is 1.
* and the minimum is 1
for uniform and 2.5 sigma for gaussian
.
* @param random whether to use random sizes.
* @param seed the random seed, use same for fixed sequences.
* @param uniform whether to use a uniform distribution.
*/
void
mpiuse_log_generate
(
int
nr_nodes
,
int
nr_logs
,
int
size
,
int
random
,
long
int
seed
)
{
long
int
seed
,
int
uniform
)
{
/* Each rank exchanges messages with all the others and each "log" has the
* same size. */
...
...
@@ -277,8 +299,18 @@ void mpiuse_log_generate(int nr_nodes, int nr_logs, int size, int random,
int
tag
=
1
;
for
(
int
k
=
0
;
k
<
nr_logs
;
k
++
)
{
/* Set size for this messages. */
int
logsize
=
size
;
if
(
random
)
logsize
=
(
drand48
()
*
(
double
)
size
)
+
1
;
if
(
random
)
{
if
(
uniform
)
{
logsize
=
(
drand48
()
*
(
double
)
size
)
+
1
;
}
else
{
// Gaussian so no maximum, assume size is 2.5 sigma.
logsize
=
(
gauss_rand_upper
()
*
(
double
)
size
*
0
.
25
)
+
1
;
}
}
for
(
int
i
=
0
;
i
<
nr_nodes
;
i
++
)
{
for
(
int
j
=
0
;
j
<
nr_nodes
;
j
++
)
{
if
(
i
!=
j
)
{
...
...
This diff is collapsed.
Click to expand it.
mpiuse.h
+
1
−
1
View file @
fe6ad7b8
...
...
@@ -102,6 +102,6 @@ int mpiuse_nr_ranks(void);
void
mpiuse_dump_logs
(
int
nranks
,
const
char
*
logfile
);
void
mpiuse_log_generate
(
int
nr_nodes
,
int
nr_logs
,
int
size
,
int
random
,
long
int
seed
);
long
int
seed
,
int
uniform
);
#endif
/* SWIFT_MPIUSE_H */
This diff is collapsed.
Click to expand it.
swiftmpifakestepsim.c
+
16
−
6
View file @
fe6ad7b8
...
...
@@ -341,8 +341,9 @@ static void pick_logs(void) {
static
void
usage
(
char
*
argv
[])
{
fprintf
(
stderr
,
"Usage: %s [-vf] nr_messages logfile.dat
\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
" options: -v verbose, -d data check, -s size (bytes), -r"
" random from 0 to size
\n
"
);
fprintf
(
stderr
,
" options: -v verbose, -d data check, -s size (bytes), "
"-r uniform random from 1 to size, "
"-r -g half gaussian random from 1 with 2.5 sigma size.
\n
"
);
fflush
(
stderr
);
}
...
...
@@ -370,8 +371,9 @@ int main(int argc, char *argv[]) {
* whether to use a random selection (with a fixed seed). */
int
size
=
1024
;
int
random
=
0
;
int
uniform
=
1
;
int
opt
;
while
((
opt
=
getopt
(
argc
,
argv
,
"vds:r"
))
!=
-
1
)
{
while
((
opt
=
getopt
(
argc
,
argv
,
"vds:r
g
"
))
!=
-
1
)
{
switch
(
opt
)
{
case
'd'
:
datacheck
=
1
;
...
...
@@ -382,6 +384,9 @@ int main(int argc, char *argv[]) {
case
'r'
:
random
=
1
;
break
;
case
'g'
:
uniform
=
0
;
break
;
case
'v'
:
verbose
=
1
;
break
;
...
...
@@ -403,14 +408,19 @@ int main(int argc, char *argv[]) {
/* Generate the fake logs for the exchanges. */
if
(
myrank
==
0
)
{
if
(
random
)
{
message
(
"Generating %d fake logs for %d ranks with random distribution"
" up to size %d"
,
nr_logs
,
nr_nodes
,
size
);
if
(
uniform
)
{
message
(
"Generating %d fake logs for %d ranks with random distribution"
" using size %d"
,
nr_logs
,
nr_nodes
,
size
);
}
else
{
message
(
"Generating %d fake logs for %d ranks with gaussian random "
"distribution using size %d as 2.5 sigma"
,
nr_logs
,
nr_nodes
,
size
);
}
}
else
{
message
(
"Generating %d fake logs for %d ranks of size %d"
,
nr_logs
,
nr_nodes
,
size
);
}
}
mpiuse_log_generate
(
nr_nodes
,
nr_logs
,
size
,
random
,
seed
);
mpiuse_log_generate
(
nr_nodes
,
nr_logs
,
size
,
random
,
seed
,
uniform
);
int
nranks
=
mpiuse_nr_ranks
();
/* Each rank requires its own queue, so extract them. */
...
...
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