Hi Satish,
I'm attaching the file to this e-mail.
Thanks,
-Aaron
Attachment:
__unsteady_ex.F
Description: Binary data
On Mar 3, 2007, at 11:29 AM, Satish Balay wrote:
Can you send us the preprocessed __unsteady_ex.F file?
Satish
On Sat, 3 Mar 2007, P. Aaron Lott wrote:
Hi Satish,
You're right the problem is from mpif90, I tried
mpif90 -qfree -c -I. -g __unsteady_ex.F -o unsteady_ex.o
but I'm getting the same error messages. The file unsteady_ex compiled fine
before using petsc and the preprocessor, so I really don't know what the
problem could be.
Any ideas?
-Aaron
On Mar 2, 2007, at 12:16 PM, Satish Balay wrote:
/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. <<<
The error is from mpif90 - not the preprocessor. Maybe its interpreting
the code as fixed form? Try adding '-qfree' to FFLAGS and see if it makes
a difference.
Satish
On Fri, 2 Mar 2007, P. Aaron Lott wrote:
Thanks Satish,
I checked the __unsteady_ex.F file. The preprocessor doesn't seem to like
any
of my fortran code. It starts complaining about the use of the use
statements,
and basically all the lines of code in this file.
Any ideas?
-Aaron
Here are some of the statements the preprocessor complains about:
use initialize use coordinates use maps use boundaries use elements use buildU use matrix_ops use output use d1ops use globaldata use dss use par_dss use forces use winds use stokes_solvers
implicit none
integer n,i,j real(kind=8) dt,gam integer nsteps type(coord) coords type(coord) proc_coords type(solution) GUXY,LUXY real(kind=8),allocatable, dimension(:):: force,wind integer nelements integer nely,nelx integer twod integer nglobaldofs integer irc,myrank,nprocs, ierr, status(MPI_STATUS_SIZE)
call mpi_init(ierr) ! Get myrank call mpi_comm_rank(MPI_COMM_WORLD,myrank,ierr) call mpi_comm_size(MPI_COMM_WORLD,nprocs,ierr)
call PetscInitialize( PETSC_NULL_CHARACTER, ierr ) call MPI_Comm_rank( PETSC_COMM_WORLD, myrank, ierr ) if (myrank .eq. 0) then print *, ?Hello World? endif call PetscFinalize(ierr)
stop
On Mar 2, 2007, at 11:38 AM, Satish Balay wrote:
On Fri, 2 Mar 2007, P. Aaron Lott wrote:
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.
The line numbers refer to the temoprary file created - __unsteady_ex.F
You can run the following command to preserve the temporary file - and
check it for the correct line number
make unsteady_ex SKIP_RM=yes
Preprocessing fortran code with C compiler can have some false positives. For eg: if you have quotes in comments - then cpp can misbehave.
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
These don't need to be specified as PETSc .F.o targets don't use them..
[and
you don't want to redefine whats already configured inside PETSc]
F77FLAGS= -C -g -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework -Wl,vecLib
This variable is not used by PETSc target
FLAGS= -C -g -qdpc -qautodbl=dbl4 -qinitauto -Wl,-framework -Wl,vecLib
PETSc should already use a blas implementation - so no need to specify
vecLib again.
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)
No need to specify FLAGS here - as the default targets pick it up [in
this
case
the flags get added to FLINKER
Satish
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@xxxxxxxxxxxx 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@xxxxxxxxxxxx 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@xxxxxxxxxxxx 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@xxxxxxxxxxxx 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@xxxxxxxxxxxx http://www.lcv.umd.edu/~palott Office: 301.405.4894 Fax: 301.314.0827