FairMQ/fairmq
Florian Uhlig 4ca66e33da Fix compiler warnings.
Switch of compiler warnings for part of the code.
The compiler flag -Weffc++ of the gcc compiler creates many warnings about non virtual destructor of base classes where the
base class is actually a class from boost or from stl. Switch of the compiler flag for the problematic parts of the code
using preprocessor statements. There are also such preprocessor guards for code which creates many warnings when
using clang.

Filter warnings comming from generated files.
When using CTest all warnings comming from generated code (Root Dictionaries, code generated by protoc) will be filtered
before sending the results to the CDash web server.

Remove unused variables or use them.
Initialize all data members in initializer lists.
Use in initializer list the same order of data members as defined in the class declaration.
Declare private copy constructors and assignment operators where needed.

Fix format problems in printf statements.
Correctly cast the variables.
2016-03-17 21:33:40 +01:00
..
devices Fix compiler warnings. 2016-03-14 13:37:55 +01:00
logger Fix compiler warnings. 2016-03-17 21:33:40 +01:00
nanomsg Fix compiler warnings. 2016-03-14 13:37:55 +01:00
options Fix compiler warnings. 2016-03-17 21:33:40 +01:00
run Fix compiler warnings. 2016-03-14 13:37:55 +01:00
test Fix compiler warnings. 2016-03-14 13:37:55 +01:00
tools Fix compiler warnings. 2016-03-17 21:33:40 +01:00
zeromq Fix compiler warnings. 2016-03-14 13:37:55 +01:00
.clang-format use clang-format for FairMQ 2014-06-06 14:30:41 +02:00
apply-clang-format.sh use clang-format for Tutorial3 2014-06-06 14:30:41 +02:00
CMakeLists.txt FairMQ: Extend Multipart and messaging API 2016-02-29 16:25:39 +01:00
FairMQChannel.cxx Fix compiler warnings. 2016-03-14 13:37:55 +01:00
FairMQChannel.h Fix return value of multipart send/receive methods 2016-03-03 15:35:39 +01:00
FairMQConfigurable.cxx FairMQ Examples cleanup 2015-10-05 18:06:55 +02:00
FairMQConfigurable.h FairMQ Examples cleanup 2015-10-05 18:06:55 +02:00
FairMQDevice.cxx Fix compiler warnings. 2016-03-14 13:37:55 +01:00
FairMQDevice.h Fix return value of multipart send/receive methods 2016-03-03 15:46:27 +01:00
FairMQLogger.cxx Fix compiler warnings. 2016-03-14 13:37:55 +01:00
FairMQLogger.h * split log console output sink into two sinks, one for cout and one for cerr. 2015-09-29 17:51:14 +02:00
FairMQMessage.cxx Add license file LICENSE with LPGL license text copied from https://www.gnu.org/licenses/lgpl.html. Add license text to most of files of the project. 2014-06-06 14:57:56 +02:00
FairMQMessage.h Add new Send/Receive methods with smart pointers and no flag checks. 2015-09-28 12:17:24 +02:00
FairMQParts.h Fix compiler warnings. 2016-03-17 21:33:40 +01:00
FairMQPoller.cxx Add license file LICENSE with LPGL license text copied from https://www.gnu.org/licenses/lgpl.html. Add license text to most of files of the project. 2014-06-06 14:57:56 +02:00
FairMQPoller.h Several FairMQ fixes and improvements: 2015-09-28 12:17:22 +02:00
FairMQSocket.cxx Add license file LICENSE with LPGL license text copied from https://www.gnu.org/licenses/lgpl.html. Add license text to most of files of the project. 2014-06-06 14:57:56 +02:00
FairMQSocket.h Add methods to set timeout on blocking Send/Receive 2015-10-19 09:52:53 +02:00
FairMQStateMachine.cxx Return if an unknown exception has been cought in Channel 2015-11-03 16:07:15 +01:00
FairMQStateMachine.h Fix compiler warnings. 2016-03-17 21:33:40 +01:00
FairMQTransportFactory.cxx Add license file LICENSE with LPGL license text copied from https://www.gnu.org/licenses/lgpl.html. Add license text to most of files of the project. 2014-06-06 14:57:56 +02:00
FairMQTransportFactory.h Include device ID in the zeromq socket identity. 2016-03-03 13:10:56 +01:00
README.md FairMQ Examples cleanup 2015-10-05 18:06:55 +02:00

FairMQ

The standard FairRoot is running all the different analysis tasks within one process. The FairMQ (Message Queue) allows starting tasks on different processes and provides the communication layer between these processes.

Devices

The components encapsulating the tasks are called devices and derive from the common base class FairMQDevice. FairMQ provides ready to use devices to organize the dataflow between the components (without touching the contents of a message), providing functionality like merging and splitting of the data stream (see subdirectory devices).

Topology

Devices are arranged into topologies where each device has a defined number of data inputs and outputs.

Example of a simple FairMQ topology:

example of FairMQ topology

Topology configuration is currently happening via setup scripts. This is very rudimentary and a much more flexible system is now in development. For now, example setup scripts can be found in directory FairRoot/example/Tutorial3/ along with some additional documentation.

Communication Patterns

FairMQ devices communicate via the communication patterns offered by ZeroMQ (or nanomsg): PUSH-PULL, PUB-SUB, REQ-REP, PAIR, more info here.

Messages

Devices transport data between each other in form of FairMQMessages. These can be filled with arbitrary content and transport either raw data or serialized data as described above. Message can be initialized in three different ways:

  • with no parameters: This is usefull for receiving a message, since neither size nor contents are yet known.
  • given message size: Initialize message body with a size and fill the contents later, either with memcpy or by writing directly into message memory.
  • given message size and buffer: initialize the message given an existing buffer. This is a zero-copy operation.

After sending the message, the queueing system takes over control over the message body and will free it with free() after it is no longer used. A callback can be given to the message object, to be called instead of the destruction with free().

Transport Interface

The communication layer is available through an interface. Two interface implementations are currently available. Main implementation uses the ZeroMQ library. Alternative implementation relies on the nanomsg library. Here is an overview to give an idea how interface is implemented:

FairMQ transport interface

Examples

A collection of simple examples in examples directory demonstrates some common usage patterns of FairMQ.

A number of devices to handle the data from the Tutorial3 FairTestDetector of FairRoot are provided as an example and can be found in FairRoot/base/MQ directory. The implementation of the tasks run by these devices can be found FairRoot/example/Tutorial3. The implementation includes sending raw binary data as well as serializing the data with either Boost Serialization, Google Protocol Buffers or Root TMessage. Following the examples you can implement your own devices to transport arbitrary data.