Hands On session on Param 10000
Objective: To Learn How to Execute a Parallel Program using MPI on Param 10000.ppp
Connect to param :
telnet param (OR) telnet 192.168.50.1
Logon to param using your assigned username and password.
Find the directory
examples
in your home directory. It
has sample C programs that use MPI in the sub-directory called
C-LANG
.
The directory C-LANG
contains several files that
will be used in this session.
File name | Brief explanation |
Mpi_Hello_World.c |
This file contains a program that is executed by each process created in this session. All processes other than process 0 send a message to process 0. Process 0 receives these messages and prints the messages and the number of the originating process. |
Makefile |
This is a file that is used by the Unix
utility make . Using make automates the
process of compiling and linking programs.
(Click here for some detailed
documentation on the make utility.) |
run.pg |
This is a file that specifies how many copies of the process called run should be started. The file also specifies the processor on which each process should start. |
Compile the program
Mpi_Hello_World.c
using the command
make
The Makefile
in your directory specifies the compiler
name, and the appropriate directives to create an executable called
run
. Verify that the executable run
has been
created in your directory by the above make
command.
Running an MPI program.
There are two ways to run the executable run
.
Run the program with the command:
mpirun -np 4 run
The command mpirun
runs the executable given on the
command line---in this case the name of the executable is
run
. The option -np 4
specifies that four
copies of this program should be started. mpirun
distributes the processes equally among the available processors. In
the case of Param10000 there are four nodes, each node having two
processors. mpirun
will distribute the processes so that
each node gets one process.
Run the program with the command:
./run
(Note: Before you run the program as above, edit the file
run.pg
and change each occurrence of
handson1
to your username.)
In this case, the file run.pg
is used. (If the name of
the executable were Hello
, then the file
Hello.pg
is used.) The file run.pg
specifies
one process per line of the file. The first field on each line is the
name of the node on which to execute that process. The second field is
the rank---either 0 or 1. For now, the first line should have a rank
0, and all the other lines in the file should have rank 1. The third
field on each line specifies the complete path to the executable that
is to be run as the process. (In our case all the lines have the same
executable; in general, though, each line could specify a different
executable.) To add to the number of processes, simply add suitable
lines to the run.pg
file.
In either case, if a total of n processes were started, the output of the program should contain (n-1) lines of output, one from each process whose number is not 0.