Previous - Up - Next

11.4   Example of Distributed Simulation and Network

This section is an extension of the First Steps guide in Chapter 4.

Simics allows you to distribute a simulation on several computers. The typical setup is to simulate one or more machines on each node. Simics will synchronize the nodes so that they will have the same simulated time elapsed, and also provides a way to share Ethernet links.

In this guide we will start two Simicses on the same computer and connect them together.

Create two terminals, and launch the ebony-linux-firststeps.simics in both shells. To be able distinguish the machines, we change the Simics prompt.

joe@computer: ebony$ ./simics ebony-linux-firststeps.simics
[...]
simics>  @SIM_set_prompt("simics1>  ")
simics1> 

Likewise, in the second terminal:

joe@computer: ebony$ ./simics ebony-linux-firststeps.simics
[...]
simics>  @SIM_set_prompt("simics2>  ")
simics2> 

Select the first simulation again, and enter the following commands in the Simics console:

simics1>  new-central-server
[central_server info] Listening to port 1909
[central_server info] Listening to unix socket [...]
Created central_server
simics1> 

This will create the central_server object, which acts as the hub in our distributed simulation. All simulations will connect to the central server. The next step is to actually connect the first simulation to the server:

simics1>  connect-central obj = central_server
Created central_client
[central_server info] New connection with id 0
Connected to Simics Central
simics1> 

connect-central will create a central-client object named central_client and connect it to our central_server object. Note the usage of the obj argument. Normally, we would supply the host name of the computer running the central server. However, since the client and server are running in the same Simics process, we connect directly to the central_server object.


Note: You can at any time run central_server.info or central_client.info to view the current status.

Now we are going to connect the other simulation to the central as well.

simics2>  connect-central localhost
Created central_client
[central_client info] Connected to server
Connected to Simics Central
simics2>  central_client.info
Information about central_client [class central-client]
=======================================================
                Identification : computer (process 2013)
                        Server : /tmp/simics-central.joe
simics2> 

Since the central-server is running in another Simics process, on the same computer, we supply localhost as the host name.

Now both simulations are synchronized. However, the simulated machines are not able to talk to each other yet.

Both machines need a simulated Ethernet link. Create a ethernet-link to which we connect the simulated network card.

simics2>  new-ethernet-link
Created ethernet-link ethlink0
simics2>  emac0.connect ethlink0
simics2>  ethlink0.info
Information about ethlink0 [class ethernet-link]
================================================
[...]
                  Distribution : local
[...]
simics2> 

The first command will create the ethlink0 object, and the second command connects it to the simulated network card. The <ethernet-link>.info shows two important things: the link is connected to the simulated network card, but not shared via the central yet. We will do that now:

simics2>  ethlink0->central = central_client
[ethlink0 info] Adjusting latency to 0.01 s [...]
simics2>  ethlink0.info
[...]
                  Distribution : global
[...]
simics2> 

Distribution has now changed from local to global.

Finally, we must also connect the first simulation to the simulated network. Switch to the first Simics instance and enter the following commands:

simics1>  new-ethernet-link
Created ethernet-link ethlink0
simics1>  emac0.connect ethlink0
simics1>  ethlink0->central = central_client
[ethlink0 info] Adjusting latency to 0.01 s [...]
simics1>  ethlink0.info
[...]
                 Local devices : <0:0> emac0
                Remote devices : <1:0> emac0
[...]
simics1> 

Here we see that the network card on the other simulated machine is added to the device list. Hopefully, the two machines are now able to talk to each other. Before we try anything, there is one more thing we must do. Since the two simulated machines are identical, they are assigned the same IP address. Thus, we must change the IP address on one of them.

Boot both machines by giving the continue command.


Note: You must resume both simulations. If you resume only one simulation it will appear to hang. This is because the simulations are synchronized through the central server.

Then, in one of the consoles, enter the following command:

root@firststeps: ~# ifconfig eth0 10.10.0.51
root@firststeps: ~#

This will change the IP on that machine to 10.10.0.51. The other machine should have the IP address 10.10.0.50. Try pinging (from 10.10.0.51):

root@firststeps: ~# ping -c 2 10.10.0.50
PING 10.10.0.50 (10.10.0.50): 56 data bytes
64 bytes from 10.10.0.50: icmp_seq=0 ttl=64 time=10.0 ms
64 bytes from 10.10.0.50: icmp_seq=1 ttl=64 time=10.0 ms

--- 10.10.0.50 ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 10.0/10.0/10.0 ms
root@firststeps: ~#

You can read more about distributed simulation in chapter 11.

Previous - Up - Next