Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Weinzierl
teaMPI
Commits
55de6c80
Commit
55de6c80
authored
Jul 20, 2018
by
Ben Hazelwood
Browse files
Tidy up PerfSimulator
parent
772a01a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
applications/PerfSimulator/PerfSimulator.cpp
View file @
55de6c80
...
@@ -16,49 +16,23 @@ const int NUM_COMPUTATIONS = 5e7;
...
@@ -16,49 +16,23 @@ const int NUM_COMPUTATIONS = 5e7;
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
MPI_Init
(
&
argc
,
&
argv
);
MPI_Init
(
&
argc
,
&
argv
);
// if (argc != 3)
// {
// std::cout << "Usage: mpirun Latency <NUM TRIALS> <NUM COMPUTATIONS>\n";
// MPI_Abort(MPI_COMM_WORLD, 1);
// }
int
rank
;
int
size
;
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
size
);
const
int
source
=
0
;
const
int
dest
=
size
-
1
;
char
m
=
'0'
;
for
(
int
t
=
0
;
t
<
NUM_TRIALS
;
t
++
)
for
(
int
t
=
0
;
t
<
NUM_TRIALS
;
t
++
)
{
{
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
#ifdef COMPARE_PROGRESS
#ifdef COMPARE_PROGRESS
MPI_Sendrecv
(
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
0
,
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
0
,
MPI_COMM_SELF
,
MPI_STATUS_IGNORE
);
MPI_Sendrecv
(
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
-
1
,
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
0
,
MPI_COMM_SELF
,
MPI_STATUS_IGNORE
);
#endif
#endif
for
(
int
i
=
0
;
i
<
NUM_COMPUTATIONS
;
i
++
)
{
for
(
int
i
=
0
;
i
<
NUM_COMPUTATIONS
;
i
++
)
{
sin
(
1.0
/
3.0
);
sin
(
1.0
/
3.0
);
// Arbitrary computation (the compiler shouldn't optimise it out...)
}
}
#ifdef COMPARE_PROGRESS
#ifdef COMPARE_PROGRESS
MPI_Sendrecv
(
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
1
,
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
0
,
MPI_COMM_SELF
,
MPI_STATUS_IGNORE
);
MPI_Sendrecv
(
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
1
,
MPI_IN_PLACE
,
0
,
MPI_BYTE
,
MPI_PROC_NULL
,
0
,
MPI_COMM_SELF
,
MPI_STATUS_IGNORE
);
#endif
#endif
MPI_Barrier
(
MPI_COMM_WORLD
);
MPI_Barrier
(
MPI_COMM_WORLD
);
// if (rank == source)
// {
// MPI_Recv(&m, 1, MPI_CHAR, source, 0, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
// }
// else
// {
// MPI_Send(&m, 1, MPI_CHAR, dest, 0, MPI_COMM_WORLD);
// }
}
}
MPI_Finalize
();
MPI_Finalize
();
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment