IBM Books

Administration Guide


Executing LAPI programs

The LAPI communications application programming interface must be used in conjunction with the IBM Parallel Environment for AIX (PE) product. Specifically the Parallel Operating Environment (POE) component of PE is used to compile and run LAPI parallel programs. POE also provides support for parallel programs to use the Message Passing Interface (MPI) both separately and in combination with the LAPI. The publication IBM Parallel Environment for AIX: Operation and Use provides detailed information about using the POE.

Compiling LAPI programs

As with a serial application, you must compile a parallel C, C++, or Fortran program before you can run it. Instead of using the cc_r, xlC_r, or xlf commands, however, you use the commands mpcc_r, mpCC_r, or mpxlf_r, which support programs using the threaded LAPI library. The mpcc_r, mpCC_r, and mpxlf_r commands not only compile your program, but also link in the POE Partition Manager and PSSP Communication Subsystem (CSS) interfaces. When you later run the program, the CSS libraries will be dynamically linked with the executable program. Subroutines in these libraries enable POE's home node (the node from which the parallel program is invoked) to communicate with the parallel tasks, and tasks with each other.

The following table shows what to enter to compile a LAPI program.

To compile a C program mpcc_r program.c -o program
To compile a C++ program mpCC_r program.C -o program
To compile a Fortran program mpxlf_r program.f -o program

Creating a static executable

Note:
IBM suggests you avoid creating statically bound executables. If service is ever applied that affects any of the CSS libraries, you will need to recompile your application to create a new executable that will work with the new libraries. This could lead to a lot of work and might expose you to potential problems, which would be avoided if dynamic libraries are used.

The following is a sample make file:

COMPILER  = mpcc_r
CFLAGS    = -g
 
FCOMPILER = mpxlf_r
FFLAGS    = -g
 
STATIC = -bnso -bI:/usr/lib/syscalls.exp -bI:/usr/lib/threads.exp \
         -bI:/usr/lpp/ssp/css/libus/fs_ext.exp -lppe_r -lhal_r
 
all: Get Put Am Rmw Getf Putf Rmwf Amf Get_static
 
Get: Get.c
        $(COMPILER) $(CFLAGS) -v -o $@ $@.c
 
Getf: Getf.f
        $(FCOMPILER) $(FFLAGS) -v -o $@ $@.f
 
Put: Put.c
        $(COMPILER) $(CFLAGS) -v -o $@ $@.c
 
Putf: Putf.f
        $(FCOMPILER) $(FFLAGS) -v -o $@ $@.f
 
Am: Am.c
        $(COMPILER) $(CFLAGS) -v -o $@ $@.c
 
Amf: Amf.f
        $(FCOMPILER) $(FFLAGS) -v -o $@ $@.f
 
Rmw: Rmw.c
        $(COMPILER) $(CFLAGS) -v -o $@ $@.c
 
Rmwf: Rmwf.f
        $(FCOMPILER) $(FFLAGS) -v -o $@ $@.f
 
Get_static: Get.c
        $(COMPILER) $(CFLAGS) $(STATIC) -v -o $@
Get.c
 
clean:
        rm -rf Get Put Am Rmw Getf Putf Rmwf Amf Get_static

Running LAPI programs

Before running your program, you need to set up your execution environment. There are a number of POE environment variables discussed throughout IBM Parallel Environment for AIX: Operation and Use and summarized in the "POE Environment Variables and Command-Line Flags" appendix of that book. LAPI programs must set the environment variable MP_EUILIB (or the command-line flag -euilib) to us (us is the User Space communication subsystem). The default setting for MP_EUILIB is ip (ip is the IP communication subsystem). The LAPI supports only User Space communication using the SP Switch. The LAPI does not support using the IP communication subsystem.

All other procedures for running a LAPI program using POE are common with the MPI programs and are described in IBM Parallel Environment for AIX: Operation and Use.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]