-
Notifications
You must be signed in to change notification settings - Fork 34
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.
- Data is arranged in table path followed by data (
vector<double>
). Not that data of table also contains time value as well. For example, if a tablemoose.Table('/tab/a')
has valuev0
andt0
andv1
at timet1
then the data is arranged asH #H / t a b / a V #V t0 v0 t1 v1
whereH
means start of header, followed by size of header#H
(in this case 6), andV
means start of data, followed by number of entries to follow#V
(in this case 4). See the implementation here. The decoder in python is available here.