[petsc-users] How to exclude -C compiler option (VecGetArray in Fortran)

Danyang Su danyang.su at gmail.com
Fri Aug 9 17:02:18 CDT 2013


Hi Satish,

Thanks. It works now.

Danyang

On 09/08/2013 2:52 PM, Satish Balay wrote:
> On Fri, 9 Aug 2013, Danyang Su wrote:
>
>> Hi All,
>>
>> I get some problem in VecGetArray in Fortran, which I guess is due to the
>> default -C compiler option.
>>
>> Current compiler option are:
>> $ make ksp_inhm
>> /cygdrive/c/cygwin/packages/petsc-3.4.2/bin/win32fe/win32fe ifort -c  -MT -Z7
>> -fpp  -I/cygdrive/c/cygwin/packages/petsc-3.4.2/in
>> clude -I/cygdrive/c/cygwin/packages/petsc-3.4.2/arch-mswin-c-debug/include
>> -I/cygdrive/c/cygwin/packages/parmetis-4.0.3/include
>> -I/cygdrive/c/cygwin/packages/metis-5.1.0/include -I/cygdrive/c/Program\
>> Files/MPICH2/include    -o ksp_inhm.o ksp_inhm.F90
>> /cygdrive/c/cygwin/packages/petsc-3.4.2/bin/win32fe/win32fe cl -MT -wd4996 -Z7
>> -o ksp_inhm_d ksp_inhm.o  -L/cygdrive/c/cygwin/p
>> ackages/petsc-3.4.2/arch-mswin-c-debug/lib  -lpetsc -lflapack -lfblas
>> /cygdrive/c/cygwin/packages/parmetis-4.0.3/build/libparmet
>> is/Release/parmetis.lib
>> /cygdrive/c/cygwin/packages/metis-5.1.0/build/libmetis/Release/metis.lib
>> /cygdrive/c/Program\ Files/MPIC
>> H2/lib/fmpich2.lib /cygdrive/c/Program\ Files/MPICH2/lib/fmpich2g.lib
>> /cygdrive/c/Program\ Files/MPICH2/lib/mpi.lib Gdi32.lib Us
>> er32.lib Advapi32.lib Kernel32.lib Ws2_32.lib
>>
>>
>> Relevant codes are as follows:
>>
>> #define xx_a(ib) xx_v(xx_i + (ib))
>>        PetscScalar :: xx_v(1)
>>        PetscOffset :: xx_i
>> ...
>> call VecGetArray(x, xx_v, xx_i, ierr)
>> write(*, 90) istart+1, xx_a(istart+1), iend, xx_a(iend)    !istart and iend
>> are the ownership range
>> 90          format ('x(', i6, ') = ',e11.4, ' x(', i6, ') = ',e11.4)
>> call VecRestoreArray(x, xx_v, xx_i, ierr)
>>
>> The output (xx_a(istart+1), xx_a(iend)) is CORRECT for the processor 0, but
>> INCORRECT for the other processors.
> The code is buggy. You should use xx_a(1),xx_a(n) - where 'n' is the local size.
> You can use VecGetLocalSize() to get the local size.
>
>> I found in the manual that for the fortran user, the compiler option -C should
>> not be used. How I can set this option?
> This issuse is not -C related. If it were - you would have to use
> VecGetArrayF90() - [which should be the prefered function anyway.]
>
> Satish
>
>> Thanks and regards,
>>
>> Danyang
>>



More information about the petsc-users mailing list