Guide and Reference


Sample Makefiles and Run Script

You can use the message passing makefile and run script with the message passing sample thermal diffusion and sparse linear algebraic equations programs.

You can use the HPF makefile and run script with the HPF sample thermal diffusion programs.

Makefile (Message Passing)

#  Makefile to build the diffusion program, sparse solver and utility routines
#
 
#  add rule for making mod files
.SUFFIXES:  .mod
 
#
# Compilers and such
#
 
CC=mpcc
FORT=mpxlf
LINK=mpxlf
 
LDFLAGS =  -lblacs -lessl -lpessl $(LIB)
FCOPT = -O3 -C -qsource -qxref -qattr $(INCLUDE)
 
# default for include and lib directories
 
INCLUDE=
LIB=
 
## DISTRIBUTED DATA samples
 
# OBJS list objects module used in the diffusion program
#
OBJS = main.o scalemod.o param.o diffusion.o fourier.o
 
BASEOBJS = broadcast.o create.o delete.o init.o scatter_gather.o \
           pdata.o northsouth.o eastwest.o index.o
 
UTILOBJS = $(BASEOBJS) cdata.o putilities.o
 
UTILLIB = libputils.a
 
LIBOBJS = $(UTILLIB)(broadcast.o) $(UTILLIB)(create.o) \
          $(UTILLIB)(delete.o) $(UTILLIB)(init.o)      \
          $(UTILLIB)(scatter_gather.o) $(UTILLIB)(pdata.o)      \
          $(UTILLIB)(northsouth.o) $(UTILLIB)(eastwest.o)      \
          $(UTILLIB)(index.o) $(UTILLIB)(cdata.o)      \
          $(UTILLIB)(putilities.o)
 
 
distribute: diffusion pdgexmp image simple
 
#
#  Rule for building diffusion program
#  power libraries
diffusion: $(OBJS)
 $(LINK) -o diffusion $(OBJS) -lpessl -lblacs -lessl
 
#  power2 libraries
#diffusion: $(OBJS)
# $(LINK) -o diffusion $(OBJS) -lpesslp2 -lblacsp2 -lesslp2
 
 
pdgexmp:  pdgexmp.o  $(UTILLIB)
 $(LINK) -o pdgexmp pdgexmp.o  -L . -lputils $(LDFLAGS)
 
image:  image.o  $(UTILLIB)
 $(LINK) -o image image.o -L . -lputils $(LDFLAGS)
 
simple:  simple.o  $(UTILLIB)
 $(LINK) -o simple simple.o  -L . -lputils $(LDFLAGS)
 
#rule to create the library
 
$(UTILLIB): $(LIBOBJS)
 ar rv $(UTILLIB) $%
 
# rules to create library objects
 
init.o: init.f pdata.o
 xlf -c $(FFLAGS) init.f
 
exchange.o: init.f pdata.o
 xlf -c $(FFLAGS) exchange.f
 
cdata.o: cdata.f pdata.o
 xlf -c $(FFLAGS) cdata.f
 
create.o: create.f pdata.o
 xlf -c $(FFLAGS) create.f
 
broadcast.o: broadcast.f pdata.o
 xlf -c $(FFLAGS) broadcast.f
 
delete.o: delete.f pdata.o
 xlf -c $(FFLAGS) delete.f
 
scatter_gather.o: scatter_gather.f pdata.o
 xlf -c $(FFLAGS) scatter_gather.f
 
putilities.o: putilities.f $(BASEOBJS) cdata.o
 xlf -c $(FFLAGS) putilities.f
 
eastwest.o: eastwest.f pdata.o
 xlf -c $(FFLAGS) eastwest.f
 
northsouth.o: northsouth.f pdata.o
 xlf -c $(FFLAGS) northsouth.f
 
$(UTILLIB)(broadcast.o): broadcast.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(create.o): create.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(delete.o): delete.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(init.o): init.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(scatter_gather.o): scatter_gather.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(pdata.o): pdata.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(northsouth.o): northsouth.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(eastwest.o): eastwest.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(index.o): index.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(cdata.o): cdata.o
 ar rv $(UTILLIB) $%
 
$(UTILLIB)(putilities.o): putilities.o
 ar rv $(UTILLIB) $%
 
#
#  List of object module dependencies for distributed data sample.
main.o: main.f scalemod.o param.o  diffusion.o fourier.o
diffusion.o: diffusion.f scalemod.o param.o
fourier.o: fourier.f diffusion.o scalemod.o param.o
scalemod.o: scalemod.f param.o
param.o: param.f
pdgexmp.o: pdgexmp.f $(UTILLIB)
simple.o: simple.f $(UTILLIB)
image.o: image.f $(UTILLIB)
 
 
##  SPARSE MATRIX samples
 
