-
Notifications
You must be signed in to change notification settings - Fork 29
Network Streamers in MOOSE
Table Streamer MOOSE already has file based streamer; it writes to a CSV file to local disk and cleans up the internal std::vector
in moose.Table
/moose.Table2
. One does not run out of RAM on long simulation. See ExampleExample2Implementation.
In addition to above CSV streamer, a network streamer has been added to MOOSE PR1[PR2]. This streamer streams data over either UNIX DOMAIN SOCKET
or TCP SOCKET
depending on the address given by the user. The streamer can be set by user manually or by setting the environment variable MOOSE_SOCKET_ADDRESS
. If the variable has the form http://address:port
then a TCP socket is created at this port (note address
is irrelevant, it is always 127.0.0.1
or localhost
), and a UNIX domain socket is created if the address has the form file:///tmp/MOOSE_SOCKET
. The UNIX domain socket are preferred since they are faster than TCP sockets and easy to secure.
The main purpose of this streamer is to be used over network (see below). To make sure that streaming is efficient, table data is serialized using the following protocol before streaming.
Serialization Before streaming, data of each table is serialized. Note that data of table also contains time. For example, if a table moose.Table('/tab/a')
has value v0
and t0
and v1
at time t1
then the data is arranged as H #H / t a b / a V #V t0 v0 t1 v1
where H
means start of header, followed by size of header #H
(in this case 6), and V
means start of data, followed by number of entries to follow #V
(in this case 4). Each value is then transmitted as void*
(ie. 64 bits/8 bytes) which are decoded as client.
See the implementation here. The decoder in python is available here.