Commit c865c5ca authored by Sebastian Eibl's avatar Sebastian Eibl

BufferSystem now provides number of bytes sent/received

parent 5034c0a1
Pipeline #12905 passed with stages
in 421 minutes and 8 seconds
......@@ -53,6 +53,9 @@ void BufferSystem::iterator::operator++()
currentRecvBuffer_ = bufferSystem_.waitForNext( currentSenderRank_ );
if ( ! currentRecvBuffer_ ) {
WALBERLA_ASSERT_EQUAL( currentSenderRank_, -1 );
} else
{
bufferSystem_.bytesReceived_ += currentRecvBuffer_->size() * sizeof(RecvBuffer::ElementType);
}
}
......@@ -303,7 +306,10 @@ void BufferSystem::sendAll()
if ( ! iter->second.alreadySent )
{
if ( iter->second.buffer.size() > 0 )
{
bytesSent_ += iter->second.buffer.size() * sizeof(SendBuffer::ElementType);
currentComm_->send( iter->first, iter->second.buffer );
}
iter->second.alreadySent = true;
}
......@@ -331,7 +337,10 @@ void BufferSystem::send( MPIRank rank )
WALBERLA_ASSERT( ! iter->second.alreadySent ); // this buffer has already been sent
if ( iter->second.buffer.size() > 0 )
{
bytesSent_ += iter->second.buffer.size() * sizeof(SendBuffer::ElementType);
currentComm_->send( rank, iter->second.buffer );
}
iter->second.alreadySent = true;
}
......@@ -362,6 +371,9 @@ void BufferSystem::startCommunication()
currentComm_->scheduleReceives( recvInfos_ );
communicationRunning_ = true;
bytesSent_ = 0;
bytesReceived_ = 0;
}
......
......@@ -193,6 +193,9 @@ public:
//@}
//*******************************************************************************************************************
int64_t getBytesSent() const { return bytesSent_; }
int64_t getBytesReceived() const { return bytesReceived_; }
//* Rank Ranges *************************************************************************************************
/*! \name Rank Ranges */
......@@ -240,6 +243,9 @@ protected:
//stores tags of running communications in debug mode to ensure that
//each concurrently running communication uses different tags
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
};
......
......@@ -110,6 +110,9 @@ void symmetricCommunication()
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()
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) );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment