PETSC headers

Satish Balay balay at mcs.anl.gov
Sat Feb 18 11:19:46 CST 2006


PETSc is installed with MPI, LAPACK - and can be installed with PARMETIS
[which has metis.a].  So there is no reason to have a non-petsc
makefile.

And you can't use a different MPI than what PETSc is installed with.

The simplest makefile would be:

--------------------------------------
CFLAGS           =
FFLAGS           =
CPPFLAGS         =
FPPFLAGS         =
CLEANFILES       =

include ${PETSC_DIR}/bmake/common/base

ex1: ex1.o  chkopts
	-${CLINKER} -o ex1 ex1.o  ${PETSC_LIB}
	${RM} ex1.o
--------------------------------------

Where 

CLEANFILES - is additonal files you want to get deleted with 'make clean'
CPPFLAGS, FPPFLAGS are additional user required preprocessor flags [for eg -DFOOBAR]
CFLAGS,FFLAGS are additional user required compiler flags [perhaps like -r8]

If you wish to just use PETSc as installed [without parmetis] - and
'metis' required by your code, use:

--------------------------------------
SOURCE_DIR = ???
METIS_INC  = -I$(SOURCE_DIR)/metis/include
METIS_LIB  = $(METIS_DIR)/libmetis.a
EXECUTABLE = examples/ex
SOURCE_OBJ = ex1.o

CFLAGS           = 
FFLAGS           =
CPPFLAGS         = $(METIS_INC)
FPPFLAGS         =
CLEANFILES       = $(EXECUTABLE)

include ${PETSC_DIR}/bmake/common/base

all: $(SOURCE_OBJ)  chkopts
	-${CLINKER} -o $(EXECUTABLE) $(SOURCE_OBJ) $(METIS_LIB)  ${PETSC_LIB}

--------------------------------------


Satish

On Sat, 18 Feb 2006, billy at dem.uminho.pt wrote:

> 
> 
> No, the examples are working OK. I compiled
> petsc/src/snes/examples/tutorials/ex10d/ex10.c and there is no problem.
> 
> I must be doing something wrong in my makefile.
> 
> # METIS
> METIS_DIR = $(SOURCE_DIR)/metis
> METIS_LIB = $(METIS_DIR)/libmetis.a
> 
> # Multiple processor - MPICH
> ifeq ($(MPI_VERSION), MPICH)
>   MPI_LIB = -L$(HOME)/MPICH/mpich-1.2.7/lib
>   MPI_INC = -I$(HOME)/MPICH/mpich-1.2.7/include
>   CFLAGS = -I$(SOURCE_DIR) -I$(LASPACK_DIR) $(MPI_INC) $(MPI_LIB)
> $(PETSC_INCLUDE) $(PETSC_LIB) -lm
>   CC = $(CLINKER)
> endif
> 
> # Multiple processor - LAM
> ifeq ($(MPI_VERSION), LAM)
>   MPI_LIB = -L$(HOME)/LAMMPI/lam-7.1.1/linux/lib
>   MPI_INC = -I$(HOME)/LAMMPI/lam-7.1.1/linux/include
>   CFLAGS = -I$(SOURCE_DIR) -I$(LASPACK_DIR) $(MPI_INC) $(MPI_LIB)
> $(PETSC_INCLUDE) $(PETSC_LIB) -lm -lmpi
>   CC = $(CLINKER)
> endif
> 
> # PETSC
> include ${PETSC_DIR}/bmake/common/base
> 
> EXECUTABLE = examples/ex
> 
> all: $(SOURCE_OBJ) $(LASPACK_OBJ)
> 
> ifeq ($(MPI_VERSION),LAM)
> 	@echo ""
> 	@echo "***** Building with LAM option *****"
> 	@echo ""
> endif
> 
> ifeq ($(MPI_VERSION),MPICH)
> 	@echo ""
> 	@echo "***** Building with MPICH option *****"
> 	@echo ""
> endif
> 
> 	$(CC) $(SOURCE_OBJ) $(METIS_LIB) $(PETSC_LIB) -o $(EXECUTABLE)
> 




More information about the petsc-users mailing list