Hi Satish,
I am sorry if I have made you angry. I may have missed out some important
points which you tried to highlight. I was converting several of my .F fixed
format files to .f90 (or .F90) free format and some files which don't need
declaration of PETSc type variable worked while some don't.
However, I must clarify that the .f90 or .F90 did not bother me after a while
since in visual fortran or ifort, using the option -fpp enables the .f90 files
to be preprocessed too. Of course, if .F90 was used, -fpp is not required.
In my sample file shown just now, I did not have any include statments in my
subroutine. They're only present in the module 's section. Checking your prev.
email, you indeed mention that the PETSc includes files must be in each and
every subroutine. However, doing this gave me more errors. Hence, I've
followed another user (Paul T Bauman) 's recommendation which states that only
preprocessed statements not inside the module needs to be placed inside the
subroutine. With this, I only has 3 errors, which concerns PETSC_COMM_SELF,
PETSC_NULL_INTEGER and PETSC_NULL_CHARACTER not having an explicit type. I
figured out that using:
MPI_Comm PETSC_COMM_SELF
will eliminate 1 error, although it was not required before. However, what
about the other 2? Should I defined them as integer or character and give them
a value using parameter? What value should I give them? You mention this in
your prev email:
integer NORM_MAX
parameter NORM_MAX=3
You also give a template to follow. I also tried to cut and paste and use it
but it gave lots of error. I had used it in visual fortran :
#define PETSC_AVOID_DECLARATIONS
#include "include/finclude/petsc.h"
#include "include/finclude/petscvec.h"
#undef PETSC_AVOID_DECLARATIONS
module foobar
Vec abc
contains
subroutine xyz()
use foobar
implicit none
#include "include/finclude/petsc.h"
#include "include/finclude/petscvec.h"
#include "include/finclude/petscvec.h90"
Vec fbar
end subroutine
end module
As said above, upon removing the include files in the subroutine and the "use
foobar" statement, everything's ok. You can give it a try too.
Lastly, I understand that you have been helping a lot of users and there's
really a lot of stupid users around (I know I'm one of them ;-) ). Thank you
for your patience.
Satish Balay wrote:
On Thu, 9 Aug 2007, Ben Tay wrote:
Hi,
Guess I'm too used to typing .f90 ;-) .... I've changed it to .F90 before
but
perhaps at that time the error I got didn't disappear so I didn't bother
after
that.
I'm sorry - but you can't keep silently discarding the sugestions we
make and keep reporting the same issues multiple times..
This is frustrating.
I'm working in windows so I thought the capital letter doesn't really
matter.
I've indicated this before. Most compilers use .F90 for prerpocessed
free form. And you keep indicating this is what you require. [Most
compilers don't preprocess .f90 files]
Moreover, .f90 also works with my ifort in linux. Is it really
important? If so, I'll change all my .f90 to F90. Thanks for highlighting.
Here's a sample code test.F90:
I'll need a test code that can reproduce the problems you report.
module global_data
implicit none
save
#define PETSC_AVOID_DECLARATIONS
#include "include/finclude/petsc.h"
#include "include/finclude/petscvec.h"
#include "include/finclude/petscmat.h"
#include "include/finclude/petscksp.h"
#include "include/finclude/petscpc.h"
#undef PETSC_AVOID_DECLARATIONS
integer :: size_x,size_y
Mat A_mat ! /* sparse matrix */
!MPI_Comm PETSC_COMM_SELF - commented out will result in error
contains
subroutine allo_var
Again you are ignoring the sample template I sent you. You need to
include PETSc include files in every subroutine.
I'm sorry I can't repeat this anymore.
Satish
!allocate memory for variables
integer :: status(2),ierr,k
size_x=10;size_y=10
call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
call
MatCreateSeqAIJ(PETSC_COMM_SELF,size_x*size_y,size_x*size_y,13,PETSC_NULL_INTEGER,A_mat,ierr)
end subroutine allo_var
end module global_data
I got "Error: This name does not have a type, and must have an explicit
type.
[PETSC_NULL_CHARACTER]". Same for PETSC_NULL_INTEGER and PETSC_COMM_SELF.
It was ok when I'm programming in fixed format.
Thanks
Satish Balay wrote:
On Thu, 9 Aug 2007, Ben Tay wrote:
Hi,
when I changed my global.F to global.f90,
Any perticular reason why you keep using .f90 suffix even though I've
recommended using .F90 suffix [for preprocessed free form] a few
times?
I was told that PETSC_COMM_SELF, PETSC_NULL_INTEGER and
PETSC_NULL_CHARACTER does not have a type.
Please send a test code that demonstrates this problem.
Satish