Debugging MPI programs locally

The instructions given here will let you test MPI programs locally on CS department machines, so that you won't have to wait 20 minutes for your jobs to get executed on bassi. Note that you should still test your programs on bassi, and all the performance measurements should come from bassi.

Running MPI programs on CS linux machines

There is a compiler called mpicc instead of mpcc on the linux machines, which compiles MPI programs. The compiled program can run on single processor, multiple cores, or on more processors accorss machines.

Compile
Same as using mpcc, just different compiler.
e.g. mpicc program.c -o program

Running on a machine
Running MPI programs on CS deparment machines requires you to use mpirun.
Pass the path to the executable as an argument, followed by arguments for that program.
e.g. mpirun program N M
(run program with arugments N and M)

Running with multiple cores
You can given an option to mpirun to specify the number of processes to run.
All options for mpirun has to come before the program to run and its arguments.
e.g. mpirun -np 2 program N M
(run program with arguments N and M using 2 processes)

You should never specify more number of processes to run than available processors.

Running across machines
If you really want to test your program with more than 2 or 4 cores, you can run across machines.
-host option for mpirun takes a list of nodes to run the program on.
e.g. mpirun -np 4 -host dmx,eminem,ludicris,dr-dre program N M
(Run program on the four machines listed with arguments N and M)

The list hast to be either all 32-bit or all 64-bit machines, and you should ssh into each one of them before running mpirun, so that you don't get the RSA key message.
The list of CS department machines can be found here.