Programming in *.f90 free format with PETSc

Satish Balay balay at mcs.anl.gov
Fri Aug 10 00:32:12 CDT 2007


For now, you can try the following alternative: remove the !MS and
!DEC lines from mpif.h

> >      COMMON /MPIPRIV/ MPI_BOTTOM,MPI_STATUS_IGNORE,MPI_STATUSES_IGNORE

I think this should be ok - as long as you don't use the above MPI
flags in your code.

Satish

On Fri, 10 Aug 2007, Satish Balay wrote:

> Sorry - I don't know enough about these f90 intricacies with 
> 'DEC$ ATTRIBUTES DLLIMPORT'
> 
> Looks like you can't include mpif.h inside a module-subroutine.
> 
> I'll have to check up on this tomorrow.
> 
> Satish
> 
> On Fri, 10 Aug 2007, Ben Tay wrote:
> 
> > Thank you Satish. I followed what you recommended exactly and used
> > 
> > sed -e 's/^C/\!/g'
> > 
> > With the new mpif.h, I got the following error:
> > 
> > global.i90
> > d:\cygwin\codes\MPICH\SDK\include\mpif.h(174) : Error: DEC$ ATTRIBUTES
> > DLLIMPORT attribute can appear only in an interface-body.   [MPIPRIV]
> > !DEC$ ATTRIBUTES DLLIMPORT :: /MPIPRIV/
> > 
> > It points to this error in mpif.h
> > 
> > ! Intel compiler import specification
> > !MS$ATTRIBUTES DLLIMPORT :: /MPIPRIV/
> > ! Visual Fortran import specification
> > !DEC$ ATTRIBUTES DLLIMPORT :: /MPIPRIV/            -   in here
> >      COMMON /MPIPRIV/ MPI_BOTTOM,MPI_STATUS_IGNORE,MPI_STATUSES_IGNORE
> >      PARAMETER (MPI_MAX=100,MPI_MIN=101,MPI_SUM=102,MPI_PROD=103)
> >      PARAMETER (MPI_LAND=104,MPI_BAND=105,MPI_LOR=106,MPI_BOR=107)
> > 
> > Hope you can help again. Thank you very much.
> > 
> > 
> > Satish Balay wrote:
> > > On Fri, 10 Aug 2007, Ben Tay wrote:
> > > 
> > >   
> > > > The strange thing is when I try to compile on my windows's visual
> > > > fortran, it gives lots of error. The errors all point to mpif.h. Some
> > > > errors
> > > > are:
> > > > 
> > > > d:\cygwin\codes\MPICH\SDK\include\mpif.h(1) : Error: Syntax error, found
> > > > END-OF-STATEMENT when expecting one of: ( : % . = =>
> > > > C
> > > > -^
> > > > d:\cygwin\codes\MPICH\SDK\include\mpif.h(2) : Error: Syntax error, found
> > > > END-OF-STATEMENT when expecting one of: ( : % . = =>
> > > > C
> > > > -^
> > > > d:\cygwin\codes\MPICH\SDK\include\mpif.h(3) : Error: Syntax error, found
> > > > INTEGER_CONSTANT '1993' when expecting one of: ( % . = =>
> > > > C  (C) 1993 by Argonne National Laboratory and Mississipi State
> > > > University.
> > > > -------^
> > > >     
> > > 
> > > Some f90/free-form compilers don't like 'C' for comments. They need
> > > '!' in the first columns.
> > > 
> > > To fix this - you'll have to follow instructions from mpif.h
> > > 
> > >   
> > > C It really is not possible to make a perfect include file that can
> > > C be used by both F77 and F90 compilers, but this is close.  We have removed
> > > C continuation lines (allows free form input in F90); systems whose
> > > C Fortran compilers support ! instead of just C or * for comments can
> > > C globally replace a C in the first column with !; the resulting file
> > > C should work for both Fortran 77 and Fortran 90.
> > > C
> > > C If your Fortran compiler supports ! for comments, you can run this C
> > > through sed with
> > > C     sed -e 's/^C/\!/g'
> > > 
> > > <<<<<<<<<<<<
> > > 
> > > Satish
> > > 
> > > 
> > >   
> > 
> > 
> 
> 




More information about the petsc-users mailing list