We are now ready to simulate the execution of an MPI program using SMPI. Let us use the following simple
MPI program,
roundtrip.c
, in which the processes pass around a message and
print the elpased time:
roundtrip.c
...
Say we want to simulate the execution of this program on a homogeneous cluster, such as the one we saw in the "XML Platforms" tab: cluster_crossbar.xml. We need an "MPI host file", that is a simple text file that lists all hosts on which we wish to start an MPI process: cluster_hostfile.txt.
Compiling the program is straightforward:
Running (simulating) it using 16 hosts on the cluster is done as follows:
-np 16
option, just like in regular MPI, specifies the number of MPI processes to use. -hostfile ./cluster_hostfile.txt
option, just like in regular MPI, specifies the host file. -platform ./cluster_crossbar.xml
option, which doesn't exist in regular MPI, specifies the platform configuration to be simulated. You will see some warnings/information regarding setting some SMPI configuration parameters. Ignore them for now. One of them will say something about not setting the power of the host running the simulation. This is fine here because in this small example we wish only to simulate the network.
Feel free to tweak the content of the XML platform file and the program to see the effect on the simulated execution time. Note that the simulation accounts for realistic network protocol effects and MPI implementation effects. As a result, you may see "unexpected behavior" like in the real world (e.g., sending a message 1 byte larger may lead to significant higher execution time).