Getting Started with PVM

These laboratory instructions are intended for use with Computer Science 40, Parallel Computation, Spring Semester, 1999, 10:30 - 11:50 TTh, Dennis Hall 214, Ray Ontko and Joy Williams Lind, Department of Computer Science, Earlham College.

This laboratory exercise will assist you in configuring a login account on noether so that you can run your own PVM programs using your own pvm console, and help you run your first program using that set-up. Please follow carefully each step listed below.

  1. Log into your new account on noether.

    I have created the following accounts: aburuos bartlbe cam jeremiah jimg jimr joyw lofchco marouf millerbe rayo sackeri sandeaf will

    The password for your account is initially set to your last name (lower case) followed by "01".

  2. Use the passwd command to change your password to something else that you will be able to remember. You will be prompted for a new password, and then asked to confirm it.
    $ passwd
    Changing password for rayo
    Old password:
    Enter the new password (minimum of 5, maximum of 8 characters)
    Please use a combination of upper and lower case letters and numbers.
    New password:
    Re-enter new password:
    Password changed.
    

  3. Use ls -al to list all the files in your login directory. You should see something like this.
    ls -al
    total 12
    drwxr-sr-x   3 rayo     rayo         1024 Feb  9 17:30 .
    drwxrwsr-x  17 root     staff        1024 Feb 10 06:52 ..
    -rw-r--r--   1 rayo     rayo          266 Feb  9 15:33 .alias
    -rw-------   1 rayo     rayo         3575 Feb 10 21:52 .bash_history
    -rw-r--r--   1 rayo     rayo          129 Feb  9 17:25 .bash_profile
    -rw-r--r--   1 rayo     rayo           55 Feb  9 15:33 .bashrc
    -rw-r--r--   1 rayo     rayo          375 Feb  9 15:33 .cshrc  
    

  4. Use vi (or another editor) to edit .bash_profile to configure your account to define PVM_ROOT and PVM_ARCH on this machine each time you login. For example, mine looks like this:
    $ more .bash_profile
    # ~/.bash_profile: executed by bash(1) for login shells.
    umask 002
    set -o vi
    export PVM_ROOT=/usr/lib/pvm3
    export PVM_ARCH=LINUX
    

  5. Use vi (or another editor) to create .rhosts, a file listing all the machine-name/user-name pairs that will participate in your PVM cluster. For now, it would be noether and your own user name. For example, mine looks like this:
    $ more .rhosts
    noether rayo
    

  6. Use mkdir pvm3 to create a directory for your work. PVM requires that the directory be there, and that it have this exact name. You should also make that directory your current directory using cd pvm3.
    $ mkdir pvm3
    $ cd pvm3
    

  7. Use tar to create your own copy of the example programs to play with. For example:
    $ pwd
    /home/rayo/pvm3
    $ tar -xzf /usr/doc/pvm/examples.tar.gz
    $ ls examples
    LINUX           gexample.c      inherit2.c      mhf_server.c    starter.c
    Makefile.aimk   gexample.f      inherit3.c      mhf_tickle.c    task0.c
    Makefile.mak    gmbi.c          inherita.c      ptest.c         task1.c
    OS2             hello.c         inheritb.c      rme.c           task_end.c
    PGON            hello_other.c   lmbi.c          slave1.c        taskf.c
    Readme          hitc.f          master1.c       slave1.f        timing.c
    SP2MPI          hitc_slave.f    master1.f       spmd.c          timing_slave.c
    bwtest.c        inherit1.c      mbox.c          spmd.f
    

  8. Change to the examples directory, compile hello and hello_other using aimk (architecture independent make), and test them using the pvm console. For example:
    $ cd examples
    $ pwd
    /home/rayo/pvm3/examples
    $ aimk hello hello_other
    making in LINUX/ for LINUX
    cc -DSYSVSIGNAL -DNOWAIT3 -DRSHCOMMAND=\"/usr/bin/rsh\" -DNEEDENDIAN -DFDSETNOTS
    TRUCT -DHASERRORVARS -g -I../../include -o hello ../../examples/hello.c  -L../..
    /lib/LINUX -lpvm3
    mv hello ../../bin/LINUX
    cc -DSYSVSIGNAL -DNOWAIT3 -DRSHCOMMAND=\"/usr/bin/rsh\" -DNEEDENDIAN -DFDSETNOTS
    TRUCT -DHASERRORVARS -g -I../../include -o hello_other ../../examples/hello_othe
    r.c  -L../../lib/LINUX -lpvm3
    mv hello_other ../../bin/LINUX
    $ pvm
    pvm> spawn -> hello
    [4]
    1 successful
    t40002
    pvm> [4:t40002] i'm t40002
    [4:t40002] from t40003: hello, world from noether
    [4:t40002] EOF
    [4:t40003] EOF
    [4] finished
    
    pvm> halt
    Terminated
    

  9. Within the pvm3 directory, use mkdir work to create another directory in which to do your work. It doesn't matter what you call the directory; I called mine work. This is where you'll be creating and compiling your programs. You should also make that directory your current directory using cd work.
    $ cd ..
    $ pwd
    /home/rayo/pvm3
    $ mkdir work
    $ cd work
    

  10. Within your pvm3/work directory, copy Makefile.aimk, hello.c, and hello_other.c from the examples directory into your work directory. For example:
    $ pwd
    /home/rayo/pvm3/work
    $ cp ../examples/Makefile.aimk .
    $ cp ../examples/hello.c .
    $ cp ../examples/hello_other.c .
    

  11. Rename the hello.c and hello_other.c programs. We'll use this to test your configuration. For example, I added my initials to the front of the two programs:
    $ mv hello.c rfo_hello.c
    $ mv hello_other.c rfo_hello_other.c
    

  12. Edit your renamed hello.c so that it invokes your renamed hello_other.c. Just edit the call to pvm_spawn so that it references the new filename. In my case, the line now looks like:
            cc = pvm_spawn("rfo_hello_other", (char**)0, 0, "", 1, &tid);
    

    I also modified the error message line a little:

                    printf("can't start rfo_hello_other\n");
    

    You may also want to modify your renamed hello_other.c to change the message it sends:

     strcpy(buf, "rfo_hello, world from ");
    

  13. Now, edit your Makefile.aimk. First, change the SDIR definition to point to your work directory. Second, change all mentions of hello and hello_other to mention your modified program names. For example, by comparing my new Makefile.aimk with the one from the examples directory, I get:
    $ diff Makefile.aimk ../examples/Makefile.aimk | more
    23c23
    < SDIR          =       $(PVMDIR)/work
    ---
    > SDIR          =       $(PVMDIR)/examples
    68c68
    < CPROGS                =       rfo_hello$(EXESFX) rfo_hello_other$(EXESFX) \
    ---
    > CPROGS                =       hello$(EXESFX) hello_other$(EXESFX) \
    77c77
    < HOSTCPROGS    =       rfo_helloh gexampleh master1h timingh gmbih
    ---
    > HOSTCPROGS    =       helloh gexampleh master1h timingh gmbih
    91c91
    < default:      rfo_hello$(EXESFX) rfo_hello_other$(EXESFX)
    ---
    > default:      hello$(EXESFX) hello_other$(EXESFX)
    108,109c108,109
    < rfo_hello$(EXESFX):  $(SDIR)/rfo_hello.c $(XDIR)
    <       $(CC) $(CFLAGS) -o $@ $(SDIR)/rfo_hello.c $(LFLAGS) $(LIBS)
    ---
    > hello$(EXESFX):  $(SDIR)/hello.c $(XDIR)
    >       $(CC) $(CFLAGS) -o $@ $(SDIR)/hello.c $(LFLAGS) $(LIBS)
    112,113c112,113
    < helloh:  $(SDIR)/rfo_hello.c $(XDIR)
    <       $(CC) $(CFLAGS) -o $@ $(SDIR)/rfo_hello.c $(LFLAGS) $(HLIBS)
    ---
    > helloh:  $(SDIR)/hello.c $(XDIR)
    >       $(CC) $(CFLAGS) -o $@ $(SDIR)/hello.c $(LFLAGS) $(HLIBS)
    116,117c116,117
    < rfo_hello_other$(EXESFX):  $(SDIR)/rfo_hello_other.c $(XDIR)
    <       $(CC) $(CFLAGS) -o $@ $(SDIR)/rfo_hello_other.c $(LFLAGS) $(LIBS)
    ---
    > hello_other$(EXESFX):  $(SDIR)/hello_other.c $(XDIR)
    >       $(CC) $(CFLAGS) -o $@ $(SDIR)/hello_other.c $(LFLAGS) $(LIBS)
    

  14. Build your new programs using aimk.
    $ pwd
    /home/rayo/pvm3/work
    $ ls
    Makefile.aimk      rfo_hello.c        rfo_hello_other.c
    $ aimk rfo_hello rfo_hello_other
    making in LINUX/ for LINUX
    cc -DSYSVSIGNAL -DNOWAIT3 -DRSHCOMMAND=\"/usr/bin/rsh\" -DNEEDENDIAN -DFDSETNOTS
    TRUCT -DHASERRORVARS -g -I../../include -o rfo_hello ../../work/rfo_hello.c  -L.
    ./../lib/LINUX -lpvm3
    mv rfo_hello ../../bin/LINUX
    cc -DSYSVSIGNAL -DNOWAIT3 -DRSHCOMMAND=\"/usr/bin/rsh\" -DNEEDENDIAN -DFDSETNOTS
    TRUCT -DHASERRORVARS -g -I../../include -o rfo_hello_other ../../work/rfo_hello_
    other.c  -L../../lib/LINUX -lpvm3
    mv rfo_hello_other ../../bin/LINUX
    

  15. Finally, test your newly compiled programs using the pvm console and its spawn command.
    $ pvm
    pvm> spawn -> rfo_hello
    [4]
    1 successful
    t40002
    pvm> [4:t40002] i'm t40002
    [4:t40002] from t40003: rfo_hello, world from noether
    [4:t40002] EOF
    [4:t40003] EOF
    [4] finished
    
    pvm> halt
    Terminated
    

Congratulations! You've run your first PVM program.

Copyright © 1999, Ray Ontko (rayo@ontko.com).
If you're curious about why I copyright, see Peter Suber's Why Copyright Web Documents?.