It looks like a Fortran formatting error. Notice all the other "call" statements are in the 7th column (after the normally restricted 6 columns for f77 syntax). Matching that format or using "-ffree-form" in your Fortran flags should fix that problem.<br>
<br>Regards,<br>Jeremy<br><br><div class="gmail_quote">On Fri, Oct 8, 2010 at 10:38 PM, Peter Wang <span dir="ltr"><<a href="mailto:pengxwang@hotmail.com">pengxwang@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div>
Sorry for forgetting the subject in previous email. <br> <br>
<br>
I am trying to modify the example code in {PETSc_Dir}\src\vec\vec\examples\tests\ex19f.F . Only three lines are added into the original code. However, if the three lines are added, there is error coming out when it is compiled. Why it cannot be compiled when the lines are added? I am using gfortran 4.4.3 and openMPI 1.3.2 and petsc 3.1-p5-v1. The error infomation is as following:<br>
*********************************************************<br> <br> <br>ex19f.F:29.5:<br> call MPI_COMM_RANK(MPI_COMM_WORLD,myid,rc)<br> 1<br>Error: Non-numeric character in statement label at (1)<br>ex19f.F:29.5:<br>
call MPI_COMM_RANK(MPI_COMM_WORLD,myid,rc)<br> 1<br>Error: Unclassifiable statement at (1)<br>ex19f.F:30.5:<br> call MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,rc)<br> 1<br>Error: Non-numeric character in statement label at (1)<br>
ex19f.F:30.5:<br> call MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,rc)<br> 1<br>Error: Unclassifiable statement at (1)<br>make: *** [ex19f.o] Error 1<br><br>*********************************************************<br>Following is the code I modified. The lines followed by !***************Added for MPI are added by me for MPI subroutine.<br>
*********************************************************<br>!<br>!<br> program main<br>! include 'mpif.h'<br>#include "finclude/petscsys.h"<br>#include "finclude/petscvec.h"<br>!<br>! This example demonstrates basic use of the PETSc Fortran interface<br>
! to vectors.<br>!<br> <br> integer myid,numprocs,namelen,rc !***************Added for MPI<br> PetscInt n<br> PetscErrorCode ierr<br> PetscTruth flg<br> PetscScalar one,two,three,dot<br>
PetscReal norm,rdot<br> Vec x,y,w<br> <br> n = 20<br> one = 1.0<br> two = 2.0<br> three = 3.0<br> call PetscInitialize(PETSC_NULL_CHARACTER,ierr) <br>
call PetscOptionsGetInt(PETSC_NULL_CHARACTER,'-n',n,flg,ierr)<br> <br> call MPI_COMM_RANK(MPI_COMM_WORLD,myid,rc) !***************Added for MPI<br> call MPI_COMM_SIZE(MPI_COMM_WORLD,numprocs,rc) !***************Added for MPI<br>
<br> <br><br>! Create a vector, then duplicate it<br> call VecCreate(PETSC_COMM_WORLD,x,ierr)<br> call VecSetSizes(x,PETSC_DECIDE,n,ierr)<br> call VecSetFromOptions(x,ierr)<br> call VecDuplicate(x,y,ierr)<br>
call VecDuplicate(x,w,ierr)<br> call VecSet(x,one,ierr)<br> call VecSet(y,two,ierr)<br> call VecDot(x,y,dot,ierr)<br> rdot = PetscRealPart(dot)<br> write(6,100) rdot<br> 100 format('Result of inner product ',f10.4)<br>
call VecScale(x,two,ierr)<br> call VecNorm(x,NORM_2,norm,ierr)<br> write(6,110) norm<br> 110 format('Result of scaling ',f10.4)<br> call VecCopy(x,w,ierr)<br> call VecNorm(w,NORM_2,norm,ierr)<br>
write(6,120) norm<br> 120 format('Result of copy ',f10.4)<br> call VecAXPY(y,three,x,ierr)<br> call VecNorm(y,NORM_2,norm,ierr)<br> write(6,130) norm<br> 130 format('Result of axpy ',f10.4)<br>
call VecDestroy(x,ierr)<br> call VecDestroy(y,ierr)<br> call VecDestroy(w,ierr)<br> call PetscFinalize(ierr)<br> end<br><br>                                            </div>
</blockquote></div><br>