lightning user document heading  
NCAR
Last update: 08/14/2006

Lightning user doc contents

Interactive parallel jobs using MPI

This page provides three examples of running interactive distributed-memory parallel jobs that use MPI for message passing. The include a "hello, world" example program written in F90, C, and C++ to demonstrate how it is run as an interactive MPI job.

Interactive MPI with F90

The example code is available in lightning under:
/usr/local/examples/interactive/mpi/f90.

This directory contains a "hello, world" example
program written in F90 to demonstrate running it
as an interactive MPI job. If you type:

        make

it will first compile using command

        mpif90 hello.f90

if not already compiled and then run the executable
(a.out) using command:

        bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"

The explanation of options used in above LSF commands:

   -I
       For interactive job, where stdout and stderr of
       running LSF jobs are connected to user's stdout/stderr.

   -q debug
       Run it in quene named "debug"

   -W 0:05
       Set wall clock limit of 5 minutes.

   -n 4
       Schedule 4 tasks, using default 2 tasks/host.

   "mpirun.lsf ./a.out"
       Run the command to lauch the executable "a.out".
===============
Typical output
===============
echo "Compiling --- "
Compiling ---
mpif90 hello.f90 ; rm -f hello.o
echo ""

echo "Running interactively --- "
Running interactively ---
bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"
Job <149009> is submitted to queue .
<>
<>
 Hello from task-->             0 /            4  ran on ln0129en
 Hello from task-->             2 /            4  ran on ln0133en
 Hello from task-->             1 /            4  ran on ln0129en
 Hello from task-->             3 /            4  ran on ln0133en
Job  /usr/local/lsf/6.2/linux2.6-glibc2.3-x86_64/bin/gmmpirun_wrapper
./a.out

TID HOST_NAME  COMMAND_LINE  STATUS  TERMINATION_TIME
=== ========== ============  ======  ===================
00000 ln0129en   ./a.out     Done    08/07/2006 15:56:54
00001 ln0129en   ./a.out     Done    08/07/2006 15:56:54
00002 ln0133en   ./a.out     Done    08/07/2006 15:56:55
00003 ln0133en   ./a.out     Done    08/07/2006 15:56:55
--------------------------------------------------------------

Interactive MPI with C

The example code is available in lightning under:
/usr/local/examples/interactive/mpi/c.

This directory contains a "hello, world" example
program written in C to demonstrate running it
as an interactive MPI job. If you type:

        make

it will first compile using command

        mpicc hello.c

if not already compiled and then run the executable
(a.out) using command:

        bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"

The explanation of options used in above LSF commands:

   -I
       For interactive job, where stdout and stderr of
       running LSF jobs are connected to user's stdout/stderr.

   -q debug
       Run it in quene named "debug"

   -W 0:05
       Set wall clock limit of 5 minutes.

   -n 4
       Schedule 4 tasks, using default 2 tasks/host.

   "mpirun.lsf ./a.out"
       Run the command to lauch the executable "a.out".
=================
Typical output
=================
echo "Compiling --- "
Compiling ---
mpicc hello.c ; rm -f hello.o
echo ""

echo "Running interactively --- "
Running interactively ---
bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"
Job <149007> is submitted to queue .
<>
<>
---Hello from task-->  1 / 4, ran on ln0134en
---Hello from task-->  2 / 4, ran on ln0128en
---Hello from task-->  3 / 4, ran on ln0128en
---Hello from task-->  0 / 4, ran on ln0134en
Job  /usr/local/lsf/6.2/linux2.6-glibc2.3-x86_64/bin/gmmpirun_wrapper
./a.out

TID   HOST_NAME  COMMAND_LINE  STATUS   TERMINATION_TIME
===== ========== ============  ======   ===================
00000 ln0134en   ./a.out       Done     08/07/2006 15:55:31
00001 ln0134en   ./a.out       Done     08/07/2006 15:55:31
00002 ln0128en   ./a.out       Done     08/07/2006 15:55:31
00003 ln0128en   ./a.out       Done     08/07/2006 15:55:31
---------------------------------------------------------------------

Interactive MPI with C++

The example code is available in lightning under:
/usr/local/examples/interactive/mpi/c++.

This directory contains a "hello, world" example
program written in C++ to demonstrate running it
as an interactive MPI job. If you type:

        make

it will first compile using command

        mpiCC hello.c

if not already compiled and then run the executable
(a.out) using command:

        bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"

The explanation of options used in above LSF commands:

   -I
       For interactive job, where stdout and stderr of
       running LSF jobs are connected to user's stdout/stderr.

   -q debug
       Run it in quene named "debug"

   -W 0:05
       Set wall clock limit of 5 minutes.

   -n 4
       Schedule 4 tasks, using default 2 tasks/host.

   "mpirun.lsf ./a.out"
       Run the command to lauch the executable "a.out".
==============
Typical Output
==============
echo "Compiling --- "
Compiling ---
mpiCC hello.C ; rm -f hello.o hello.ti
echo ""

echo "Running interactively --- "
Running interactively ---
bsub -I -q debug -W 0:05 -n 4 "mpirun.lsf ./a.out"
Job <149006> is submitted to queue .
<>
<>
------Hello from task-->0/4 ran--Hello from task-->1/4 ran on ln013 on
ln0132en
--Hello from task-->3/4 ran on ln0130en
--Hello from task-->2/4 ran on ln0130en
2en
Job  /usr/local/lsf/6.2/linux2.6-glibc2.3-x86_64/bin/gmmpirun_wrapper
./a.out

TID   HOST_NAME  COMMAND_LINE  STATUS  TERMINATION_TIME
===== ========== ============  ======  ===================
00001 ln0132en   ./a.out       Done    08/07/2006 15:54:38
00000 ln0132en   ./a.out       Done    08/07/2006 15:54:38
00003 ln0130en   ./a.out       Done    08/07/2006 15:54:38
00002 ln0130en   ./a.out       Done    08/07/2006 15:54:38
------------------------------------------------------------------

Next page | IBM Linux cluster systems fundamentals - Table of contents

If you have questions about this document, please contact SCD Customer Support. You can also reach us by telephone 24 hours a day, seven days a week at 303-497-1278. Additional contact methods: consult1@ucar.edu and during business hours in NCAR Mesa Lab Suite 39.

© Copyright 2006. University Corporation for Atmospheric Research (UCAR). All Rights Reserved.

Address of this page: http://www.scd.ucar.edu/docs/lightning/examples/serial.jsp