Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
arbor
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
arbor-sim
arbor
Commits
7b2b5209
Commit
7b2b5209
authored
8 years ago
by
Alexander Peyser
Committed by
Ben Cumming
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Extra profiling (#148)
Add some finer grained profiling to track exactly what time is spent inside of mpi calls.
parent
6c98c1fc
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/communication/mpi.cpp
+8
-0
8 additions, 0 deletions
src/communication/mpi.cpp
src/communication/mpi.hpp
+18
-0
18 additions, 0 deletions
src/communication/mpi.hpp
with
26 additions
and
0 deletions
src/communication/mpi.cpp
+
8
−
0
View file @
7b2b5209
...
@@ -16,15 +16,21 @@ void init(int *argc, char ***argv) {
...
@@ -16,15 +16,21 @@ void init(int *argc, char ***argv) {
int
provided
;
int
provided
;
// initialize with thread serialized level of thread safety
// initialize with thread serialized level of thread safety
PE
(
"MPI"
,
"Init"
);
MPI_Init_thread
(
argc
,
argv
,
MPI_THREAD_SERIALIZED
,
&
provided
);
MPI_Init_thread
(
argc
,
argv
,
MPI_THREAD_SERIALIZED
,
&
provided
);
assert
(
provided
>=
MPI_THREAD_SERIALIZED
);
assert
(
provided
>=
MPI_THREAD_SERIALIZED
);
PL
(
2
);
PE
(
"rank-size"
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
state
::
rank
);
MPI_Comm_rank
(
MPI_COMM_WORLD
,
&
state
::
rank
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
state
::
size
);
MPI_Comm_size
(
MPI_COMM_WORLD
,
&
state
::
size
);
PL
();
}
}
void
finalize
()
{
void
finalize
()
{
PE
(
"MPI"
,
"Finalize"
);
MPI_Finalize
();
MPI_Finalize
();
PL
(
2
);
}
}
bool
is_root
()
{
bool
is_root
()
{
...
@@ -49,7 +55,9 @@ bool ballot(bool vote) {
...
@@ -49,7 +55,9 @@ bool ballot(bool vote) {
char
result
;
char
result
;
char
value
=
vote
?
1
:
0
;
char
value
=
vote
?
1
:
0
;
PE
(
"MPI"
,
"Allreduce-ballot"
);
MPI_Allreduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
MPI_LAND
,
MPI_COMM_WORLD
);
MPI_Allreduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
MPI_LAND
,
MPI_COMM_WORLD
);
PL
(
2
);
return
result
;
return
result
;
}
}
...
...
This diff is collapsed.
Click to expand it.
src/communication/mpi.hpp
+
18
−
0
View file @
7b2b5209
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
#include
<algorithms.hpp>
#include
<algorithms.hpp>
#include
<communication/gathered_vector.hpp>
#include
<communication/gathered_vector.hpp>
#include
<util/debug.hpp>
#include
<util/debug.hpp>
#include
<profiling/profiler.hpp>
namespace
nest
{
namespace
nest
{
namespace
mc
{
namespace
mc
{
...
@@ -71,9 +73,11 @@ namespace mpi {
...
@@ -71,9 +73,11 @@ namespace mpi {
auto
buffer_size
=
(
rank
()
==
root
)
?
size
()
:
0
;
auto
buffer_size
=
(
rank
()
==
root
)
?
size
()
:
0
;
std
::
vector
<
T
>
buffer
(
buffer_size
);
std
::
vector
<
T
>
buffer
(
buffer_size
);
PE
(
"MPI"
,
"Gather"
);
MPI_Gather
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
// send buffer
MPI_Gather
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
// send buffer
buffer
.
data
(),
traits
::
count
(),
traits
::
mpi_type
(),
// receive buffer
buffer
.
data
(),
traits
::
count
(),
traits
::
mpi_type
(),
// receive buffer
root
,
MPI_COMM_WORLD
);
root
,
MPI_COMM_WORLD
);
PL
(
2
);
return
buffer
;
return
buffer
;
}
}
...
@@ -90,9 +94,11 @@ namespace mpi {
...
@@ -90,9 +94,11 @@ namespace mpi {
using
traits
=
mpi_traits
<
T
>
;
using
traits
=
mpi_traits
<
T
>
;
std
::
vector
<
T
>
buffer
(
size
());
std
::
vector
<
T
>
buffer
(
size
());
PE
(
"MPI"
,
"Allgather"
);
MPI_Allgather
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
// send buffer
MPI_Allgather
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
// send buffer
buffer
.
data
(),
traits
::
count
(),
traits
::
mpi_type
(),
// receive buffer
buffer
.
data
(),
traits
::
count
(),
traits
::
mpi_type
(),
// receive buffer
MPI_COMM_WORLD
);
MPI_COMM_WORLD
);
PL
(
2
);
return
buffer
;
return
buffer
;
}
}
...
@@ -112,6 +118,7 @@ namespace mpi {
...
@@ -112,6 +118,7 @@ namespace mpi {
std
::
vector
<
T
>
buffer
(
displs
.
back
()
/
traits
::
count
());
std
::
vector
<
T
>
buffer
(
displs
.
back
()
/
traits
::
count
());
PE
(
"MPI"
,
"Allgatherv"
);
MPI_Allgatherv
(
MPI_Allgatherv
(
// send buffer
// send buffer
values
.
data
(),
counts
[
rank
()],
traits
::
mpi_type
(),
values
.
data
(),
counts
[
rank
()],
traits
::
mpi_type
(),
...
@@ -119,6 +126,7 @@ namespace mpi {
...
@@ -119,6 +126,7 @@ namespace mpi {
buffer
.
data
(),
counts
.
data
(),
displs
.
data
(),
traits
::
mpi_type
(),
buffer
.
data
(),
counts
.
data
(),
displs
.
data
(),
traits
::
mpi_type
(),
MPI_COMM_WORLD
MPI_COMM_WORLD
);
);
PL
(
2
);
return
buffer
;
return
buffer
;
}
}
...
@@ -142,6 +150,7 @@ namespace mpi {
...
@@ -142,6 +150,7 @@ namespace mpi {
std
::
vector
<
T
>
buffer
(
displs
.
back
()
/
traits
::
count
());
std
::
vector
<
T
>
buffer
(
displs
.
back
()
/
traits
::
count
());
PE
(
"MPI"
,
"Allgatherv-partition"
);
MPI_Allgatherv
(
MPI_Allgatherv
(
// send buffer
// send buffer
values
.
data
(),
counts
[
rank
()],
traits
::
mpi_type
(),
values
.
data
(),
counts
[
rank
()],
traits
::
mpi_type
(),
...
@@ -149,6 +158,7 @@ namespace mpi {
...
@@ -149,6 +158,7 @@ namespace mpi {
buffer
.
data
(),
counts
.
data
(),
displs
.
data
(),
traits
::
mpi_type
(),
buffer
.
data
(),
counts
.
data
(),
displs
.
data
(),
traits
::
mpi_type
(),
MPI_COMM_WORLD
MPI_COMM_WORLD
);
);
PL
(
2
);
for
(
auto
&
d
:
displs
)
{
for
(
auto
&
d
:
displs
)
{
d
/=
traits
::
count
();
d
/=
traits
::
count
();
...
@@ -169,7 +179,9 @@ namespace mpi {
...
@@ -169,7 +179,9 @@ namespace mpi {
T
result
;
T
result
;
PE
(
"MPI"
,
"Reduce"
);
MPI_Reduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
op
,
root
,
MPI_COMM_WORLD
);
MPI_Reduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
op
,
root
,
MPI_COMM_WORLD
);
PL
(
2
);
return
result
;
return
result
;
}
}
...
@@ -183,7 +195,9 @@ namespace mpi {
...
@@ -183,7 +195,9 @@ namespace mpi {
T
result
;
T
result
;
PE
(
"MPI"
,
"Allreduce"
);
MPI_Allreduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
op
,
MPI_COMM_WORLD
);
MPI_Allreduce
(
&
value
,
&
result
,
1
,
traits
::
mpi_type
(),
op
,
MPI_COMM_WORLD
);
PL
(
2
);
return
result
;
return
result
;
}
}
...
@@ -206,7 +220,9 @@ namespace mpi {
...
@@ -206,7 +220,9 @@ namespace mpi {
using
traits
=
mpi_traits
<
T
>
;
using
traits
=
mpi_traits
<
T
>
;
PE
(
"MPI"
,
"Bcast"
);
MPI_Bcast
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
root
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
root
,
MPI_COMM_WORLD
);
PL
(
2
);
return
value
;
return
value
;
}
}
...
@@ -220,7 +236,9 @@ namespace mpi {
...
@@ -220,7 +236,9 @@ namespace mpi {
using
traits
=
mpi_traits
<
T
>
;
using
traits
=
mpi_traits
<
T
>
;
T
value
;
T
value
;
PE
(
"MPI"
,
"Bcast-void"
);
MPI_Bcast
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
root
,
MPI_COMM_WORLD
);
MPI_Bcast
(
&
value
,
traits
::
count
(),
traits
::
mpi_type
(),
root
,
MPI_COMM_WORLD
);
PL
(
2
);
return
value
;
return
value
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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