[petsc-users] A compilation error about VecGetValues
Barry Smith
bsmith at petsc.dev
Mon May 23 09:14:07 CDT 2022
Was PETSc ./configure with --download-hypre ? Send configure.log make.log and the full error message if you still have this failure.
> On May 23, 2022, at 9:35 AM, wang yuqi <yu1299885905 at outlook.com> wrote:
>
> Thank you very much. The problem has been solved. But I have a new problem, when I use the PCHYPRESetType as follows:
> call PCHYPRESetType(pc,'boomeramg',ierr)
> The problem occurs at compile time:
>
> undefined reference to `pchypresettype_'
>
> I checked the PETSC manual, but couldn't find a reason.
> I look forward to hearing from you.
> Thanks again!
> 从 Windows 版邮件 <https://go.microsoft.com/fwlink/?LinkId=550986>发送
>
> 发件人: Barry Smith <mailto:bsmith at petsc.dev>
> 发送时间: 2022年5月23日 0:44
> 收件人: wang yuqi <mailto:yu1299885905 at outlook.com>
> 抄送: petsc-users at mcs.anl.gov <mailto:petsc-users at mcs.anl.gov>
> 主题: Re: [petsc-users] A compilation error about VecGetValues
>
>
> This should work for at least the last three versions of PETSc. Please upgrade to the latest PETSc version and let us know if you continue to get this error message.
>
> Yes, for some PETSc versions between 3.8 and 3.14 it may generate this error message with some Fortran compilers.
>
> Barry
>
>
>
>
> On May 21, 2022, at 9:23 AM, wang yuqi <yu1299885905 at outlook.com <mailto:yu1299885905 at outlook.com>> wrote:
>
>
>
> 从 Windows 版邮件 <https://go.microsoft.com/fwlink/?LinkId=550986>发送
> Hi, Dear developer:
> I had compilation problems when using VecGetValues. My procedure is as follows:
> program main
> #include <petsc/finclude/petscvec.h>
> use petscvec
> Vec x
> PetscInt N,i,ione
> PetscErrorCode ierr
> PetscMPIInt rank
> PetscScalar one
>
> call PetscInitialize(PETSC_NULL_CHARACTER,ierr)
> if (ierr .ne. 0) then
> print*,'PetscInitialize failed'
> stop
> endif
> one = 1.0
> call MPI_Comm_rank(PETSC_COMM_WORLD,rank,ierr)
> N = rank + 1
> call VecCreateMPI(PETSC_COMM_WORLD,N,PETSC_DECIDE,x,ierr)
> call VecGetSize(x,N,ierr)
> call VecSet(x,one,ierr)
> ione = 1
> do 100 i=0,N-rank-1
> call VecSetValues(x,ione,i,one,ADD_VALUES,ierr)
> 100 continue
> call VecAssemblyBegin(x,ierr)
> call VecAssemblyEnd(x,ierr)
>
> if (rank .eq. 0) then
> ione = 0
> call VecGetValues(x,ione,i,one,ierr)
> endif
> call VecView(x,PETSC_VIEWER_STDOUT_WORLD,ierr)
> call VecDestroy(x,ierr)
>
> call PetscFinalize(ierr)
> end PROGRAM main
>
> The compilation error is as follows:
> mpif90 -I/root/soft/petsc/3.8.0/include -o ex2f.o ex2f.F90
> ex2f.F90(62): error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic. [C]
> call VecGetValues(x,ione,i,one,ierr)
> -------------^
> ex2f.F90(62): error #8284: If the actual argument is scalar, the dummy argument shall be scalar unless the actual argument is of type character or is an element of an array that is not assumed shape, pointer, or polymorphic. [D]
> call VecGetValues(x,ione,i,one,ierr)
> -------------^
> compilation aborted for ex2f.F90 (code 1)
> And this error only appears when the Petsc version is higher than 3.8.
> I look forward to hearing from you.
> Thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20220523/9881e4ba/attachment-0001.html>
More information about the petsc-users
mailing list