next up previous
Next: Edit and run Up: Basic Steps Previous: Where to store

Run sample MPI programs

Directory /fs/meiko-user/tyang/cs110b97/mpi/example contains a set of MPI programs. Files under that sample directory are:

Makefile  --  Makefile for sample C programs. You can modify for your code.
greetings.c   -- C hello program. It demonstrates how SPMD and simple communication work.
cpi.c   -- Compute pi=3.1415... with numerical integration.
cpilog.c   -- C program for computing pi. It also asks for the input of interval information.
pi3.f   -- Fortran program for computing pi.
To run the sample program, you can first copy those samples under your own home directory. To compile the greeting code, you type ``make greetings''. Then you move the binary greetings to .

Then type ``rinfo'' to get the current status of the machine. For example, rinfo may return the following information in the screen:

PARTITION     NPROC     PROCS    STATUS        TIME
       p32        32      0-31      down            
       p16        16     32-47        up     7:47:41
     login         1       124      down            
       p2a         2     48-49        up     7:47:48
       p2b         2     50-51        up     7:47:50
        p4         4     52-55        up     6:41:43
 
  RESOURCE     NPROC    STATUS      USER        GPID        TIME       LIMIT
    p2a.13         2      free                           6:26:38            
    p2b.28         2      free                           5:36:25            
    p4.142         4    in-use     tyang    124.3534        0:02        none
 
      USER     NPROC    STATUS PARTITION        GPID        TIME     COMMAND
     tyang         4   running        p4    124.3534        0:02  matrix_para

The above screen information indicates that partition p32 is down, p16 is working and is free, and partition p4 is working but is occupied by user tyang. Then you can use partition p16 to run this program. Partition p16 contains 16 nodes. We can select 4 nodes.

cd ~/Mtmp
prun -pp16 -n4 greetings



Tao Yang
Mon Mar 24 17:36:21 PST 1997