Notes on Using Valkyrie

Computing environment

The hardware platform for the course is a Beowulf cluster named Valkyrie. Valkyrie is managed by the ACS and runs the Rocks software developed at the San Diego Supercomputer Center. Rocks consists of 16 dual 1 GHz Pentium III CPUs, each with 1GB of RAM and running Linux. A Myrinet switch provides low latency connectivity between the nodes.

Valkyrie should only be used for parallel program development and measurement. If you need to use a Linux or UNIX system, please use your student account on the Solaris machines in the Advanced Programming Environment (APE) lab, located in APM 6426.

ACS has set up a web page providing documentation on  how to use Valkyrie: http://www-acs.ucsd.edu/offerings/userhelp/HTML/rocks,d.html

Here are additional instructions about software we've added to simplify the use of the machine.


"Issues"

  • Currently only 14 of 16 nodes are active
  • You are able to effectively use only 1 cpu per node under MPI
  • Batch submission using OpenPBS is a work in progress.
  • Runaway processes.


  • Logging into Valkyrie for the first time

    The first time you login to Valkyrie you will be asked for some input related to ssh authentication. I suggest that you hit return in response to all 3 questions. (One consequence is that you'll have an empty pass phrase)

    On Valkyrie you may run with the bash shell or the csh shell, etc. You may change which shell you use with the chsh command. To get the correct compilers, you will need to set your path as follows. Add the following to your .bash_profile file which you should find in your home directory:

    export PATH=/usr/mpich/c/bin:$PATH
    With cshell add the following to you .cshrc:

    setenv PATH /usr/mpich/c/bin:$PATH


    Getting started

    We've set up some code to get your started in the directory ~cs260f/../public/examples These will help acquaint you with process of running an MPI program. Compile and run; the two programs in the subdirectory called Basic. Be sure to use the Makefile that we've supplied so you'll get the correct compiler and loader flags. The Makefile includes an "arch" file that defines appropriate command line flags for the compiler. You currently have arch.valkyrie which provides  the  appropriate settings needed for Valkyrie. If you want to run on other machines like NPACI Blue Horizon, let us know and we can give you files appropriate for that machine.

    The first program is a parallel "hello world" program. This program prints "Hello World'' from each processor, along with the process ID. It also reports the total number of processors in the run, The hello world program is found in ~/public/examples/Basic/hello.    Run it as follows:

    mpi-launch -m compute-0-0,compute-0-1 /home/cs260f/public/examples/Basic/hello
    

    Here is some sample output:

    # processes: 2
    Hello world from node 0
    Hello world from node 1
    
    Do the node ID's come in any particular order? Why is this?

    In the second program each processor sends two integers to node 0, which prints out the values. A common convention is to call node 0 the manager or boss. Run program 2 several times on 4 processors. Do the node ID's come in any particular order? Why is this the case? Modify the program so that the nodes report to the manager in increasing order of node rank. Note the use of the MPI_Barrier() call, which provides barrier synchronization.  Remove this call and note the effect.

    Ring

    The next program is called Ring and it can be used to measure communication performance. The program we've supplied you, Ring.C, is found in the Ring/ subdirectory of ~/../public/examples. This program treats the processors as if connected in a ring. Node 0 sends a message to successor node 1, and so on until node P-1, which then sends the message back to node 0, which is P-1's successor in in mod P arithmetic. The cycle then repeats. Messages of various sizes are passed around the ring, starting with 2 byte long messages and progressing in powers of two up to a user-specified limit.

    Ring extracts up to 2 arguments from the command line:

  • -s s NNN where NNN is the maximum size message to be passed around the ring (in kilobytes), and
  • -t TTT is the "trips" parameter giving the number of times the message will be passed around the ring. If you want to specify this parameter, you must also specify the first one.
  • By default NNN=1024,TTT=5. Under default settings Ring passes messages of 2, 4, 8, ..., 1K, ..., 256K five times around the processor ring. It calls MPI's built in timer MPI_Wtime() to measure message passing times, and reports the statistics based on these times as a function of increasing message length.

    Ring uses MPI_Wtime() to collect wall clock times, Thus, your timings will reflect interference from other jobs. On a dedicated run, such interference will be minimal; running times will be shorter and reproducible. We aren't yet able to make dedicated runs, however. So run the program several times until you see consistent results. If you are still having difficulties getting consistent results, try running on other nodes. You should use no more than 4 nodes for this experiment.

    To get an absolute time take the difference in times sampled by two successive calls to MPI_Wtime:

            double t0   = MPI_Wtime(); 
    
    	// some code....
            double t1   = MPI_Wtime();
            double time = (t1-t0);
    

    The man-page for MPI_Wtime() is found on line. Note, however, that all times are reported in seconds, and there is no need to divide by MPI_Wtick() to convert to seconds. (You can obtain the resolution of MPI_Wtime using MPI_Wtick())


    Compiling and Running your MPI programs

    To compile, use the makefiles provided for you. These makefiles include an architecture file (arch.valkyrie) file containing the appropriate compiler settings (We use a special version of the Gnu C++ compilers that incorporate the MPI libraries)  

    To run your program, use the mpi-launch command. mpi-launch uses ssh to run programs remotely on the compute nodes. In order to run with mpi-launch, you must automate the ssh authentication procedure, by executing:
    $ ssh-agent $SHELL
    $ ssh-add
    
    Do this once per login session.

    mpi-launch provides the -m flag so you can specify which nodes to run on. The nodes are numbered from 0 to 15, and are named compute-0-0 through compute-0-15. (Each node contains 2 CPUs, but in effect you may use only 1 CPU per node.)

    I've also set up some python scripts to select nodes for you automatically and simplify the command line specification. These will be particular helpful when debugging and are based on code originally written by Dave Sacerdoti, who now works with the Rocks group at SDSC.

    There are two scripts contained in ~cs260f/../public/bin (Set your PATH to include this directory to simplify matters.) The first, runrand.py takes allows you to specify the number of nodes you want to run with, and will pick those nodes for you automatically, and assemble all into an mpi-launch command line and run the job for you. For example, to run ring on 4 nodes with command line arguments -t 3 -s 256 type:

        runme.py 4 ring -t 3 -s 256
    

    Runme avoids the needs to specify the complete path name of the executable, along with a long-winded list of nodes.

    Of course, you may need to specify particular nodes, there is another script:

        run.py 4 12 9 8 5 ring -t 3 -s 16
    
    This will run ring as before, but on the 4 nodes compute-0-{12,9,8,5}.

    If you insist on using mpi-launch, the simplest invocation is:

    $ mpi-launch -m [ comma separated list of compute nodes ] command args

    You must specify the full pathname for the command.

    For example, if user yoda wants to launch the program /home/yoda/hello-world on compute-0-4 and compute-0-5, yoda would execute:

    $ mpi-launch -m compute-0-4,compute-0-5 /home/yoda/hello-world
    

    Don't use MPIrun, as that utilizes the slower 100Mbit ethernet interconnect. (You must also set different path to use a different version of the compiler)

    To run the executable program Ring (found in ~/../public/examples/Ring) on 4 processors  with command line arguments 5 and 1024, you  type:

    mpi-launch -mcompute-0-0,compute-0-1,compute-0-2,compute-0-3 /home/cs260f/public/examples/ring/ring 5 1024

    Be sure and specify the full path of the executable



    Runaway processes

    Sometimes there will be runaway processes. If you feel that the machine is slowing down To check your processes on all nodes do:
    	/usr/sbin/cluster-ps <username>
    
    If you see that some processes are running, use the cluster-kill command to delete them:
    	/usr/sbin/cluster-kill <username>
    
    Some nodes may be down, and the commands will detects this, (after a suitable delay, so please be patient)

    As matter of etiquette, be sure and run cluster-ps before logging out. If you plan to be on the machine for a long time, it would be a good idea to run this command occasionally, and before you start a long series of benchmark runs.


    MPI

    MPI documentation is found at at http://www.cse.ucsd.edu/users/baden/classes/cse260_fa02/testbeds.html#MPI. You can obtain man pages for the MPI calls used in the example programs described here:



     Copyright © 2002 Scott B. Baden. Last modified: 10/08/02 09:3142 PM