CARC web archive · Archived copy of
ahpcc.unm.edu/Workshop/System-subroutine/chameleon/chameleon.html as captured by the Internet Archive on 4 June 2000. Links to pages that were not saved here go to the Wayback Machine.
Wayback copy ·
All pages in this snapshot ·
Web archive index

An Introduction to Chameleon
Origination of Chameleon
- Argonne National Laboratory, Mathematics and Computer Science Division
- Contact: William Gropp, gropp@mcs.anl.gov
- Primary Resources:
FTP: info.mcs.anl.gov under pub/pdetools
WWW: http://www.mcs.anl.gov
User's Manual -- hard copy at AHPCC or get from AHPCC or ANL anonymous
ftp server
- Additional Resources
WWW: MHPCC http://www.mhpcc.edu/mhpcc.html
WWW: ARC http://www.arc.unm.edu
FTP: ARC ftp.arc.unm.edu
Chameleon Concept
Second Generation Parallel Programming System
- Message Passing System
- Uses existing parallel programming systems rather than replacing them
- Stable interface to changing parallel programming system
- Runs on homogeneous and heterogeneous systems of computers
- Provides access to a wide variety of debugging and profiling aids
- C and Fortran
Goals of Chameleon
- Be very lightweight (low overhead)
- Be highly portable
- Help standardize program startup and the use of emerging message passing
operations such as collective operations on subsets of processors
Current Compatibility of Chameleon
- Sun
- DEC
- IBM RS/6000
- IBM SP1 and SP2
- BBN TC-2000
- Intel iPSC/860
- DELTA
- Paragon
Reverse Compatibility
- Programs written using PCL, NX, or MPI can be ported to any system
that Chameleon runs on
Figure to be inserted later
How does Chameleon Change its Colors?
- In C, Chameleon uses macros to translate Chameleon functions
to functions used by P4, PVM, EUI, etc.
- In Fortran, translation functions are used.
- Makefile macros critical (ARCH, COMM, BOPT environment variables)
Based on macros, the Makefile
- Sets architecture specific variables
Sets flags for production, debugging, or profiling libraries
Sets libraries and include files for target communication package
- Preprocesses or translates Chameleon functions to target parallel programming
system
- Compiles code
- Links in Chameleon specific control functions and
- Links in target parallel programming system library
A Simple Example
- md ~/chameleon
- cd ~/chameleon
- cp /usr/local/ftp/pub/chameleon/workshop/* .
This example uses the Makefile and ring2.c program
/* This is a simple ring program */
#include "tools.h"
#include "comm/comm.h"
int worker(argc, argv)
int argc;
char ** argv;
{
int buf, size = sizeof(int);
if (PImytid ==0) {
buf = 1;
PIbsend( 1, &buf, siz, PSNbrRing( 1, 1, PSAllProcs),MSG_INT);
PIbrecv( 1, &buf, siz, MSG_INT);
}
else{
PIbrecv( 1, &buf, siz, MSG_INT);
PIbsend( 1, &buf, siz, PSNbrRing( 1, 1, PSAllProcs), MSG_INT);
}
return 0;
}
Makefile
#All
#Run examples
ALL: sgi_build rs6000_build
ITOOLSDIR = /usr/local/chameleon-1.2
ARCH = rs6000
#COMM = pvm3
COMM = p4
#BOPT = Opg
#BOPT = O
BOPT = g
CFLAGS = -I$(ITOOLSDIR) $(OPT) $(COPT)
FFLAGS = -I$(ITOOLSDIR)
LDIR = $(ITOOLSDIR)/libs/libs$(BOPT)/$(ARCH)
LIBS = -L$(LDIR) -lpecomm$(COMM) -lpetsc -lpecore -lpecomm$(COMM)
FLIBS = -L$(LDIR) -lpetscfort$(COMM)
FMAIN = $(LDIR)/fmain$(COMM).o
CMAIN = $(LDIR)/cmain$(COMM).o
LXLIBS = -L$(LDIR) -lpetscgrf$(COMM) -lpetscgrf
WORK_DIR = chameleon
LIBNAME = dummy
programs: $(ARCH)/ring2
#There are four include file in the standard Makefile. It is informative
to
#look at samples of what these files include:
include $(ITOOLSDIR)/bmake/$(ARCH).$(BOPT)
include $(ITOOLSDIR)/bmake/$(ARCH)
include $(ITOOLSDIR)/bmake/$(ARCH).$(COMM)
include $(ITOOLSDIR)/bmake/$(ARCH).x11
rs6000_build:
rsh acoma "cd chameleon; make -e ARCH=rs6000 programs "
sgi_build:
rsh cochiti "cd chameleon; make -e ARCH=IRIX programs"
hp_build:
rsh isleta "cd chameleon; make -e ARCH=hp programs"
ring2.i: ring2.c
$(CC) -E $(CFLAGS) $(BASEOPT) ring2.c |cb -s -l 70 >ring2.i
$(ARCH)/ring2: $(ARCH)/ring2.o
$(CLINKER) -o $(ARCH)/ring2 $(CFLAGS) $(BASEOPT) $(CMAIN) \
$(ARCH)/ring2.o $(LIBS) $(CLIB) $(SLIB) -lm
$(ARCH)/ring2.o: ring2.c
cd $(ARCH); $(CC) -c $(CFLAGS) $(BASEOPT) ../ring2.c
clean:
$(RM) -f ring2.i
$(RM) -f rs6000/*
$(RM) -f IRIX/*
$(RM) -f sun/*
$(RM) -f hp/*
To See How Chameleon Translates the Program
- In the Makefile, add the following line (should already be done) ring2.i:
ring2.c $(CC) -E $(CFLAGS) $(BASEOPT) ring2.c | cb -s -l 70 >ring2.i
- set COMM to pvm3, p4, or eui
- Type: make ring2.i more ring2.i /worker look at how the send and
receives are translated
Another Simple Example
- make ring2
- ring2 -np 3
- try changing the communication package and run it again (the program
must be recompiled).
More Examples
md ~/chameleon
- cd ~/chameleon
- cp /usr/local/ftp/pub/chameleon/workshop/* .
- C examples
- ringc.c
- integer passed and incremented around a ring
- example1.c
- 2D domain decomposition
- lapc.c
- linear algebra example (not working yet)
- wavec.c
- explicit finite difference (not working yet)
- exscat.c
- scatter
- long.c
- test message passing
- ring2.c
- simple ring program
- Fortran examples
- pi.f
- pi calculation
- example2.f
- expicl.f
- picl code translation example
- wavef.f
- explicit finite difference (not working yet)
- lapf.f
- linear algebra example (not working yet)
- Compile and Run Examples
- make program_name
- program_name -np x
Additional Exercises
- Exercises on your own
- Try preprocessing C example of your choice to see how the code is translated
- Environment Option Examples (some of these may not work as documented)
- Add -trace to command line when running program
- Add -summary to command line when running program
- Visualization Examples
- Add logging functions and visualize using upshot
- Use vt (only on RS6000s with the Parallel Operating Environment) to
visualize program execution
Copyright 1997 High Performance Computing
Education and Research Center
November 1997, editor@arc.unm.edu