How to connect to Sun machines and run an MPI program

We have two Sun multiprocessor computers, named 420-1 and 420-2 .   Each of them has 4 processors.  They run Solaris 8 operating system.
There are many ways to connect to the machines:

Telnet

This is the easiest way to connect to the Sun machines.   Telnet is a terminal emulator program running in text mode.  A telnet program is available in all Windows machines.

To connect to 420-1, just run telnet 420-1.cp.eng.chula.ac.th or telnet 420-1.

Ssh

ssh (Secure Shell) is similar to telnet but much more secure.  There are many free ssh programs for WindowsPuTTY is recommended.

You can download PuTTY from here or here.  Just download all files into a directory such as C:\Program Files\PuTTY.

To connect to 420-1,

  1. Run putty.exe
  2. Choose SSH protocol
  3. Enter 420-1.cp.eng.chula.ac.th or 420-1 in the host name field
  4. Enter username and password

VNC

VNC (Virtual Network Computing) is a remote display system which allows you to view a graphical 'desktop' environment from anywhere on the Internet and from a wide variety of machine architectures.  Therefore, you can run programs on the Sun machine in graphics mode from your PC.  You can download it from here or here.

To run VNC,

  1. Connect to the Sun machine in text mode using telnet or ssh.
  2. Make sure that you have /usr/X/bin in your path by running "echo $PATH" .

  3. If /usr/X/bin is not in the path, run "PATH=$PATH:/usr/X/bin".
  4. Start a vncserver process on the Sun machine by running /usr/local/bin/vncserver.  The first time you run vncserver, it will ask you to set up a password (probably different to your login password).  Once you have set your password, run vncserver again.  You can change the password later by running vncpasswd.
  5. vncserver will give you the display name, such as "420-1:1".
  6. Run the vncviewer program on your PC.  Enter the display name, such as "420-1:1", and the password.   VNC will bring Sun's desktop environment onto your PC.
  7. When you finish, close the VNC client window on your PC and stop vncserver on the Sun machine by running "vncserver -kill 420-1:1".
By default, VNC creates a startup file ~/.vnc/xstartup that launches a window manager program called twm.  If you find twm unattractive, you may wish to use another window manager program called CDE (Common Desktop Environment) instead.  Here is how to switch to CDE:
Edit ~/.vnc/xstartup.  It looks like this:
    #!/bin/sh

    xrdb $HOME/.Xresources
    xsetroot -solid grey
    xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
    twm &

    Change the last line to

    /usr/dt/bin/dtwm &


How to run an MPI program

We have MPICH installed on the Sun machines.  It is configured to communicate with Secure Shell protocol.  Before running your first MPI program, please do the following setup.  After the setup, you will not have to enter the password when you ssh between the Sun machines.
  1. ssh-keygen -t dsa
  2. cp ~/.ssh/id_dsa.pub   ~/.ssh/authorized_keys2
A machine file is a text file containing a list of machines on which you want to run your program.  By default, MPICH will allocate a process on each machine in a round-robin basis.  For example, to make MPICH allocate a process on each processor of the Sun machines, edit a machine file named   machines which contains:

420-1
420-1
420-1
420-1
420-2
420-2
420-2
420-2

To compile an MPI program

mpicc <source_program> -o <executable_program>

To run an MPI program

mpirun [mpirun_options...] <executable_program> [options...]

Frequently used command:
mpirun -machinefile <machine_file> -np <number_of_processes> <executable_program>
 
 


Last modified: 24 June 2002
Veera Muangsin