Personal tools
You are here: Home / Installing Biskit / PVM Howto

PVM Howto

Get your PVM (Parallel Virtual Machine) up and running.

Contents


Setting up pvm for python

  1. Install pvm:

    See the Install dependencies instructions or, if there are problems, refer to the troubleshooting howto Install pvm from source.

    Note that you will need the header and library files for compiling the pypvm module. You get them automatically when installing from source but you need to select an additional pvm-devel package if you install from rpm.

  2. Make sure you can log into all nodes without password:

    See Enabling password-less login from A to B at the end of this document

  3. Prepare environment:

    export PVM_ROOT=/usr/lib/pvm3
    export PVM_RSH=/usr/bin/ssh
    export PVM_ARCH=LINUX        ## or LINUX64 or LINUXX86_64 on 64bit systems
    

    pvm3 often rather resides in /usr/share/pvm3 -- adapt PVM_ROOT accordingly. Adjust $PVM_ARCH to the string returned by $PVM_ROOT/lib/pvmgetarch. So this should work more generally:

    export PVM_ARCH=`$PVM_ROOT/lib/pvmgetarch`   ## note the back-quotes!
    

    Note: $PVM_ARCH is needed for compiling pypvm and should match a directory existing in $PVM_ROOT/lib. It may not be needed for running pvm except under some circumstances, e.g. if you use a different pvm binary folder (see next point). It is hence saver to always define it.

  4. Adapt pvm binary folder:

    PVM looks in the folder $PVM_ROOT/bin/$PVM_ARCH (for example /usr/share/pvm3/bin/LINUX) for executables. In our case, we need python and xterm. All the other programs used by biskit will be started from within python and PVM doesn't need to know about them.

    If you don't have write-access to the system-wide $PVM_ROOT folder or want to use different binary versions, try creating a folder in your home (which is the default working directory of pvm):

    cd ~
    mkdir pvm3; mkdir pvm3/bin; mkdir pvm3/bin/$PVM_ARCH
    

    Link the correct python version and xterm into this folder or into $PVM_ROOT/bin/$PVM_ARCH:

    cd pvm3/bin/$PVM_ARCH
    ln -s `which python` .
    ln -s `which xterm` .
    

    Note: the local binary folder in home seems not to work in practice. The best option is to adapt the $PVM_ROOT/bin/$PVM_ARCH folder directly. If really needed, make a complete copy of the pvm3 folder, point the $PVM_ROOT variable to this folder, adapt its bin/$PVM_ARCH folder and make sure that you indeed use $PVM_ROOT/lib/pvm for starting up the master (i.e. not the default one from which you made the copy). To avoid confusion, it is much better to have only one pvm folder installed on a node.

  5. Repeat the above steps on every node to be used with pvm.

  6. Test the raw pvm setup

    1. start the pvm demon:

      cd ~   ## important if you want to use a local ~/pvm3/bin folder
      pvm
      
    2. Add a node (e.g. a computer called hal):

      pvm> add hal
      add hal
      1 successful
                         HOST     DTID
                         hal      80000
      pvm>
      
    3. List all registered nodes (in this case, kaa is the local computer):

      pvm> conf
      conf
      2 hosts, 2 data formats
                  HOST     DTID     ARCH   SPEED       DSIG
                   kaa    40000  LINUX64    1000 0x00408c41
                   hal    80000    LINUX    1000 0x00408841
      
    4. Spawn a test process ('kaa' is the name of the local host here):

      pvm> spawn -kaa xterm
      spawn -kaa xterm
      1 successful
      t40005
      pvm>
      

      You should see a xterminal popping up.

    5. Spawn a test process on a remote host:

      pvm> spawn -hal xterm
      spawn -hal xterm
      1 successful
      t80001
      

      If it looks like this, but you don't see the xterminal, you need to adapt the X-Permissions. See Using remote windows with pvm! If you get a "No such file" Error, you need to check your pvm binary path (e.g. pvm3/bin/LINUX64; make sure it exists and the link to xterm is correct).

    6. Shut down pvm:

      pvm> halt
      
    7. In case things go wrong, make sure there are no .pvm* files left over in the /tmp folders of any node (at least none from yourself).

  7. in Master.py: call pvmInit(hosts) with list of hosts

  8. run Master.py (See example code in ExampleMaster.__main__)

  9. stop pvm daemon (optional):

    pvm
    pvm> halt
    

