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

李昊霖 lihaolin at stu.xjtu.edu.cn
Mon Sep 20 21:49:07 CDT 2021


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20210921/4babd715/attachment-0001.html>


More information about the petsc-users mailing list