From cdf8aac7e3a88df0fb93586bbf47b17c192ae2fc Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Thu, 21 Jul 2016 09:33:42 +0200 Subject: added ReceiverThreads for tests with 40GBE --- src/DetectorModule/DetectorModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/DetectorModule/DetectorModule.cpp') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index bee50e9..9c3d98f 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -28,7 +28,7 @@ void timer_start(std::function func, unsigned int interval){ DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, - index_{0}, + index_{1}, client_{address, detectorID+4000} { printf("Creating %d\n", detectorID); -- cgit v1.2.3 From 8940620375c3bd9fef263fe9352c22384215cb13 Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Thu, 21 Jul 2016 09:50:16 +0200 Subject: sending out always the same packet --- src/DetectorModule/DetectorModule.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/DetectorModule/DetectorModule.cpp') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index 9c3d98f..c98a3e2 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -41,6 +41,8 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, //read the input data from the file corresponding to the detectorModuleID readInput(); + unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; + std::copy(((char*)buffer_.data()), ((char*)buffer_.data())+sinoSize*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); printf("Created %d\n", detectorID); } @@ -57,8 +59,8 @@ auto DetectorModule::send() -> void{ unsigned int bufferSizeIndex = index_ % 1000; unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; *reinterpret_cast(sendBuffer_.data()) = index_; - std::copy(((char*)buffer_.data())+sinoSize*bufferSizeIndex*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); - client_.send(sendBuffer_.data(), sizeof(unsigned short)*numberOfDetectorsPerModule_*numberOfProjections_+sizeof(std::size_t)); + //std::copy(((char*)buffer_.data())+sinoSize*bufferSizeIndex*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); + client_.send(sendBuffer_.data(), sizeof(unsigned short)*sinoSize+sizeof(std::size_t)); ++index_; } -- cgit v1.2.3 From ebcd23f3d86976fbfe2768d3ee0925db2cff773a Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Thu, 21 Jul 2016 10:23:08 +0200 Subject: packet size is now configurable --- src/DetectorModule/DetectorModule.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/DetectorModule/DetectorModule.cpp') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index c98a3e2..b222341 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -25,11 +25,12 @@ void timer_start(std::function func, unsigned int interval){ }).detach(); } -DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath) : +DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath, const int packetSize) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, index_{1}, - client_{address, detectorID+4000} { + client_{address, detectorID+4000}, + packetSize_{packetSize} { printf("Creating %d\n", detectorID); @@ -37,12 +38,12 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!"); } - sendBuffer_.resize(numberOfDetectorsPerModule_*numberOfProjections_*sizeof(unsigned short) + sizeof(std::size_t)); + sendBuffer_.resize(packetSize); //read the input data from the file corresponding to the detectorModuleID readInput(); - unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; - std::copy(((char*)buffer_.data()), ((char*)buffer_.data())+sinoSize*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); + //unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; + //std::copy(((char*)buffer_.data()), ((char*)buffer_.data())+sinoSize*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); printf("Created %d\n", detectorID); } @@ -60,7 +61,7 @@ auto DetectorModule::send() -> void{ unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; *reinterpret_cast(sendBuffer_.data()) = index_; //std::copy(((char*)buffer_.data())+sinoSize*bufferSizeIndex*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); - client_.send(sendBuffer_.data(), sizeof(unsigned short)*sinoSize+sizeof(std::size_t)); + client_.send(sendBuffer_.data(), sendBuffer_.size()); ++index_; } -- cgit v1.2.3 From 15075baf177290511eac810025048ccd346cf66e Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Wed, 12 Oct 2016 14:46:40 +0200 Subject: send configurable parts of the projection data --- src/DetectorModule/DetectorModule.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src/DetectorModule/DetectorModule.cpp') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index b222341..798c529 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -28,7 +28,7 @@ void timer_start(std::function func, unsigned int interval){ DetectorModule::DetectorModule(const int detectorID, const std::string& address, const std::string& configPath, const int packetSize) : detectorID_{detectorID}, numberOfDetectorsPerModule_{16}, - index_{1}, + index_{0u}, client_{address, detectorID+4000}, packetSize_{packetSize} { @@ -38,7 +38,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!"); } - sendBuffer_.resize(packetSize); + sendBuffer_.resize(16010); //read the input data from the file corresponding to the detectorModuleID readInput(); @@ -49,6 +49,8 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, auto DetectorModule::send() -> void{ BOOST_LOG_TRIVIAL(debug) << "Detectormodule " << detectorID_ << " :sending udp packet with index " << index_ << "."; + int numberOfProjectionsPerPacket = 500; + int numberOfParts = numberOfProjections_/numberOfProjectionsPerPacket; // sendBuffer_[0] = (sizeof(std::size_t)) & 0xff; // sendBuffer_[1] = (sizeof(std::size_t) >> 8) & 0xff; // sendBuffer_[2] = (sizeof(std::size_t) >> 16) & 0xff; @@ -58,11 +60,15 @@ auto DetectorModule::send() -> void{ // sendBuffer_[6] = (sizeof(std::size_t) >> 48) & 0xff; // sendBuffer_[7] = (sizeof(std::size_t) >> 56) & 0xff; unsigned int bufferSizeIndex = index_ % 1000; - unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjections_; - *reinterpret_cast(sendBuffer_.data()) = index_; - //std::copy(((char*)buffer_.data())+sinoSize*bufferSizeIndex*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)); + unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjectionsPerPacket; + *reinterpret_cast(sendBuffer_.data()) = index_; + *reinterpret_cast(sendBuffer_.data()+sizeof(std::size_t)) = partID_; + std::copy(((char*)buffer_.data())+sinoSize*(bufferSizeIndex*numberOfParts+partID_)*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex*numberOfParts+partID_))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)+sizeof(unsigned short)); + BOOST_LOG_TRIVIAL(debug) << "INDEX: " << (bufferSizeIndex*numberOfParts+partID_); client_.send(sendBuffer_.data(), sendBuffer_.size()); - ++index_; + partID_ = (partID_+1) % numberOfParts; + if(partID_ == 0) + ++index_; } auto DetectorModule::sendPeriodically(unsigned int timeIntervall) -> void { -- cgit v1.2.3 From cdab7a0b05f655a2f98f00f3fb8928e54b8c28d2 Mon Sep 17 00:00:00 2001 From: Tobias Frust Date: Wed, 12 Oct 2016 14:53:28 +0200 Subject: added configuration options --- src/DetectorModule/DetectorModule.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/DetectorModule/DetectorModule.cpp') diff --git a/src/DetectorModule/DetectorModule.cpp b/src/DetectorModule/DetectorModule.cpp index 798c529..8193a03 100644 --- a/src/DetectorModule/DetectorModule.cpp +++ b/src/DetectorModule/DetectorModule.cpp @@ -38,7 +38,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, throw std::runtime_error("DetectorModule: Configuration file could not be loaded successfully. Please check!"); } - sendBuffer_.resize(16010); + sendBuffer_.resize(numberOfProjectionsPerPacket_*numberOfDetectorsPerModule_+sizeof(std::size_t)+sizeof(unsigned short)); //read the input data from the file corresponding to the detectorModuleID readInput(); @@ -49,8 +49,7 @@ DetectorModule::DetectorModule(const int detectorID, const std::string& address, auto DetectorModule::send() -> void{ BOOST_LOG_TRIVIAL(debug) << "Detectormodule " << detectorID_ << " :sending udp packet with index " << index_ << "."; - int numberOfProjectionsPerPacket = 500; - int numberOfParts = numberOfProjections_/numberOfProjectionsPerPacket; + int numberOfParts = numberOfProjections_/numberOfProjectionsPerPacket_; // sendBuffer_[0] = (sizeof(std::size_t)) & 0xff; // sendBuffer_[1] = (sizeof(std::size_t) >> 8) & 0xff; // sendBuffer_[2] = (sizeof(std::size_t) >> 16) & 0xff; @@ -60,7 +59,7 @@ auto DetectorModule::send() -> void{ // sendBuffer_[6] = (sizeof(std::size_t) >> 48) & 0xff; // sendBuffer_[7] = (sizeof(std::size_t) >> 56) & 0xff; unsigned int bufferSizeIndex = index_ % 1000; - unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjectionsPerPacket; + unsigned int sinoSize = numberOfDetectorsPerModule_*numberOfProjectionsPerPacket_; *reinterpret_cast(sendBuffer_.data()) = index_; *reinterpret_cast(sendBuffer_.data()+sizeof(std::size_t)) = partID_; std::copy(((char*)buffer_.data())+sinoSize*(bufferSizeIndex*numberOfParts+partID_)*sizeof(unsigned short), ((char*)buffer_.data())+(sinoSize*(1+bufferSizeIndex*numberOfParts+partID_))*sizeof(unsigned short), sendBuffer_.begin()+sizeof(std::size_t)+sizeof(unsigned short)); @@ -108,7 +107,9 @@ auto DetectorModule::readConfig(const std::string& configFile) -> bool { && configReader.lookupValue("numberOfPlanes", numberOfPlanes_) && configReader.lookupValue("samplingRate", samplingRate) && configReader.lookupValue("scanRate", scanRate) - && configReader.lookupValue("numberOfDataFrames", numberOfFrames_)) { + && configReader.lookupValue("numberOfDataFrames", numberOfFrames_) + && configReader.lookupValue("numberOfProjectionsPerPacket", numberOfProjectionsPerPacket_) + && configReader.lookupValue("numberOfDetectorsPerModule", numberOfProjectionsPerPacket_)) { numberOfProjections_ = samplingRate * 1000000 / scanRate; return EXIT_SUCCESS; } -- cgit v1.2.3