<div dir="ltr"><div dir="ltr">On Wed, Jan 15, 2020 at 2:15 PM Balay, Satish <<a href="mailto:balay@mcs.anl.gov">balay@mcs.anl.gov</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wed, 15 Jan 2020, Matthew Knepley wrote:<br>
<br>
> On Wed, Jan 15, 2020 at 10:26 AM Дмитрий Мельничук <<br>
> <a href="mailto:dmitry.melnichuk@geosteertech.com" target="_blank">dmitry.melnichuk@geosteertech.com</a>> wrote:<br>
> <br>
> > > And I'm not sure why you are having to use PetscInt for ierr. All PETSc<br>
> > routines should be suing 'PetscErrorCode for ierr'<br>
> ><br>
> > If I define *ierr *as *PetscErrorCode *for all subroutines given below<br>
> ><br>
> > call VecDuplicate(Vec_U,Vec_Um,ierr)<br>
> > call VecCopy(Vec_U,Vec_Um,ierr)<br>
> > call VecGetLocalSize(Vec_U,j,ierr)<br>
> > call VecGetOwnershipRange(Vec_U,j1,j2,ierr)<br>
> ><br>
> > then errors occur with first three subroutines:<br>
> > *Error: Type mismatch in argument «z» at (1); passed INTEGER(4) to<br>
> > INTEGER(8).*<br>
> ><br>
> <br>
> Barry,<br>
> <br>
> It looks like the ftn-auto interfaces are using 'integer' for the error<br>
> code, whereas the ftn-custom is using PetscErrorCode.<br>
> Could we make the generated ones use integer?<br>
<br>
Well it needs a fix to bfort. But then there are a bunch of other issues wrt MPI - its not clear [to me] how to fix [wrt -fdefault-integer-8]<br></blockquote><div><br></div><div>Well, we could conversely just change the ftn-custom bindings to 'integer' for the error code.</div><div><br></div><div> Thanks,</div><div><br></div><div> Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Satish<br>
<br>
> <br>
> Thanks,<br>
> <br>
> Matt<br>
> <br>
> <br>
> > Therefore I was forced to define *ierr *as *PetscInt *for VecDuplicate,<br>
> > VecCopy, VecGetLocalSize subroutines to fix these errors.<br>
> > Why some subroutines sue 8-bytes integer type of *ierr *(*PetscInt*),<br>
> > while others - 4-bytes integer type of *ierr *(*PetscErrorCode*) remains<br>
> > a mystery for me.<br>
> ><br>
> > > What version of PETSc are you using?<br>
> ><br>
> > version 3.12.2<br>
> ><br>
> > > Are you seeing this issue with a PETSc example?<br>
> ><br>
> > I will check it tomorrow and let you know.<br>
> ><br>
> > Kind regards,<br>
> > Dmitry Melnichuk<br>
> ><br>
> ><br>
> ><br>
> > 15.01.2020, 17:14, "Balay, Satish" <<a href="mailto:balay@mcs.anl.gov" target="_blank">balay@mcs.anl.gov</a>>:<br>
> ><br>
> > -fdefault-integer-8 is likely to break things [esp with MPI - where<br>
> > 'integer' is used everywhere for ex - MPI_Comm etc - so MPI includes become<br>
> > incompatible with the MPI library with -fdefault-integer-8.]<br>
> ><br>
> > And I'm not sure why you are having to use PetscInt for ierr. All PETSc<br>
> > routines should be suing 'PetscErrorCode for ierr'<br>
> ><br>
> > What version of PETSc are you using? Are you seeing this issue with a<br>
> > PETSc example?<br>
> ><br>
> > Satish<br>
> ><br>
> > On Wed, 15 Jan 2020, Дмитрий Мельничук wrote:<br>
> ><br>
> ><br>
> > Hello all!<br>
> > At present time I need to compile solver called Defmod (<br>
> > <a href="https://bitbucket.org/stali/defmod/wiki/Home" rel="noreferrer" target="_blank">https://bitbucket.org/stali/defmod/wiki/Home</a>), which is written in<br>
> > Fortran 95.<br>
> > Defmod uses PETSc for solving linear algebra system.<br>
> > Solver compilation with 32-bit version of PETSc does not cause any<br>
> > problem.<br>
> > But solver compilation with 64-bit version of PETSc produces an error<br>
> > with size of ierr PETSc variable.<br>
> ><br>
> > 1. For example, consider the following statements written in Fortran:<br>
> ><br>
> ><br>
> > PetscErrorCode :: ierr_m<br>
> > PetscInt :: ierr<br>
> > ...<br>
> > ...<br>
> > call VecDuplicate(Vec_U,Vec_Um,ierr)<br>
> > call VecCopy(Vec_U,Vec_Um,ierr)<br>
> > call VecGetLocalSize(Vec_U,j,ierr)<br>
> > call VecGetOwnershipRange(Vec_U,j1,j2,ierr_m)<br>
> ><br>
> ><br>
> > As can be seen first three subroutunes require ierr to be size<br>
> > of INTEGER(8), while the last subroutine (VecGetOwnershipRange)<br>
> > requires ierr to be size of INTEGER(4).<br>
> > Using the same integer format gives an error:<br>
> ><br>
> > There is no specific subroutine for the generic ‘vecgetownershiprange’ at<br>
> > (1)<br>
> ><br>
> > 2. Another example is:<br>
> ><br>
> ><br>
> > call MatAssemblyBegin(Mat_K,Mat_Final_Assembly,ierr)<br>
> > CHKERRA(ierr)<br>
> > call MatAssemblyEnd(Mat_K,Mat_Final_Assembly,ierr)<br>
> ><br>
> ><br>
> > I am not able to define an appropriate size if ierr in CHKERRA(ierr). If<br>
> > I choose INTEGER(8), the error "Type mismatch in argument ‘ierr’ at (1);<br>
> > passed INTEGER(8) to<br>
> > INTEGER(4)" occurs.<br>
> > If I define ierr as INTEGER(4), the error "Type mismatch in argument<br>
> > ‘ierr’ at (1); passed INTEGER(4) to INTEGER(8)" appears.<br>
> ><br>
> > 3. If I change the sizes of ierr vaiables as error messages require, the<br>
> > compilation completed successfully, but an error occurs when calculating<br>
> > the RHS vector with<br>
> > following message:<br>
> > [0]PETSC ERROR: Out of range index value -4 cannot be negative<br>
> ><br>
> ><br>
> > Command to configure 32-bit version of PETSc under Windows 10 using<br>
> > Cygwin:<br>
> > ./configure --with-cc=x86_64-w64-mingw32-gcc<br>
> > --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran<br>
> > --download-fblaslapack<br>
> > --with-mpi-include=/cygdrive/c/MPISDK/Include<br>
> > --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a<br>
> > --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes<br>
> > -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static<br>
> > -lpthread -fno-range-check' --with-shared-libraries=no<br>
> > Command to configure 64-bit version of PETSc under Windows 10 using<br>
> > Cygwin:./configure --with-cc=x86_64-w64-mingw32-gcc<br>
> > --with-cxx=x86_64-w64-mingw32-g++<br>
> > --with-fc=x86_64-w64-mingw32-gfortran --download-fblaslapack<br>
> > --with-mpi-include=/cygdrive/c/MPISDK/Include<br>
> > --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a<br>
> > --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes<br>
> > -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static<br>
> > -lpthread -fno-range-check<br>
> > -fdefault-integer-8' --with-shared-libraries=no --with-64-bit-indices<br>
> > --known-64-bit-blas-indices<br>
> ><br>
> ><br>
> > Kind regards,<br>
> > Dmitry Melnichuk<br>
> ><br>
> ><br>
> ><br>
> ><br>
> <br>
> <br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener</div><div><br></div><div><a href="http://www.cse.buffalo.edu/~knepley/" target="_blank">https://www.cse.buffalo.edu/~knepley/</a><br></div></div></div></div></div></div></div></div>