IMD

IMD Home

User Guide

Online Visualization

IMD can communicate with external programs via a bi-directional socket connection. This mechanism allows for online visualization and steering of the simulation. Socket communication must be enabled with the compilation option sock. If enabled, IMD polls the socket connection for new requests every socket_int time steps. If socket_int > 0, the socket connection is created at the simulation start. The simulation will not proceed before the connection is established. If socket_int = 0, no socket connection is created. In either case, it is not possible to connect or reconnect at a later stage of the simulation.

If the parameter loop is set to 1, the entire simulation is repeated again and again. This allows to restart the simulation, by jumping to the simulation end, and then repeating it.

Socket communication

In the socket communication, IMD can play either the server part or the client part. This is chosen by the parameter socket_mode, whose value is either server or client. Depending on this mode, different other parameters have to be specified. Once the connection is established, the communication does not depend on the socket mode.

Server mode

In server mode, IMD opens a server socket on the local port server_port, and waits for the client to connect. The first connection attempt is accepted. Under MPI, the server_port is on the machine with the rank 0 process. In server mode, the visualization must be able to contact the machine IMD runs on. In a cluster environment, where the cluster nodes often have private IP addresses, this may not be possible. In this case, IMD should rather run in client mode.

Client mode

In client mode, IMD tries to connect to a server socket at port server_port on the machine specified by the parameter display_host. This is the machine the visualization runs on. By default, the connect call choses some local port on the simulation machine at which IMD can be contacted. In the presence of a firewall, it may be necessary to specify which local port shall be used. This can be done with the parameter client_port. If client_port = 0 (default), the system choses a port itself. If both IMD and visualization run on the same machine, the two ports server_port and client_port must be different, but in that case there is no point prescribing a client_port. If IMD and visualization run on different machines, the two ports may be equal. Client mode should work also if the simulation machine has a private IP address, as connections from a private to a public IP address should be handled by Network Address Translation (NAT) at the gateway.

Supported online visualization programs

The currently supported online visualization program is the COVER renderer from COVISE, which has been equipped with a plugin (written by Jürgen Schulze-Döbold) implementing the communication protocol with IMD.