A-1.0 Sample makefile
The makefile shown in Figure 8, below, is for use with both legacy and Legion-aware programs that will be executed with either legion_run or legion_run_multi. In the sample below we started with a legacy C++ code, gnomad.c, and modified it to use the Legion I/O libraries. This allows the application to manipulate context space directly rather than copying a lot of files around. A copy of the original program was kept in the file gnomad_orig.c.
The makefile has targets for five platforms: intel, sgi, solaris, ibm, and alpha_linux. The make targets are slightly different for each machine because the c++/g++ compiler sits in different places and may not be found by the default search path. Therefore, we hard-wired each target to known paths. If these paths don't work for you, log on to a compilation box and get the path directly.
Each make target uses legion_make to start a make on the desired platform. The make target then compiles and registers both the pure legacy code and the Legion-aware code. After each code is compiled, the resulting binary is registered in Legion space in the desired directory, in this case in /home/grimshaw.
Figure 8: Sample makefile for legacy and Legion-aware programs |
CC = g++
include $(LEGION)/src/macros/$(LEGION_ARCH).macros
include $(LEGION)/src/macros/$(LEGION_ARCH).$(CC).macros
CFLAGS = -I$(LEGION)/include -L$(LEGION)/lib/$(LEGION_ARCH)/g++
LIB = -lBasicFiles -lLegionClientStubs $(LIB_LEGION_LFLAGS)
local:
g++ -O $(CFLAGS) gnomad.c -o gnomad $(LIB)
g++ -O $(CFLAGS) gnomad_orig.c -o gnomad_orig $(LIB)
intel: gnomad.c
legion_make -a linux usr_path
touch intel
all_platforms: solaris ibm intel alpha_linux sgi
make intel alpha_linux solaris sgi
gnu_path:
/gnu/bin/g++ -O $(CFLAGS) gnomad.c -o gnomad $(LIB)
legion_register_program /home/grimshaw/gnomad ./gnomad $(LEGION_ARCH)
/gnu/bin/g++ -O $(CFLAGS) gnomad_orig.c -o gnomad_orig $(LIB)
legion_register_program /home/grimshaw/gnomad_orig ./gnomad_orig $(LEGION_ARCH)
usr_local_path:
/usr/local/bin/g++ -O $(CFLAGS) gnomad.c -o gnomad $(LIB)
legion_register_program /home/grimshaw/gnomad ./gnomad $(LEGION_ARCH)
/usr/local/bin/g++ -O $(CFLAGS) gnomad_orig.c -o gnomad_orig $(LIB)
legion_register_program /home/grimshaw/gnomad_orig ./gnomad_orig $(LEGION_ARCH)
usr_path:
/usr/bin/g++ -O $(CFLAGS) gnomad.c -o gnomad $(LIB)
legion_register_program /home/grimshaw/gnomad ./gnomad $(LEGION_ARCH)
/usr/bin/g++ -O $(CFLAGS) gnomad_orig.c -o gnomad_orig $(LIB)
legion_register_program /home/grimshaw/gnomad_orig ./gnomad_orig $(LEGION_ARCH)
solaris: gnomad.c
legion_make -a solaris -e /gnu/bin/make gnu_path
touch solaris
ibm: gnomad.c
legion_make -a rs6000 -e /gnu/bin/make gnu_path
touch ibm
sgi: gnomad.c
legion_make -h /hosts/bluebox.cs.virginia.edu -e /gnu/bin/make gnu_path
touch sgi
alpha_linux: gnomad.c
legion_make -a alpha_linux usr_local_path
touch alpha_linux
register:
legion_register_program /home/grimshaw/gnomad ./gnomad $(LEGION_ARCH)
clean:
rm -f gnomad solaris ibm sgi intel alpha_linux
run:
legion_run -IN ribo.x -IN ribo.d -IN params -OUT tmaplow -OUT tmapfinal gnomad ribo
|
legion@Virginia.edu
http://legion.virginia.edu/
|