src/OpenFOAM logo
The Open Source CFD Toolbox
  Search
  
  Back to OpenFOAM Home
 
  OpenCFD®
  Company profile
  OpenFOAM support
  OpenFOAM development
  OpenFOAM training
  Solutions
  Contact OpenCFD
  Recruitment
  Recommended links
 
  OpenFOAM®
  Features
  Download
  Documentation
  * User Guide
  * C++ Source Guide
  * README file
  * Release notes
  * Upgrading to 1.5
 
  Our trade mark policy
 
  © 2000-2008 OpenCFD Ltd
SourceForge.net Logo
OpenCFD® Solutions Contact OpenFOAM®
OpenFOAM 1.5 User Guide © 2000-2008 OpenCFD Ltd

B.1 Running a decomposed case in parallel using MPICH

This section describes how to run OpenFOAM cases in parallel using MPI/MPICH rather than openMPI, as described in 3.4.2.

The invocation of MPI/MPICH differs whether or not the application that is being executed has the same pathname on all processor nodes. The pathname to the executable can differ if:

  • the processors do not all belong to the same UNIX/Linux architectures;
  • there is no networked file system (NFS) access to the executable from all nodes and therefore it is installed in a different place on different nodes.

B.1.1 Same executable pathname on all nodes

On a single machine in which the processor nodes are all local to the user, the following command should be executed1   \special {t4ht= , noting that ` is a backwards quotation character, typically found at the top left of the keyboard (not a '):


    mpirun -np <nProcs> `which <foamExec>`
       <otherArgs> -parallel < /dev/null >& log &
where: <nProcs> is the number of processors; <foamExec> is the executable, e.g.icoFoam; and, the output is redirected to a file named log. For example, if icoFoam is run on 3 nodes on the cavity tutorial in the $FOAM_RUN/tutorials/icoFoam directory, then the following command should be executed:


    mpirun -np 3 `which icoFoam` $FOAM_RUN/tutorials/icoFoam cavity
        -parallel < /dev/null >& log &

When the processors that the user wishes to access are distributed across a cluster of machines, the user should execute the command:


    mpirun  -machinefile <machinesFile> -np <nProcs> `which <foamExec>`
    <otherArgs> -parallel < /dev/null >& log &
This is the same as before except that there is the <machinesFile> file that contains the names of the nodes, one per line, with the first one being the machine that the user is currently logged onto. A <machinesFile> is a file read by MPICH and therefore requires no header, only the names of the machines and number of processors to be used on each machine. For example, to run one process on machine arp and two on noddy, the file would be:


    arp:1
    noddy:2
Note: optimisation of the performance on a cluster of machines with shared memory may require recompiling of the MPICH library. See the MPICH documentation on how to do this.

B.1.2 Different executable pathname on different nodes

To run an executable with a different pathname on different nodes requires the same version of OpenFOAM to be installed on all nodes and the ability to run using rsh. The latter can be tested by trying to execute an application, e.g.icoFoam, on all nodes:


    rsh <machineName> icoFoam <root> <case>
Different pathnames of executables can be specified through a <p4pgFile> file containing the names of nodes and the respective pathname to the executable. For example to run icoFoam on machine arp, a Linux machine, and on noddy, a Solaris machine, the <p4pgFile> would contain the following entries:


    arp  0 /usr/local/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxOptMPICH/icoFoam
    noddy 1 /usr/local/OpenFOAM/OpenFOAM-1.5/applications/bin/solarisOptMPICH/icoFoam
The second entry per line, here 0 and 1, are the number of additional processes per machine. Since the MPI run is started from arp the master process runs on it and no additional processes should be started on it. The job is run by executing


    mpirun  -p4pg <p4pgFile> `which <foamExec>`
       <otherArgs> -parallel < /dev/null >& log &