Hi, So when must I use PetscScalar, and when can I just use real(8)? This is because most of my variables are in real(8), except for the Mat, Vec, required in the solving of the linear eqn. Is there a rule? I initially thought they are the same and if I remember correctly, it seems to work fine in PETSc2.3.3.
My v_ast is now defined as: PetscScalar, allocatable :: u_ast(:,:), v_ast(:,:) allocate (u_ast(0:size_x+1,jsta_ext:jend_ext), STAT=status(1));allocate (v_ast(0:size_x+1,jsta_ext:jend_ext), STAT=status(2)) if (status(1)/=0 .or. status(2)/=0) STOP "Cannot allocate memory" Thank you very much and have a nice day! Yours sincerely, Wee-Beng Tay Satish Balay wrote: > And if v_ast() is used with PETSc - then it should be defined 'PetscScalar' > > and then you use MPI_ISEND(....,MPIU_SCALAR,...) > > Satish > > > On Mon, 13 Apr 2009, Barry Smith wrote: > > >> Where is your implicit none that all sane programmers begin their Fortran >> subroutines with? >> >> >> On Apr 13, 2009, at 11:11 AM, Wee-Beng TAY wrote: >> >> >>> Hi Satish, >>> >>> Compiling and building now worked without error. However, when I run, I get >>> the error: >>> >>> 0 - MPI_ISEND : Datatype is MPI_TYPE_NULL >>> [0] Aborting program ! >>> [0] Aborting program! >>> Error 323, process 0, host GOTCHAMA-E73BB3: >>> >>> The problem lies in this subroutine: >>> >>> subroutine v_ast_row_copy >>> >>> #include "finclude/petsc.h" >>> #include "finclude/petscvec.h" >>> #include "finclude/petscmat.h" >>> #include "finclude/petscksp.h" >>> #include "finclude/petscpc.h" >>> #include "finclude/petscsys.h" >>> >>> !to copy data of jend row to others >>> >>> integer :: inext,iprev,istatus(MPI_STATUS_SIZE),irecv1,ierr,isend1 >>> >>> inext = myid + 1 >>> iprev = myid - 1 >>> >>> if (myid == num_procs - 1) inext = MPI_PROC_NULL >>> >>> if (myid == 0) iprev = MPI_PROC_NULL >>> >>> CALL >>> MPI_ISEND(v_ast(1,jend),size_x,MPI_REAL8,inext,1,MPI_COMM_WORLD,isend1,ierr) >>> CALL >>> MPI_IRECV(v_ast(1,jsta-1),size_x,MPI_REAL8,iprev,1,MPI_COMM_WORLD,irecv1,ierr) >>> CALL MPI_WAIT(isend1, istatus, ierr) >>> CALL MPI_WAIT(irecv1, istatus, ierr) >>> >>> end subroutine v_ast_row_copy >>> >>> >>> I copied this subroutine from the RS6000 mpi manual and it used to work. I >>> wonder if this is a MPI or PETSc problem? Strange because I already specify >>> the type to be MPI_REAL8. However changing to MPI_REAL solves the problem. >>> >>> If this is a MPI problem, then you can just ignore it. I'll check it in some >>> MPI forum. >>> >>> >>> Thank you very much and have a nice day! >>> >>> Yours sincerely, >>> >>> Wee-Beng Tay >>> >>> >>> >>> Satish Balay wrote: >>> >>>> Yes - all includes statements in both the sourcefiles should start >>>> with "finclude/..." [so that -Id:\cygwin\codes\petsc-3.0.0-p4 is not >>>> needed] >>>> >>>> And where you needed PETSC_AVOID_DECLARATIONS - you need to use the >>>> 'def.h' equivelent includes.. The def.h files have only the >>>> declarations [so the PETSC_AVOID_DECLARATIONS flag is no longer >>>> needed/used]. You need only the definitions in the datasection of >>>> 'module flux_area'. [All subroutines should use the regular includes] >>>> >>>> Satish >>>> >>>> >>>> On Mon, 13 Apr 2009, Wee-Beng TAY wrote: >>>> >>>> >>>> >>>>> Hi Satish, >>>>> >>>>> I now used >>>>> >>>>> #include "finclude/petsc.h" >>>>> #include "finclude/petscvec.h" >>>>> #include "finclude/petscmat.h" >>>>> #include "finclude/petscksp.h" >>>>> #include "finclude/petscpc.h" >>>>> #include "finclude/petscsys.h" >>>>> >>>>> for global.F and >>>>> >>>>> #include "finclude/petscdef.h" >>>>> #include "finclude/petscvecdef.h" >>>>> #include "finclude/petscmatdef.h" >>>>> #include "finclude/petsckspdef.h" >>>>> #include "finclude/petscpcdef.h" >>>>> >>>>> for flux_area.f90 and it's working now. Can you explain what's >>>>> happening? Is >>>>> this the correct way then? >>>>> >>>>> Thank you very much and have a nice day! >>>>> >>>>> Yours sincerely, >>>>> >>>>> Wee-Beng Tay >>>>> >>>>> >>>>> >>>>> Satish Balay wrote: >>>>> >>>>> >>>>>> 2 changes you have to make for 3.0.0 >>>>>> >>>>>> 1. "include/finclude.. -> "finclude..." >>>>>> >>>>>> 2. PETSC_AVOID_DECLARATIONS should be removed - and use petscdef.h >>>>>> equivalnet files. >>>>>> i.e >>>>>> >>>>>> change: >>>>>> #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 >>>>>> >>>>>> to: >>>>>> #include "finclude/petscdef.h" >>>>>> #include "finclude/petscvecdef.h" >>>>>> #include "finclude/petscmatdef.h" >>>>>> #include "finclude/petsckspdef.h" >>>>>> #include "finclude/petscpcdef.h" >>>>>> >>>>>> Satish >>>>>> >>>>>> On Sun, 12 Apr 2009, Wee-Beng TAY wrote: >>>>>> >>>>>> >>>>>> >>>>>>> Hi Satish, >>>>>>> >>>>>>> I am now using the PETSc ex2f example. I tried "make ex2f" and >>>>>>> manage to >>>>>>> build >>>>>>> and run the file. Then I used the options as a reference for my >>>>>>> visual >>>>>>> fortran >>>>>>> and it worked. >>>>>>> >>>>>>> The options are: >>>>>>> >>>>>>> /compile_only /debug:full /include:"Debug/" >>>>>>> /include:"d:\cygwin\codes\petsc-3.0.0-p4\win32_mpi_debug\include" >>>>>>> /include:"d:\cygwin\codes\petsc-3.0.0-p4\include" >>>>>>> /include:"E:\cygwin\codes\MPICH\SDK\include" /nologo /threads >>>>>>> /warn:nofileopt >>>>>>> /module:"Debug/" /object:"Debug/" /pdbfile:"Debug/DF60.PDB" >>>>>>> /fpp:"/m" >>>>>>> >>>>>>> and >>>>>>> >>>>>>> ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib >>>>>>> comdlg32.lib >>>>>>> advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib >>>>>>> odbccp32.lib libpetscts.lib libpetscsnes.lib libpetscksp.lib >>>>>>> libpetscdm.lib >>>>>>> libpetscmat.lib libpetscvec.lib libpetsc.lib mpich.lib libfblas.lib >>>>>>> libflapack.lib /nologo /subsystem:console /incremental:yes >>>>>>> /pdb:"Debug/ex2f.pdb" /debug /machine:I386 /out:"Debug/ex2f.exe" >>>>>>> /pdbtype:sept >>>>>>> /libpath:"d:\cygwin\codes\petsc-3.0.0-p4\win32_mpi_debug\lib" >>>>>>> /libpath:"E:\cygwin\codes\MPICH\SDK\lib" >>>>>>> >>>>>>> Now I add my own file called global.F and tried to compile, using >>>>>>> the same >>>>>>> options.But now it failed. The error is: >>>>>>> >>>>>>> --------------------Configuration: ex2f - Win32 >>>>>>> Debug-------------------- >>>>>>> Compiling Fortran... >>>>>>> ------------------------------------------------------------------------ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F: >>>>>>> 7: #include "include/finclude/petsc.h" >>>>>>> ^ >>>>>>> ** error on line 7 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified >>>>>>> in include directive. >>>>>>> 8: #include "include/finclude/petscvec.h" >>>>>>> ^ >>>>>>> ** error on line 8 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified >>>>>>> in include directive. >>>>>>> 9: #include "include/finclude/petscmat.h" >>>>>>> ^ >>>>>>> ** error on line 9 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified >>>>>>> in include directive. >>>>>>> 10: #include "include/finclude/petscksp.h" >>>>>>> ^ >>>>>>> ** error on line 10 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 11: #include "include/finclude/petscpc.h" >>>>>>> ^ >>>>>>> ** error on line 11 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 12: #include "include/finclude/petscsys.h" >>>>>>> ^ >>>>>>> ** error on line 12 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 97: #include "include/finclude/petsc.h" >>>>>>> ^ >>>>>>> ** error on line 97 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 98: #include "include/finclude/petscvec.h" >>>>>>> ^ >>>>>>> ** error on line 98 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 99: #include "include/finclude/petscmat.h" >>>>>>> ^ >>>>>>> ** error on line 99 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 100: #include "include/finclude/petscksp.h" >>>>>>> ^ >>>>>>> ** error on line 100 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 101: #include "include/finclude/petscpc.h" >>>>>>> ^ >>>>>>> ** error on line 101 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> 102: #include "include/finclude/petscsys.h" >>>>>>> ^ >>>>>>> ** error on line 102 in D:\cygwin\codes\pets: cannot find file >>>>>>> specified in include directive. >>>>>>> global.i >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(65) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found ',' when expecting one of: ( : % . = => >>>>>>> Vec xx,b_rhs,xx_uv,b_rhs_uv >>>>>>> -----------------^ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(67) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found ',' when expecting one of: ( : % . = => >>>>>>> Mat A_mat,A_mat_uv ! /* sparse matrix */ >>>>>>> --------------------^ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(69) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found ',' when expecting one of: ( : % . = => >>>>>>> KSP ksp,ksp_uv !/* linear solver context */ >>>>>>> -----------------^ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(71) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found ',' when expecting one of: ( : % . = => >>>>>>> PC pc,pc_uv >>>>>>> ------------------^ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(73) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found END-OF-STATEMENT when expecting one of: ( : % . >>>>>>> = => >>>>>>> PCType ptype >>>>>>> -------------------------^ >>>>>>> D:\cygwin\codes\petsc-3.0.0-p4\projects\fortran\ksp\ex2f\global.F(75) >>>>>>> : >>>>>>> Error: >>>>>>> Syntax error, found END-OF-STATEMENT when expecting one of: ( : % . >>>>>>> = => >>>>>>> KSPType ksptype.... >>>>>>> >>>>>>> >>>>>>> I can get it to compile if I use : >>>>>>> >>>>>>> Debug/;d:\cygwin\codes\petsc-3.0.0-p4;d:\cygwin\codes\petsc-3.0.0-p4\include;d:\cygwin\codes\petsc-3.0.0-p4\win32_mpi_debug\include;E:\cygwin\codes\MPICH\SDK\include >>>>>>> >>>>>>> Compared to the original one above which is: >>>>>>> >>>>>>> Debug/;d:\cygwin\codes\petsc-3.0.0-p4\win32_mpi_debug\include;d:\cygwin\codes\petsc-3.0.0-p4\include;E:\cygwin\codes\MPICH\SDK\include >>>>>>> >>>>>>> Hence, there is an additional "d:\cygwin\codes\petsc-3.0.0-p4" >>>>>>> >>>>>>> I have attached my global.F. I wonder if this is the cause of the >>>>>>> MPICH >>>>>>> error. >>>>>>> >>>>>>> Currently, I have removed all other f90 files, except for global.F >>>>>>> and >>>>>>> flux_area.f90. It's when I 'm compiling flux_area.f90 that I got the >>>>>>> MPI >>>>>>> error >>>>>>> stated below. I got the same error if I compile under cygwin using >>>>>>> the >>>>>>> same >>>>>>> parameters. >>>>>>> >>>>>>> Hope you can help. >>>>>>> >>>>>>> Thank you very much and have a nice day! >>>>>>> >>>>>>> Yours sincerely, >>>>>>> >>>>>>> Wee-Beng Tay >>>>>>> >>>>>>> >>>>>>> >>>>>>> Satish Balay wrote: >>>>>>> >>>>>>> >>>>>>>> Do you get these errors with PETSc f90 examples? >>>>>>>> >>>>>>>> what 'USE statement' do you have in your code? >>>>>>>> >>>>>>>> I guess you'll have to check your code to see how you are using >>>>>>>> f90 >>>>>>>> modules/includes. >>>>>>>> >>>>>>>> If you can get a minimal compileable code that can reproduce this >>>>>>>> error - send us the code so that we can reproduce the issue >>>>>>>> >>>>>>>> Satish >>>>>>>> >>>>>>>> On Thu, 9 Apr 2009, Wee-Beng TAY wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> I just built petsc-3.0.0-p4 with mpich and after that, I >>>>>>>>> reinstalled >>>>>>>>> my >>>>>>>>> windows xp and installed mpich in the same directory. I'm using >>>>>>>>> CVF >>>>>>>>> >>>>>>>>> Now, I found that when I'm trying to compile my code, I got the >>>>>>>>> error: >>>>>>>>> >>>>>>>>> :\cygwin\codes\MPICH\SDK\include\mpif.h(105) : Error: The >>>>>>>>> attributes >>>>>>>>> of >>>>>>>>> this >>>>>>>>> name conflict with those made accessible by a USE statement. >>>>>>>>> [MPI_STATUS_SIZE] >>>>>>>>> INTEGER MPI_STATUS_IGNORE(MPI_STATUS_SIZE) >>>>>>>>> --------------------------------^ >>>>>>>>> E:\cygwin\codes\MPICH\SDK\include\mpif.h(106) : Error: The >>>>>>>>> attributes >>>>>>>>> of >>>>>>>>> this >>>>>>>>> name conflict with those made accessible by a USE statement. >>>>>>>>> [MPI_STATUS_SIZE] >>>>>>>>> INTEGER MPI_STATUSES_IGNORE(MPI_STATUS_SIZE) >>>>>>>>> ----------------------------------^ >>>>>>>>> E:\cygwin\codes\petsc-3.0.0-p4\include/finclude/petsc.h(154) : >>>>>>>>> Error: >>>>>>>>> The >>>>>>>>> attributes of this name conflict with those made accessible by a >>>>>>>>> USE >>>>>>>>> statement. [MPI_DOUBLE_PRECISION] >>>>>>>>> parameter(MPIU_SCALAR = MPI_DOUBLE_PRECISION) >>>>>>>>> ------------------------------^ >>>>>>>>> Error executing df.exe. >>>>>>>>> >>>>>>>>> flux_area.obj - 3 error(s), 0 warning(s) >>>>>>>>> >>>>>>>>> My include option is : >>>>>>>>> >>>>>>>>> Debug/;$(PETSC_DIR);$(PETSC_DIR)\$(PETSC_ARCH)\;$(PETSC_DIR)\$(PETSC_ARCH)\include;$(PETSC_DIR)\include;E:\cygwin\codes\MPICH\SDK\include >>>>>>>>> >>>>>>>>> >>>>>>>>> Interestingly, when I change my PETSC_DIR to petsc-dev, which >>>>>>>>> correspond >>>>>>>>> to an >>>>>>>>> old build of petsc-2.3.3-p13, there is no problem. >>>>>>>>> >>>>>>>>> May I know what's wrong? Btw, I've converted my mpif.h from >>>>>>>>> using "C" >>>>>>>>> as >>>>>>>>> comments to "!". >>>>>>>>> >>>>>>>>> Thank you very much and have a nice day! >>>>>>>>> >>>>>>>>> Yours sincerely, >>>>>>>>> >>>>>>>>> Wee-Beng Tay >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>> >>>> > > >
