[petsc-users] Errors in running

Barry Smith bsmith at mcs.anl.gov
Fri May 9 14:31:01 CDT 2014


  Always respond to ALL on mailing lists, otherwise you may never get an answer.

  Since xx_v() is a PetscScalar, pointer ::  xx_v(:)   I believe it is best if your myroutine() takes a PetscScalar, pointer ::  xx_v(:) argument, not a real::

  Also by default PetscScalar is a double precision number. If you wish PETSc to use single precision numbers then you must ./configure it with —with-precision=single

  Barry

On May 9, 2014, at 9:23 AM, Antonios Mylonakis <ant_mil at hotmail.com> wrote:

> Thanks for your help.
> 
> So if I understand well I should do sth like this (?):
> 
> myroutine(x)
> real:: x(2)
> 
> ....
> 
> end
> 
> 
> anotherroutine(y)
> vec y
> PetscScalar, pointer ::  xx_v(:)
> 
> call myroutine(y)
> VecGetArrayF90(y,xx_v,ierr)
> edit xx_v
> VecRestoreArray(y,xx_v,ierr)
> ...
> end
> 
> 
> 
>> Subject: Re: [petsc-users] Errors in running
>> From: bsmith at mcs.anl.gov
>> Date: Fri, 9 May 2014 08:00:29 -0500
>> CC: petsc-users at mcs.anl.gov
>> To: ant_mil at hotmail.com
>> 
>> 
>> On May 9, 2014, at 7:29 AM, Antonios Mylonakis <ant_mil at hotmail.com> wrote:
>> 
>>> Dear Sir or Madam
>>> 
>>> I am a new PETSc user. I am using PETSc library with fortran. 
>>> I have the following problem. I want to use the matrix-free form of krylov solvers. So I am starting by using the example ex14f.F.
>>> In this example, within subroutine mymult() I try call another subroutine which calculates the vector I need as the result of the matrix-vector multiplication.In this second subroutine the vector is defined as a simple array. (Is this the problem?) 
>> 
>> A PETSc Vec is NOT a simple array you cannot do something like
>> 
>> myroutine( x)
>> double x(*)
>> ….
>> 
>> 
>> anotherroutine(y)
>> Vec y
>> call myroutine(y)
>> 
>> to access local entries in PETSc Vec directly you need to call VecGetArray() or VecGetArrayF90()
>> 
>> Barry
>> 
>> 
>>> The problem is that I receive errors when I'm attempting to run the program. The problem seems to be related with memory, but I am not sure.
>>> 
>>> The first line of errors can be seen below:
>>> "Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range"
>>> 
>>> 
>>> Could you help me?
>>> 
>>> Thanks in advance
>> 



More information about the petsc-users mailing list