Having compiled scalapack, I now want to link against it to test out some examples. Here's a copy of my Makefile that I butchered from the example and testing directory from the scalapack distribution.

#
# scalapack example LU
# 


#
# where the libraries are
#
HPCE2LIB = /misc/shared/apps/hpce2/libs
SCALAPACKLIB = $(HPCE2LIB)/libscalapack.a

BLASLIB = $(HPCE2LIB)/blas_LINUX.a
LAPACKLIB = $(HPCE2LIB)/lapack_LINUX.a

BLACSLIB = $(HPCE2LIB)/blacs_MPI-LINUX-0.a
BLACSCINIT = $(HPCE2LIB)/blacsCinit_MPI-LINUX-0.a
BLACSFINIT = $(HPCE2LIB)/blacsF77init_MPI-LINUX-0.a

FBLACSLIB = $(BLACSFINIT) $(BLACSLIB) $(BLACSFINIT)
CBLACSLIB = $(BLACSCINIT) $(BLACSLIB) $(BLACSCINIT)

LIBS = $(SCALAPACKLIB) $(FBLACSLIB) $(LAPACKLIB) $(BLASLIB)

#
# compilers and the compiler options 
#
F77 = mpif90
CC = mpicc
NOOPT =
F77FLAGS = -O3 $(NOOPT)
CCFLAGS = -O4
SRCFLAG =
F77LOADER = $(F77)
CCLOADER = $(CC)
F77LOADFLAGS =
CCLOADFLAGS =
CDEFS = -DAdd_ -DNO_IEEE -DUsingMpiBlacs


#
# build the program
# 
dmatgen = pdmatgen.o pmatgeninc.o
dlinchk = pdlaschk.o pdlafchk.o
dlu = pdludriver.o pdluinfo.o pdgetrrv.o $(dmatgen) $(dlinchk)
dluexe = xdlu

$(dluexe): $(SCALAPACKLIB) $(dlu)
    $(F77LOADER) $(F77LOADFLAGS) -o $(dluexe) $(dlu) $(LIBS)
    $(MAKE) LU.dat

default: $(dluexe)

$(dluexe): $(FRC)

FRC:
    @FRC=$(FRC)
clean: 
    rm -f *.o

check: $(dluexe)
    mpirun -np 4 ./$(dluexe) > LU.out

.f.o : ; $(F77) -c $(F77FLAGS) $*.f

pdludriver.o: pdludriver.f
    $(F77) $(DRVOPTS) -c $<

All the code referenced in the above can be found in the scalapack distribution. Some things to note, please use the same fortran compiler that was used to build scalapack or you will get weird compiler errors.

Bookmark and Share