[petsc-dev] Bug in example code

Barry Smith bsmith at mcs.anl.gov
Wed Nov 23 13:16:59 CST 2011


   Tim,

    You must have array bounds checking turned on for Fortran with the Intel debug version. The lines

 subroutine FormInitialGuess(X,ierr)
      implicit none

#include "ex5f.h"

!  Input/output variables:
      Vec      X
      PetscErrorCode  ierr

!  Declarations for use with local arrays:
      PetscScalar lx_v(0:1)
      PetscOffset lx_i
      Vec         localX

will break that because we access outside th lx_f(0:1) array.   Our Fortran examples that use F77 have to violate the array bounds so must be compiled without that checking. 

The Fortran 90 examples like ex5f90.F use F90 constructs and thus don't violate bounds. If you plan to use Fortran it makes sense to use the F90 version; after all 2011 >> 1977 :-)

   Barry



On Nov 23, 2011, at 12:04 PM, Tim Gallagher wrote:

> Hi, 
> 
> I just cloned the petsc-dev branch for the first time and built it with GCC with both release and debug options and the tests during make test worked fine. I then built it with Intel with release options and the tests worked. Then I compiled with debug options and one of the tests generates an error:
> 
> Possible error running Fortran example src/snes/examples/tutorials/ex5f with 1 MPI process
> See http://www.mcs.anl.gov/petsc/documentation/faq.html
> forrtl: severe (408): fort: (2): Subscript #1 of the array LX_V has value 15092 which is greater than the upper bound of 1
> 
> Image              PC                Routine            Line        Source             
> libirc.so          00007F4245C589AA  Unknown               Unknown  Unknown
> libirc.so          00007F4245C574A6  Unknown               Unknown  Unknown
> libifcore.so.5     00007F4240A5B6FC  Unknown               Unknown  Unknown
> libifcore.so.5     00007F42409CEDA2  Unknown               Unknown  Unknown
> libifcore.so.5     00007F42409CF323  Unknown               Unknown  Unknown
> ex5f               0000000000403F58  forminitialguess_         294  ex5f.F
> ex5f               0000000000403719  MAIN__                    224  ex5f.F
> ex5f               00000000004028AC  Unknown               Unknown  Unknown
> libc.so.6          00007F42401AB23D  Unknown               Unknown  Unknown
> ex5f               00000000004027A9  Unknown               Unknown  Unknown
> 
> I am using:
> 
> Intel(R) Fortran Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 12.1.1.256 Build 20111011
> Copyright (C) 1985-2011 Intel Corporation.  All rights reserved.
> 
> and petsc was configured with:
> 
> ./configure PETSC_ARCH=linux-intel-debug --prefix=/opt/petsc/intel/2011.sp1.1/debug --with-make-np=12 --with-clanguage=C++ --with-c-support=1--with-fortran-kernels=1 --with-shared-libraries=1--download-scalapack=yes --download-parmetis=yes --download-metis=yes --with-imagemagick=1 --download-sundials=yes --download-mpi4py=yes --download-petsc4py=yes --download-boost=yes --with-hdf5=1 --with-hdf5-dir=$HDF5_DIR --with-imagemagick=0 --with-shared-libraries --with-debugging=no COPTFLAGS='-g -C -traceback -fpe0 -check noarg_temp_created -fp-stack-check -check uninit' FOPTFLAGS='-g -C -traceback -fpe0 -check noarg_temp_created -fp-stack-check -check uninit'
> 
> I am going to try looking for the problem, but since this is the first 10 minutes I've looked at the code, it will probably take me a lot longer than somebody else to find the problem. Let me know if there's anything I can do to help track down the problem. 
> 
> Thanks,
> 
> Tim




More information about the petsc-dev mailing list