Skip to content

Commit

Permalink
Log name updates
Browse files Browse the repository at this point in the history
  • Loading branch information
alexKrauseTUD committed Nov 1, 2021
1 parent c2a003d commit 63e3f38
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 10 deletions.
2 changes: 1 addition & 1 deletion include/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

#include <iostream>

#define MAX_POLL_CQ_TIMEOUT 1000 // ms
#define MAX_POLL_CQ_TIMEOUT 30000 // ms

#if __BYTE_ORDER == __LITTLE_ENDIAN
static inline uint64_t htonll(uint64_t x) { return bswap_64(x); }
Expand Down
18 changes: 10 additions & 8 deletions src/RDMACommunicator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,16 @@ void RDMACommunicator::receiveDataFromRemote( RDMARegion* communicationRegion, b
}

void RDMACommunicator::throughputTest( RDMARegion* communicationRegion ) {
/* We can create a string from a plain char* and our buffer is primed with \0 */
std::string logName( communicationRegion->receivePtr()+1 );
communicationRegion->clearCompleteBuffer();

/* provide data to remote */
std::size_t maxDataElements = 1ull << 32;
DataProvider d;
d.generateDummyData( maxDataElements >> 1 );
std::ofstream out;
auto in_time_t = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
std::stringstream logName;
logName << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d-%H-%M-%S_") << "ss_tput.log";
out.open( logName.str(), std::ios_base::app );
out.open( logName, std::ios_base::app );

std::ios_base::fmtflags f( std::cout.flags() );
for ( std::size_t elementCount = 1; elementCount < maxDataElements; elementCount <<= 1 ) {
Expand Down Expand Up @@ -298,6 +298,7 @@ void RDMACommunicator::throughputTest( RDMARegion* communicationRegion ) {

auto readable_size = GetBytesReadable( datasize );

std::cout.precision(15);
std::cout.setf(std::ios::fixed, std::ios::floatfield);
std::cout.setf(std::ios::showpoint);
out << communicationRegion->bufferSize << "\t" << elementCount << "\t" << datasize << "\t" << transfertime_ns << "\t" << BtoMB( datasize ) / (secs.count()) << std::endl << std::flush;
Expand All @@ -310,16 +311,16 @@ void RDMACommunicator::throughputTest( RDMARegion* communicationRegion ) {
}

void RDMACommunicator::consumingTest( RDMARegion* communicationRegion ) {
/* We can create a string from a plain char* and our buffer is primed with \0 */
std::string logName( communicationRegion->receivePtr()+1 );
communicationRegion->clearCompleteBuffer();

/* provide data to remote */
std::size_t maxDataElements = 1ull << 32;
DataProvider d;
d.generateDummyData( maxDataElements >> 1 );
std::ofstream out;
auto in_time_t = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
std::stringstream logName;
logName << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d-%H-%M-%S_") << "ds_tput.log";
out.open( logName.str(), std::ios_base::app );
out.open( logName, std::ios_base::app );

std::ios_base::fmtflags f( std::cout.flags() );
for ( std::size_t elementCount = 1; elementCount < maxDataElements; elementCount <<= 1 ) {
Expand Down Expand Up @@ -361,6 +362,7 @@ void RDMACommunicator::consumingTest( RDMARegion* communicationRegion ) {

auto readable_size = GetBytesReadable( datasize );

std::cout.precision(15);
std::cout.setf(std::ios::fixed, std::ios::floatfield);
std::cout.setf(std::ios::showpoint);
out << communicationRegion->bufferSize << "\t" << elementCount << "\t" << datasize << "\t" << transfertime_ns << "\t" << BtoMB( datasize ) / (secs.count()) << std::endl << std::flush;
Expand Down
26 changes: 25 additions & 1 deletion src/TaskManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ void TaskManager::setup() {
) );

registerTask( new Task( "ss_tput", "Single-sided throughput test", [] () -> void {
auto in_time_t = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
std::stringstream logNameStream;
logNameStream << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d-%H-%M-%S_") << "ss_tput.log";
std::string logName = logNameStream.str();

std::cout << "[Task] Set name: " << logNameStream.str() << std::endl;
// for ( std::size_t bytes = 1ull << 10; bytes < 1ull << 32; bytes <<= 1 ) {
for ( std::size_t bytes = 1ull << 10; bytes < 1ull << 32; bytes <<= 1 ) {
RDMACommunicator::getInstance().setupNewRegion( RDMACommunicator::getInstance().globalConfig, bytes );
while ( RDMACommunicator::getInstance().pendingRegionCreation() ) {
Expand All @@ -166,6 +173,11 @@ void TaskManager::setup() {
std::cout << "[main] Created region with id " << regionId << " and size " << GetBytesReadable( bytes ) << std::endl;
auto currentRegion = RDMAHandler::getInstance().getRegion( regionId );
std::cout << std::endl << "Single-sided throughput test." << std::endl;

/* Set global log file name */
currentRegion->clearCompleteBuffer();
memcpy( currentRegion->receivePtr()+1, logName.c_str(), logName.size() );

currentRegion->receivePtr()[0] = rdma_tput_test;
currentRegion->busy = true;

Expand All @@ -181,6 +193,11 @@ void TaskManager::setup() {
) );

registerTask( new Task( "ds_tput", "Double-sided throughput test", [] () -> void {
auto in_time_t = std::chrono::system_clock::to_time_t( std::chrono::system_clock::now() );
std::stringstream logNameStream;
logNameStream << std::put_time(std::localtime(&in_time_t), "%Y-%m-%d-%H-%M-%S_") << "ds_tput.log";
std::string logName = logNameStream.str();

for ( std::size_t bytes = 1ull << 10; bytes < 1ull << 32; bytes <<= 1 ) {
RDMACommunicator::getInstance().setupNewRegion( RDMACommunicator::getInstance().globalConfig, bytes );
while ( RDMACommunicator::getInstance().pendingRegionCreation() ) {
Expand All @@ -191,6 +208,11 @@ void TaskManager::setup() {
std::cout << "[main] Created region with id " << regionId << " and size " << GetBytesReadable( bytes ) << std::endl;
auto currentRegion = RDMAHandler::getInstance().getRegion( regionId );
std::cout << std::endl << "Double-sided throughput test." << std::endl;

/* Set global log file name */
currentRegion->clearCompleteBuffer();
memcpy( currentRegion->receivePtr()+1, logName.c_str(), logName.size() );

currentRegion->receivePtr()[0] = rdma_consume_test;
currentRegion->busy = true;

Expand Down Expand Up @@ -272,6 +294,7 @@ void TaskManager::setup() {
std::cout << "Communicated " << datasize << " Bytes (" << BtoMB( datasize ) << " MB) in " << secs.count() << " s times " << regionCount << " regions -- " << BtoMB( datasize * regionCount ) / (secs.count()) << " MB/s " << std::endl;

auto readable_size = GetBytesReadable( datasize );
std::cout.precision(15);
std::cout.setf(std::ios::fixed, std::ios::floatfield);
std::cout.setf(std::ios::showpoint);
out << regionCount << "\t" << bytes << "\t" << elementCount << "\t" << datasize << "\t" << transfertime_ns << "\t" << BtoMB( datasize ) / (secs.count()) << std::endl << std::flush;
Expand Down Expand Up @@ -354,6 +377,7 @@ void TaskManager::setup() {
std::cout << "Communicated " << datasize << " Bytes (" << BtoMB( datasize ) << " MB) in " << secs.count() << " s times " << regionCount << " regions -- " << BtoMB( datasize * regionCount ) / (secs.count()) << " MB/s " << std::endl;

auto readable_size = GetBytesReadable( datasize );
std::cout.precision(15);
std::cout.setf(std::ios::fixed, std::ios::floatfield);
std::cout.setf(std::ios::showpoint);
out << regionCount << "\t" << bytes << "\t" << elementCount << "\t" << datasize << "\t" << transfertime_ns << "\t" << BtoMB( datasize ) / (secs.count()) << std::endl << std::flush;
Expand All @@ -372,4 +396,4 @@ void TaskManager::setup() {

void TaskManager::setGlobalAbortFunction( std::function<void()> fn ) {
globalAbort = fn;
}
}

0 comments on commit 63e3f38

Please sign in to comment.