PVM commands

command function
add host_name manually add a host
remove host_name remove it
reset kill all your running pvm processes
halt stop pvm altogether
exit / ^D exit the PVM shell without quitting the PVM demon

Using remote windows with pvm

For security reasons, the default setting in recent linux distributions is to not allow a machine to remotely open a window. So, by default the X server on these machines is running as "tcp nolisten". The current implementation of getting remote windows from PVM slaves is using "xterm - display host:0.0" which will not run with the new secure settings.

  1. To change back to the old insecure X server settings (example from a Linux box running the CentOS distriburion):

    • Either comment in DisallowTCP=false in the file /etc/X11/gdm/gdm.conf
    • Or use the graphical tools from menu System Settings -> Login Screen -> Security and uncheck: Always disallow TCP connections to the X server ...
  2. Then on your local machine allow remote hosts to access the X server:

    • allow all hosts:

      xhosts +
      
    • or only specific hosts:

      xhost +remote.host.name
      
  3. Finally test that it is working (you must have password free ssh set up):

    ssh remote.host.name xterm -display local.host.name:0.0
    

    An xterm window from the remote machine should show up on your local machine.


Troubleshooting

  1. A slave can not be spawned:

    • kill any pvm process left over on that node
    • delete old pvm* files in /tmp on that node
    • try again

    Scripts that help you clean up:

  2. PVM doesn't use (for calculations) the node were the master is running:

    • add this node with the full name e.g. otto.bis.pasteur.fr instead of otto
  3. PVM modules cannot be imported:

    Biskit gives a warning like this:

    Warning (ignored): Could not import PVM modules. Please check that the pypvm_core library is compiled!
            Parallelisation is not available.
    

    or like this:

    exceptions.ImportError in |somename|.py line xx:
            ('No module named pypvm_core',).
    
    1. Make sure that you have installed pypvm (see Install dependencies).
    2. Check your $PYTHONPATH on each node and make sure your python is importing the Biskit and pypvm version it ought to.
  4. PVM terminates after adding host

    Symptom:

    pvm crashes after manually adding a host, for example:

    pvm> add kaa
    add kaa
    [1]    11067 terminated  pvm
    

    From Biskit this may look like this:

    PVM.ExampleMaster test ... adding 3 hosts to pvm...
    Process Python terminated
    
    Problem:

    On Ubuntu, the pvm master node may identify itself with the localhost IP (127.0.0.1) which cannot be used by the slave nodes.

    Solution:

    Edit /etc/hosts and put the actual (network) IP of the master node into the first line before 127.0.0.1. For example:

    192.168.0.98    urfin
    127.0.1.1      urfin
    127.0.0.1      localhost
    

    See also: http://stackoverflow.com/questions/2253354/pvm-terminates-after-adding-host


Enabling password-less login from A to B

3 steps:
  1. generate a identity file on A
  2. copy it over to B
  3. add this file to the list of authorized login

The following works for ssh2:

  1. on A:

    >>> ssh-keygen -t rsa
    

    Hit return on each question (3)

    >>> ssh-keygen -t dsa
    

    Hit return on each question (3)

  2. copy *pub files from A to B:

    >>> cd ~/.ssh
    >>> scp id_dsa.pub "B:.ssh/id_dsa.pub-Bis"
    >>> scp id_rsa.pub "B:.ssh/id_rsa.pub-Bis"
    
  3. on B "authorize" login from A:

    >>> ssh B
    >>> cd $HOME/.ssh (you might need to create it )
    >>> cat id_rsa.pub-Bis  id_dsa.pub-Bis  >> authorized_keys2
    
Or download and use ssh-keyinstall to set up your system:
http://www.stearns.org/ssh-keyinstall/

That's it. Test!

Still having problems? Check for firewalls!