[petsc-users] Uses of VecGetArrayF90() and VecGetArrayReadF90() in Recent versions of GNU Fortran.

Satish Balay balay at mcs.anl.gov
Mon Sep 20 21:27:51 CDT 2021


VecGetArrayF90 should work with newer gfortran versions.

https://petsc.org/release/docs/manualpages/Vec/VecGetArrayF90.html

Check the examples listed above to see if usage in your code is different. [run them with your build of petsc/compilers to verify]

And make sure you are using the latest version of PETSc.

If you still have issues - send us a reproducible example.

Satish

On Tue, 21 Sep 2021, 李昊霖 wrote:

> Dear all,
> 
> I used PETSc in my full Fortran codes and it worked well when my codes were compiled by GNU Fortran (GCC) 4.8.4. But for some reasons, I had to update the GNU Fortran (GCC) to version 10.0.1. Then I reinstalled the MPICH and PETSc with the newer complier and compiled my codes successfully. However, I got the following error massage:
> 
> Index '1' of dimension 1 of array 'xx' above upper bound of 0.
> 
> where xx is the Fortran pointer obtained by calling VecGetArrayF90(vec,xx,ierr).
> 
> The vector was built successfully, but it seemed that the Fortran pointer xx was not built. I got the same error massage when using VecGetArrayReadF90(). So, are the VecGetArrayF90() and VecGetArrayReadF90() not compatible with the recent versions of GNU Fortran? Or is there any other way to access the vectors? For solving a linear problem Ab=x, I use VecGetArrayF90() to get the Fortran pointer to update b and use VecGetArrayReadF90() to get the values of x. After some tests, I found that VecGetArrayF90() could be replaced by VecSetValues(), but VecGetValues() used to replace VecGetArrayReadF90() could not be run with multiple threads.
> 
> I look forward to your reply and thank you for any suggestions.
> 
> Best regards,
> 
> Haolin Li


More information about the petsc-users mailing list