need help with makefile
P. Aaron Lott
palott at ipst.umd.edu
Fri Mar 2 10:29:30 CST 2007
Thanks for this information. I think I setup things almost right, but
something is causing preprocessor to complain. The errors it is
giving are referring to lines of my main program file that doesn't
exist.
I would appreciate any recommendations about how to fix this problem.
I've list some of the details of my setup below.
Thanks,
-Aaron
e.g.
macbeth% make unsteady_ex
/usr/local/mpich-1.2.5.2/bin/mpicc -I/Users/palott/research/codes/
petsc/petsc-2.3.2-p8 -I/Users/palott/research/codes/pets
c/petsc-2.3.2-p8/bmake/darwin-mpich-g -I/Users/palott/research/codes/
petsc/petsc-2.3.2-p8/include -I/usr/local/mpich-1.2.
5.2/include -E -traditional-cpp __unsteady_ex.c | /usr/bin/
grep -v '^ *#' > __unsteady_ex.F
/usr/local/mpich-1.2.5.2/bin/mpif90 -c -I. -g __unsteady_ex.F -o
unsteady_ex.o
"__unsteady_ex.F", line 965.2: 1515-019 (S) Syntax is incorrect.
But there are only 207 lines in this file.....
In my current makefile I have
F90=mpif90
F77=mpif77
F77FLAGS= -C -g -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework -
Wl,vecLib
FLAGS= -C -g -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework -Wl,vecLib
EXENAME = unsteady_ex
CMD:=EXENAME
SOBJS = mpi.o quicksort.o routines.o binsort.o coordinates.o
comm_maps.o elements.o globaldata.o sem.o comp_inv.o d1ops.o maps.o
pardss.o dss.o stiffness.o convection.o Mass.o pressure.o buildU.o
wind.o forcing.o boundary_cond.o navier_stokes.o runge_kutta.o
out.o gmres.o pcg.o stream.o uzawa.o print_matrices.o projection.o
bdf.o stokes_solvers.o initialize_mpi.o unsteady_ex.o
$(CMD) : $(SOBJS)
-${FLINKER} $(FLAGS) -o $(EXENAME) $(SOBJS) $(PETSC_SYS_LIB)
mpi.o : ../Comm/mpi.f90 ;$(F90) $(FLAGS) -c ../Comm/mpi.f90
gmres.o : ../Solvers/gmres.f90 ;$(F90) $(FLAGS) -c ../Solvers/
gmres.f90
etc.... for all the object files except unsteady_ex.o
unsteady_ex.F is my main program.
In the example you gave, ex1f.F would be the main program, and at the
top of the file it would have the statement:
#include "include/finclude/petsc.h"
So in my case, I've put that in the top of my unsteady_ex.F
On Mar 1, 2007, at 5:56 PM, Satish Balay wrote:
> The idea is to use a PETSc example makefile - and modify it
> appropriately.
>
> And with fortran codes - we require preprocessing [i.e source files
> that call PETSc routines should be .F]
>
> A minimal PETSc makefile is as follows:
> ------------------------------------------------
> CFLAGS =
> FFLAGS =
> CPPFLAGS =
> FPPFLAGS =
> CLEANFILES =
>
> include ${PETSC_DIR}/bmake/common/base
>
> ex1f: ex1f.o chkopts
> -${FLINKER} -o ex1f ex1f.o ${PETSC_KSP_LIB}
> ${RM} ex1f.o
> -----------------------------------------------------
>
> So you'll just make the change [with the variables CMD and SOBJS
> properly defined]
>
> ex1f -> $(CMD)
> ex1f.o -> $(SOBJS)
>
> Note: Necessary FFLAGS should already be PETSc config files. Some
> additional flags can be specified with FFLAGS variable
>
> Satish
>
>
> On Thu, 1 Mar 2007, P. Aaron Lott wrote:
>
>>
>>
>> Hi,
>>
>> I have a fortran90 code and I would like to use petsc's
>> preconditioners
>> inside of it. I'm having trouble setting up a makefile that will
>> allow me
>> include a petsc. It seems the problem is from the use of the c-
>> preprocessor.
>>
>> My old makefile looked something like this:
>>
>> $(CMD) : $(SOBJS)
>> $(F90) $(FLAGS) -o $(EXENAME) $(SOBJS)
>>
>> where SOBJ is a list of all of my object files.
>>
>> I was hoping to be able to make a petsc object file and include it
>> in this
>> list. Is this possible? Is there a tutorial on how to get petsc
>> setup inside
>> of your existing code?
>>
>> Thanks,
>>
>> -Aaron
>>
>>
>>
>> P. Aaron Lott
>> Ph.D. Candidate
>> 4239 Computer and Space Sciences Building
>> University of Maryland
>> College Park, MD 20742-4015
>>
>> palott at ipst.umd.edu
>> http://www.lcv.umd.edu/~palott
>> Office: 301.405.4894
>> Fax: 301.314.0827
>>
>>
>
P. Aaron Lott
Ph.D. Candidate
4239 Computer and Space Sciences Building
University of Maryland
College Park, MD 20742-4015
palott at ipst.umd.edu
http://www.lcv.umd.edu/~palott
Office: 301.405.4894
Fax: 301.314.0827
More information about the petsc-users
mailing list