diff --git a/include/util.h b/include/util.h index e0e6fd2..1016dc0 100644 --- a/include/util.h +++ b/include/util.h @@ -24,7 +24,7 @@ #include -#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); } diff --git a/src/RDMACommunicator.cpp b/src/RDMACommunicator.cpp index c1b97d5..8edf735 100644 --- a/src/RDMACommunicator.cpp +++ b/src/RDMACommunicator.cpp @@ -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 ) { @@ -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; @@ -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 ) { @@ -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; diff --git a/src/TaskManager.cpp b/src/TaskManager.cpp index 071187c..33688b5 100644 --- a/src/TaskManager.cpp +++ b/src/TaskManager.cpp @@ -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() ) { @@ -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; @@ -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() ) { @@ -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; @@ -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; @@ -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; @@ -372,4 +396,4 @@ void TaskManager::setup() { void TaskManager::setGlobalAbortFunction( std::function fn ) { globalAbort = fn; -} \ No newline at end of file +}