Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Florian Weik
waLBerla
Commits
c865c5ca
Commit
c865c5ca
authored
Jan 08, 2019
by
Sebastian Eibl
Browse files
BufferSystem now provides number of bytes sent/received
parent
5034c0a1
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/core/mpi/BufferSystem.cpp
View file @
c865c5ca
...
@@ -53,6 +53,9 @@ void BufferSystem::iterator::operator++()
...
@@ -53,6 +53,9 @@ void BufferSystem::iterator::operator++()
currentRecvBuffer_
=
bufferSystem_
.
waitForNext
(
currentSenderRank_
);
currentRecvBuffer_
=
bufferSystem_
.
waitForNext
(
currentSenderRank_
);
if
(
!
currentRecvBuffer_
)
{
if
(
!
currentRecvBuffer_
)
{
WALBERLA_ASSERT_EQUAL
(
currentSenderRank_
,
-
1
);
WALBERLA_ASSERT_EQUAL
(
currentSenderRank_
,
-
1
);
}
else
{
bufferSystem_
.
bytesReceived_
+=
currentRecvBuffer_
->
size
()
*
sizeof
(
RecvBuffer
::
ElementType
);
}
}
}
}
...
@@ -303,7 +306,10 @@ void BufferSystem::sendAll()
...
@@ -303,7 +306,10 @@ void BufferSystem::sendAll()
if
(
!
iter
->
second
.
alreadySent
)
if
(
!
iter
->
second
.
alreadySent
)
{
{
if
(
iter
->
second
.
buffer
.
size
()
>
0
)
if
(
iter
->
second
.
buffer
.
size
()
>
0
)
{
bytesSent_
+=
iter
->
second
.
buffer
.
size
()
*
sizeof
(
SendBuffer
::
ElementType
);
currentComm_
->
send
(
iter
->
first
,
iter
->
second
.
buffer
);
currentComm_
->
send
(
iter
->
first
,
iter
->
second
.
buffer
);
}
iter
->
second
.
alreadySent
=
true
;
iter
->
second
.
alreadySent
=
true
;
}
}
...
@@ -331,7 +337,10 @@ void BufferSystem::send( MPIRank rank )
...
@@ -331,7 +337,10 @@ void BufferSystem::send( MPIRank rank )
WALBERLA_ASSERT
(
!
iter
->
second
.
alreadySent
);
// this buffer has already been sent
WALBERLA_ASSERT
(
!
iter
->
second
.
alreadySent
);
// this buffer has already been sent
if
(
iter
->
second
.
buffer
.
size
()
>
0
)
if
(
iter
->
second
.
buffer
.
size
()
>
0
)
{
bytesSent_
+=
iter
->
second
.
buffer
.
size
()
*
sizeof
(
SendBuffer
::
ElementType
);
currentComm_
->
send
(
rank
,
iter
->
second
.
buffer
);
currentComm_
->
send
(
rank
,
iter
->
second
.
buffer
);
}
iter
->
second
.
alreadySent
=
true
;
iter
->
second
.
alreadySent
=
true
;
}
}
...
@@ -362,6 +371,9 @@ void BufferSystem::startCommunication()
...
@@ -362,6 +371,9 @@ void BufferSystem::startCommunication()
currentComm_
->
scheduleReceives
(
recvInfos_
);
currentComm_
->
scheduleReceives
(
recvInfos_
);
communicationRunning_
=
true
;
communicationRunning_
=
true
;
bytesSent_
=
0
;
bytesReceived_
=
0
;
}
}
...
...
src/core/mpi/BufferSystem.h
View file @
c865c5ca
...
@@ -193,6 +193,9 @@ public:
...
@@ -193,6 +193,9 @@ public:
//@}
//@}
//*******************************************************************************************************************
//*******************************************************************************************************************
int64_t
getBytesSent
()
const
{
return
bytesSent_
;
}
int64_t
getBytesReceived
()
const
{
return
bytesReceived_
;
}
//* Rank Ranges *************************************************************************************************
//* Rank Ranges *************************************************************************************************
/*! \name Rank Ranges */
/*! \name Rank Ranges */
...
@@ -240,6 +243,9 @@ protected:
...
@@ -240,6 +243,9 @@ protected:
//stores tags of running communications in debug mode to ensure that
//stores tags of running communications in debug mode to ensure that
//each concurrently running communication uses different tags
//each concurrently running communication uses different tags
static
std
::
set
<
int
>
activeTags_
;
static
std
::
set
<
int
>
activeTags_
;
int64_t
bytesSent_
=
0
;
///< number of bytes sent during last communication
int64_t
bytesReceived_
=
0
;
///< number of bytes received during last communication
};
};
...
...
tests/core/mpi/BufferSystemTest.cpp
View file @
c865c5ca
...
@@ -110,6 +110,9 @@ void symmetricCommunication()
...
@@ -110,6 +110,9 @@ void symmetricCommunication()
WALBERLA_CHECK_EQUAL
(
receivedVal
,
it
.
rank
()
);
WALBERLA_CHECK_EQUAL
(
receivedVal
,
it
.
rank
()
);
}
}
WALBERLA_CHECK_EQUAL
(
bs
.
getBytesSent
(),
(
MSG_SIZE
*
sizeof
(
int
)
+
MSG_SIZE
*
mpi
::
BUFFER_DEBUG_OVERHEAD
)
*
2
);
WALBERLA_CHECK_EQUAL
(
bs
.
getBytesReceived
(),
(
MSG_SIZE
*
sizeof
(
int
)
+
MSG_SIZE
*
mpi
::
BUFFER_DEBUG_OVERHEAD
)
*
2
);
}
}
/**
/**
...
@@ -175,6 +178,9 @@ void asymmetricCommunication()
...
@@ -175,6 +178,9 @@ void asymmetricCommunication()
WALBERLA_CHECK
(
it
.
buffer
().
isEmpty
()
);
WALBERLA_CHECK
(
it
.
buffer
().
isEmpty
()
);
}
}
}
}
WALBERLA_CHECK_EQUAL
(
bs
.
getBytesSent
(),
int64_c
(
sizeof
(
int
)
+
mpi
::
BUFFER_DEBUG_OVERHEAD
)
*
int64_c
(
rank
+
rank
)
);
WALBERLA_CHECK_EQUAL
(
bs
.
getBytesReceived
(),
int64_c
(
sizeof
(
int
)
+
mpi
::
BUFFER_DEBUG_OVERHEAD
)
*
int64_c
(
leftNeighbor
+
rightNeighbor
)
);
}
}
...
...
Write
Preview
Markdown
is supported
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