Access to PVM & MPI from SUN Lab.


 
Parallel Virtual Machine - PVM
Message Passing Interface - MPI
DOWNLOAD
  www.netlib.org/pvm3/index.html    www.mpi.nd.edu/lam/download/ 
GENERAL

PVM comes with 2 main parts:
  • PVM daemon process: pvmd3 running in
    background, which control the operation of
    user processes within a PVM application
    and communicate with others hosts in network. 
  • Libraries: libpvm3.a, libfpvm3.a, libgpvm3.a
    libpvm3.a:   Library of C language interface routines. 

  • libfpvm3.a:  Library for Fortran language. 
    libgpvm3.a: Library for dynamic groups management

MPI comes with 3 main parts:
  • MPI daemon 
  • MPI libraries for C/C++ and Fortran

  • libmpi.a : Require for every program in C/ Fortran
    libargs.a, libt.a, libtrillium.a, libtstdio.a for additional options.
  • MPI compilers for C/C++ and Fortran

  • hcc: compiler for C program
    hcp: compiler for C++
    hf77: compiler for Fortran 
ACCESS TO PVM & MPI FROM SUN LAB.
  • Create the host file "rhosts" for PVM daemon.
    "rhosts" should be placed in your home directory.
    "rhosts" contains name of hosts that the master
    daemon will start when boot up.
    Example of "rhosts" file 

  • #### This is rhosts file, each host on 1 line
    lapis.rocks.uhcl.edu
    jasper
    catseye.rocks
    aragonite

    Download sample of rhosts file here.

  • Add the follwing paths to your existing .cshrc file
    SET PATH=  ... (add your path here)
     /faculty/shihproj/pvm3/ /faculty/shihproj/pvm3/bin 
    /faculty/shihproj/pvm3/lib
    /faculty/shihproj/bin/SUN4SOL2      
  • Add the following lines to the end of your existing
    .cshrc file and execute it as "exec .cshrc":

  • ###############################
    # SETTING FOR PVM AND XPVM 
    #
    setenv PVM_ROOT /faculty/shihproj/pvm3 
    setenv PVM_ARCH SUN4SOL2 
    setenv PVM_DPATH $PVM_ROOT/lib/pvmd
    setenv CC gcc

    Download sample of .cshrc here.

  • Create the host file "my_host_file" for MPI daemon. "my_host_file" should be placed in your home directory.
    "my_host_file" contains name of hosts that the master
    daemon will start when boot up.
    Example: 

  • #### This is the contain of my_host_file file
    lapis.rocks.uhcl.edu
    jasper
    catseye.rocks
    localhost

         Download sample of myhost_file file here.

  • Add the follwing paths to your existing .cshrc file
    SET PATH= ...(add path here) /faculty/shihproj/lam61/bin faculty/shihproj/lam61/boot
  • Add the following lines to the end of your existing .cshrc file and execute it as "exec .cshrc":

  • ###############################
    # SETTING FOR MPI 
    #
    setenv LAMHOME /faculty/shihproj/lam61

    Download sample of .cshrc here.

STARTING
Start PVM:  run command
"pvm rhosts" or "pvmd rhosts"
(users can specify a difference file name for rhosts and run "pvm myfile")
When command prompt pvm> displayed, user can add/delete hosts, view tasks, run program ...
Type help for list of command.
Type quit to go back to unix shell prompt (PVM still running)
Type halt to exit PVM.

Start MPI:  (LAM version 6.X) run command
"lamboot -v my_host_file"

When MPI is done, it displays a message "Topology done" and you can run your program.

COMPILING AND RUNNING
PVM provides a script file called aimk to compile a master and slave program in C or Fortran, but aimk is not a convenience tool to use. We can use standard compiler in UNIX to do that.

For C program:

prompt%>  gcc -o myprog myprog.c -I$PVM_ROOT/include 
            -L$PVM_ROOT/lib/$PVM_ARCH -lpvm3 -lsocket -lnsl

For C++:

prompt%> c++ -o myprog myprog.c -I$PVM_ROOT/include 
            -L$PVM_ROOT/lib/$PVM_ARCH -lpvm3 -lsocket -lnsl

To use with Dynamic Groups, also need libgpvm3.a added before libpvm3.a: 

% gcc (or c++) -o myprog myprog.c -I$PVM_ROOT/include 
            -L$PVM_ROOT/lib/$PVM_ARCH -lgpvm3 -lpvm3 -lsocket -lnsl

Note:
User program must include <pvm3.h> at beginning

After compiling program, we can run it by typing program name at shell prompt or by spawn command from pvm prompt pvm>

 

For C program:

prompt%> hcc -o myfile myfile.c -lmpi

For C++:

prompt%> hcp -o myfile myfile.C -lmpi

For Fortran:

prompt%> hf77 -o myfile myfile.f -lmpi
 

To run program: use mpirun
 

prompt%> mpirun -c 4 my_program
 

Note:
User program must include <mpi.h>

PVM & MPI LINKS
PVM Tutorial
PVM User Reference (PostScript)
MPI User Reference (PostScript)