# HBOBJS and PARTOBJS list objects module used in the SPARSE programs.
#
HBOBJS=read_mat.o mat_dist.o desym.o
PARTOBJS= part_block.o  partbcyc.o partrand.o
 
sparse: hb_sample pde90 pde77
 
pde90: pde90.o part_block.o
 $(LINK) $(LDFLAGS)  pde90.o part_block.o -o pde90
 
 
 
pde77: pde77.o  part_block.o
 $(LINK) $(LDFLAGS)  pde77.o  part_block.o -o pde77
 
hb_sample: $(HBOBJS) hb_sample.o $(PARTOBJS)
 $(LINK) $(LDFLAGS)  hb_sample.o -o hb_sample \
 $(HBOBJS) $(PARTOBJS)
 
#
#  List of object module dependencies for sparse matrix sample.
$(HBOBJS) hb_sample.o: read_mat.mod mat_dist.mod  part_bcyc.mod partrand.mod
part_bcyc.mod: partbcyc.o
 
#
#  Rule to clean executable and program
cleanall:
 rm -f *.lst *.o *.mod diffusion core image pdgexmp simple hb_sample pde90 pde77 libputils.a
 
#
clean:
 /bin/rm -f *.o *.mod *.lst
 
#
# definitions for compiles
.f.mod:
 $(FORT) $(INCLUDE) $(FCOPT) -c $<
.c.o:
 $(CC) $(INCLUDE) $(CCOPT) -c  $<
.f.o:
 $(FORT) $(INCLUDE) $(FCOPT)  -c  $<

Makefile (HPF)

#
#  Makefile to build the diffusion program.
#
# OBJS list objects module used in the program
#
OBJS = main.o param.o diffusion.o fourier.o
 
# For Power2 compilation
#FFLAGS = -qreport=hpflist -C -O -qarch=pwrx
FFLAGS = -qreport=hpflist -C -O
# For Power2 libraries
#LDFLAGS = -lblacsp2 -lpesslp2 -lpesslhpfp2 -lesslp2
LDFLAGS = -lblacs -lpessl -lpesslhpf -lessl
 
#
#  Default rule for compiling Fortran modules.
.f.o:
	xlhpf -c $(FFLAGS) $<
 
#
#  Rule for building diffusion program
#  power libraries
diffusion:	$(OBJS)
	xlhpf -o diffusion $(OBJS) $(LDFLAGS)
 
 
#
#  Rule to clean executable and program
clean:
	rm -f *.o *.mod diffusion core
#
#  List of object module dependencies.
main.o: main.f param.o  diffusion.o fourier.o
diffusion.o: diffusion.f param.o
fourier.o: fourier.f diffusion.o param.o
param.o: param.f

Run Script

#!/bin/ksh
#
# USING THE FORTRAN EXAMPLE
# Copy the files from /usr/lpp/pessl.rte.common/example/fortran to a directory that
# is part of a shared file system (e.g. NFS mounted).  You can not run
# the program from a private file system.
#
# You must have the same userid on the home node and each remote node.
#
# You must have remote execution authority on all the nodes.
#
# Invoke 'make'.
#
# In run.script, edit EXAMP_PATH below to point to the working directory
# which contains the files.
#
# Invoke 'run.script'.
#
 
#
# Script file to execute a sample program.
# The first argument is the name of the sample to run
# The remaining arguments are any needed to by the sample
#
 
#
#  Set the number of processor to be 8.
export MP_PROCS=8
#
#  Set the program to run in user space.
export MP_EUILIB=us
#
#  Use the high speed switch.
export MP_EUIDEVICE=css0
#
#  Use the poe resource manager.
export MP_RESD=yes
#
#  Use the resource pool 0, this may need to be changed
#  depending on installation defaults used.
export MP_RMPOOL=0
#
#  Do not use a hostfile list.
export MP_HOSTFILE=NULL
#
#  Use low information output level.
export MP_INFOLEVEL=1
#
#
export MP_PGMMODEL=spmd
#
#  Standard output is not node ordered.
export MP_STDOUTMODE=unordered
#
#  Retry node allocation every 60 seconds.
export MP_RETRY=60
#
#  Retry node allocation five times.
export MP_RETRYCOUNT=5
#
#
export MP_CSS_INTERRUPT=yes
#
export MP_PULSE=0
#
#  Label standard io by processor number.
export MP_LABELIO=yes
poe $*


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