Re: [petsc-users] Triple increasing of allocated memory during KSPSolve calling(GMRES preconditioned by ASM)

2020-02-04 Thread Дмитрий Мельничук
Hello again!Thank you very much for your replies!Log is attached. 1. The main problem now is following. To solve the matrix that is attached to my previous e-mail PETSc consumes ~550 MB.I know definitely that there are commercial softwares in petroleum industry (e.g., Schlumberger Petrel) that solve the same initial problem consuming only ~200 MB.Moreover, I am sure that when I used 32-bit PETSc (GMRES + ASM) a year ago, it also consumed ~200 MB for this matrix. So, my question is: do you have any advice on how to decrease the amount of RAM consumed for such matrix from 550 MB to 200 MB? Maybe some specific preconditioner or other ways? I will be very grateful for any thoughts! 2. The second problem is more particular.According to resource manager in Windows 10, Fortran solver based on PETSc consumes 548 MB RAM  while solving the system of linear equations.As I understand it form logs, it is required 459 MB and 52 MB for matrix and vector storage respectively. After summing of all objects for which memory is  allocated we get only 517 MB. Thank you again for your time! Have a nice day. Kind regards,Dmitry03.02.2020, 19:55, "Smith, Barry F." :   GMRES also can by default require about 35 work vectors if it reaches the full restart. You can set a smaller restart with -ksp_gmres_restart 15 for example but this can also hurt the convergence of GMRES dramatically. People sometimes use the KSPBCGS algorithm since it does not require all the restart vectors but it can also converge more slowly.Depending on how much memory the sparse matrices use relative to the vectors the vector memory may matter or not.   If you are using a recent version of PETSc you can run with -log_view -log_view_memory and it will show on the right side of the columns how much memory is being allocated for each of the operations in various ways.    Barry On Feb 3, 2020, at 10:34 AM, Matthew Knepley <knep...@gmail.com> wrote: On Mon, Feb 3, 2020 at 10:38 AM Дмитрий Мельничук <dmitry.melnic...@geosteertech.com> wrote: Hello all! Now I am faced with a problem associated with the memory allocation when calling of KSPSolve . GMRES preconditioned by ASM for solving linear algebra system (obtained by the finite element spatial discretisation of Biot poroelasticity model) was chosen. According to the output value of PetscMallocGetCurrentUsage subroutine 176 MB for matrix and RHS vector storage is required (before KSPSolve calling). But during solving linear algebra system 543 MB of RAM is required (during KSPSolve calling). Thus, the amount of allocated memory after preconditioning stage increased three times. This kind of behaviour is critically for 3D models with several millions of cells.   1) In order to know anything, we have to see the output of -ksp_view, although I see you used an overlap of 2 2) The overlap increases the size of submatrices beyond that of the original matrix. Suppose that you used LU for the sub-preconditioner. You would need at least 2x memory (with ILU(0)) since the matrix dominates memory usage. Moreover, you have overlap and you might have fill-in depending on the solver. 3) The massif tool from valgrind is a good fine-grained way to look at memory allocation   Thanks,  Matt Is there a way to decrease amout of allocated memory? Is that an expected behaviour for GMRES-ASM combination? As I remember, using previous version of PETSc didn't demonstrate so significante memory increasing.   ... Vec :: Vec_F, Vec_U Mat :: Mat_K ... ... call MatAssemblyBegin(Mat_M,Mat_Final_Assembly,ierr) call MatAssemblyEnd(Mat_M,Mat_Final_Assembly,ierr)  call VecAssemblyBegin(Vec_F_mod,ierr) call VecAssemblyEnd(Vec_F_mod,ierr) ... ... call PetscMallocGetCurrentUsage(mem, ierr) print *,"Memory used: ",mem ... ... call KSPSetType(Krylov,KSPGMRES,ierr) call KSPGetPC(Krylov,PreCon,ierr) call PCSetType(PreCon,PCASM,ierr) call KSPSetFromOptions(Krylov,ierr) ... call KSPSolve(Krylov,Vec_F,Vec_U,ierr) ... ... options = "-pc_asm_overlap 2 -pc_asm_type basic -ksp_monitor -ksp_converged_reason" Kind regards, Dmitry Melnichuk Matrix.dat (265288024) --  What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/

Logs_26K_GMRES-ASM-log_view-log_view_memory-malloc_dump_32bit
Description: Binary data


[petsc-users] Triple increasing of allocated memory during KSPSolve calling(GMRES preconditioned by ASM)

2020-02-03 Thread Дмитрий Мельничук
Hello all!Now I am faced with a problem associated with the memory allocation when calling of KSPSolve .GMRES preconditioned by ASM for solving linear algebra system (obtained by the finite element spatial discretisation of Biot poroelasticity model) was chosen.According to the output value of PetscMallocGetCurrentUsage subroutine 176 MB for matrix and RHS vector storage is required (before KSPSolve calling).But during solving linear algebra system 543 MB of RAM is required (during KSPSolve calling).Thus, the amount of allocated memory after preconditioning stage increased three times. This kind of behaviour is critically for 3D models with several millions of cells.  Is there a way to decrease amout of allocated memory?Is that an expected behaviour for GMRES-ASM combination?As I remember, using previous version of PETSc didn't demonstrate so significante memory increasing.  ...Vec :: Vec_F, Vec_UMat :: Mat_K..call MatAssemblyBegin(Mat_M,Mat_Final_Assembly,ierr)call MatAssemblyEnd(Mat_M,Mat_Final_Assembly,ierr)call VecAssemblyBegin(Vec_F_mod,ierr)call VecAssemblyEnd(Vec_F_mod,ierr)..call PetscMallocGetCurrentUsage(mem, ierr)print *,"Memory used: ",mem..call KSPSetType(Krylov,KSPGMRES,ierr)call KSPGetPC(Krylov,PreCon,ierr)call PCSetType(PreCon,PCASM,ierr)call KSPSetFromOptions(Krylov,ierr)...call KSPSolve(Krylov,Vec_F,Vec_U,ierr)..options = "-pc_asm_overlap 2 -pc_asm_type basic -ksp_monitor -ksp_converged_reason"  Kind regards,Dmitry MelnichukMatrix.dat (265288024)

Re: [petsc-users] Solver compilation with 64-bit version of PETSc under Windows 10 using Cygwin

2020-01-21 Thread Дмитрий Мельничук
> First you need to figure out what is triggering:> C:/MPI/Bin/mpiexec.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory> Googling it finds all kinds of suggestions for Linux. But Windows? Maybe the debugger will help.>   Second>   VecNorm_Seq line 221 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/vec/vec/impls/seq/bvec2.c>  Debugger is best to find out what is triggering this. Since it is the C side of things it would be odd that the Fortran change affects it.>   Barry I am in the process of finding out the causes of these errors.I'm inclined to the fact that BLAS has still some influence on what is happening.Because testing of 32-bit version of PETSc gives such weird error with mpiexec.exe, but Fortran example ex5f completes succeccfully.I need to say that my solver compiled with 64-bit version of PETSc failed with Segmentation Violation error (the same as ex5f) when calling KSPSolve(Krylov,Vec_F,Vec_U,ierr).During the execution KSPSolve appeals to VecNorm_Seq in bvec2.c. Also VecNorm_Seq  uses several types of integer: PetscErrorCode, PetscInt, PetscBLASInt.I suspect that PetscBLASInt may conflict with PetscInt.Also I noted that execution of KSPSolve() does not even start , so arguments (Krylov,Vec_F,Vec_U,ierr) cannot be passed to KSPSolve().(inserted fprint() in the top of KSPSolve and saw no output) So I tried to configure PETSc with --download-fblaslapack --with-64-bit-blas-indices, but got an error that fblaslapack does not support -with-64-bit-blas-indices Switching to flags --download-openblas -with-64-bit-blas-indices was unsuccessfully too because of error: Error during download/extract/detection of OPENBLAS:Unable to download openblasCould not execute "['git clone https://github.com/xianyi/OpenBLAS.git /cygdrive/d/Computational_geomechanics/installation/petsc-barry/arch-mswin-c-debug/externalpackages/git.openblas']":fatal: destination path '/cygdrive/d/Computational_geomechanics/installation/petsc-barry/arch-mswin-c-debug/externalpackages/git.openblas' already exists and is not an empty directory.Unable to download package OPENBLAS from: git://https://github.com/xianyi/OpenBLAS.git* If URL specified manually - perhaps there is a typo?* If your network is disconnected - please reconnect and rerun ./configure* Or perhaps you have a firewall blocking the download* You can run with --with-packages-download-dir=/adirectory and ./configure will instruct you what packages to download manually* or you can download the above URL manually, to /yourselectedlocation  and use the configure option:  --download-openblas=/yourselectedlocationUnable to download openblasCould not execute "['git clone https://github.com/xianyi/OpenBLAS.git /cygdrive/d/Computational_geomechanics/installation/petsc-barry/arch-mswin-c-debug/externalpackages/git.openblas']":fatal: destination path '/cygdrive/d/Computational_geomechanics/installation/petsc-barry/arch-mswin-c-debug/externalpackages/git.openblas' already exists and is not an empty directory.Unable to download package OPENBLAS from: git://https://github.com/xianyi/OpenBLAS.git* If URL specified manually - perhaps there is a typo?* If your network is disconnected - please reconnect and rerun ./configure* Or perhaps you have a firewall blocking the download* You can run with --with-packages-download-dir=/adirectory and ./configure will instruct you what packages to download manually* or you can download the above URL manually, to /yourselectedlocation  and use the configure option:  --download-openblas=/yourselectedlocationCould not locate downloaded package OPENBLAS in /cygdrive/d/Computational_geomechanics/installation/petsc-barry/arch-mswin-c-debug/externalpackages But I checked the last location (.../externalpackages)  and saw that OpenBLAS downloaded and unzipped. Kind regards, Dmitry Melnichuk 20.01.2020, 16:32, "Smith, Barry F." :   First you need to figure out what is triggering:C:/MPI/Bin/mpiexec.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directoryGoogling it finds all kinds of suggestions for Linux. But Windows? Maybe the debugger will help.   Second  VecNorm_Seq line 221 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/vec/vec/impls/seq/bvec2.c  Debugger is best to find out what is triggering this. Since it is the C side of things it would be odd that the Fortran change affects it.   Barry  On Jan 20, 2020, at 4:43 AM, Дмитрий Мельничук <dmitry.melnic...@geosteertech.com> wrote: Thank you so much for your assistance! As far as I have been able to find out, the errors "Type mismatch in argument ‘ierr’" have been successfully fixed. But execution of command "make PETSC_DIR=/cygdrive/d/... PETSC_ARCH=arch-mswin-c-debug check" leads to the appereance of Segmantation Violation error. I compiled PETSc with Microsoft MPI v10. Does it make se

Re: [petsc-users] Solver compilation with 64-bit version of PETSc under Windows 10 using Cygwin

2020-01-20 Thread Дмитрий Мельничук
Thank you so much for your assistance!As far as I have been able to find out, the errors  "Type mismatch in argument ‘ierr’" have been successfully fixed.But execution of command "make PETSC_DIR=/cygdrive/d/... PETSC_ARCH=arch-mswin-c-debug check" leads to the appereance of Segmantation Violation error. I compiled PETSc with Microsoft MPI v10.Does it make sense to compile PETSc with another MPI implementation (such as MPICH) in order to resolve the issue?Error message:Running test examples to verify correct installationUsing PETSC_DIR=/cygdrive/d/Computational_geomechanics/installation/petsc-barry and PETSC_ARCH=arch-mswin-c-debugPossible error running C/C++ src/snes/examples/tutorials/ex19 with 1 MPI processSee http://www.mcs.anl.gov/petsc/documentation/faq.htmlC:/MPI/Bin/mpiexec.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directoryPossible error running C/C++ src/snes/examples/tutorials/ex19 with 2 MPI processesSee http://www.mcs.anl.gov/petsc/documentation/faq.htmlC:/MPI/Bin/mpiexec.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directoryPossible error running Fortran example src/snes/examples/tutorials/ex5f with 1 MPI processSee http://www.mcs.anl.gov/petsc/documentation/faq.html[0]PETSC ERROR: [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger[0]PETSC ERROR: or see https://www.mcs.anl.gov/petsc/documentation/faq.html#valgrind[0]PETSC ERROR: or try http://valgrind.org on GNU/linux and Apple Mac OS X to find memory corruption errors[0]PETSC ERROR: likely location of problem given in stack below[0]PETSC ERROR: -  Stack Frames [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not available,[0]PETSC ERROR:       INSTEAD the line number of the start of the function[0]PETSC ERROR:       is given.[0]PETSC ERROR: [0] VecNorm_Seq line 221 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/vec/vec/impls/seq/bvec2.c[0]PETSC ERROR: [0] VecNorm line 213 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/vec/vec/interface/rvector.c[0]PETSC ERROR: [0] SNESSolve_NEWTONLS line 144 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/snes/impls/ls/ls.c[0]PETSC ERROR: [0] SNESSolve line 4375 /cygdrive/d/Computational_geomechanics/installation/petsc-barry/src/snes/interface/snes.c[0]PETSC ERROR: - Error Message --[0]PETSC ERROR: Signal received[0]PETSC ERROR: See https://www.mcs.anl.gov/petsc/documentation/faq.html for trouble shooting.[0]PETSC ERROR: Petsc Development GIT revision: unknown  GIT Date: unknown[0]PETSC ERROR: ./ex5f on a arch-mswin-c-debug named DESKTOP-R88IMOB by useruser Mon Jan 20 09:18:34 2020[0]PETSC ERROR: Configure options --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran --with-mpi-include=/cygdrive/c/MPISDK/Include --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes -CFLAGS=-O2 -CXXFLAGS=-O2 -FFLAGS="-O2 -static-libgfortran -static -lpthread -fno-range-check -fdefault-integer-8" --download-fblaslapack --with-shared-libraries=no --with-64-bit-indices --force[0]PETSC ERROR: #1 User provided function() line 0 in  unknown file job aborted:[ranks] message [0] application abortedaborting MPI_COMM_WORLD (comm=0x4400), error 50152059, comm rank 0  error analysis - [0] on DESKTOP-R88IMOB./ex5f aborted the job. abort code 50152059  error analysis -Completed test examplesKind regards,Dmitry Melnichuk 19.01.2020, 07:47, "Smith, Barry F." :   Dmitry,   I have completed and tested the branch barry/2020-01-15/support-default-integer-8 it is undergoing testing now https://gitlab.com/petsc/petsc/merge_requests/2456   Please give it a try. Note that MPI has no support for integer promotion so YOU must insure that any MPI calls from Fortran pass 4 byte integers not promoted 8 byte integers.   I have tested it with recent versions of MPICH and OpenMPI, it is fragile at compile time and may fail to compile with different versions of MPI.Good luck,   BarryI do not recommend this approach for integer promotion in Fortran. Just blindly promoting all integers can often lead to problems. I recommend using the kind mechanism ofFortran to insure that each variable is the type you want, you can recompile with different options to promote the kind declared variables you wish. Of course this is more intrusive and requires changes to the Fortran code.  On Jan 15, 2020, at 7:00 AM, Дмитрий Мельничук <dmitry.melnic...@geosteertech.com> wrote: Hello

Re: [petsc-users] Solver compilation with 64-bit version of PETSc under Windows 10 using Cygwin

2020-01-17 Thread Дмитрий Мельничук
Thank you for your replies.Tried to configure commited version of PETSc from Satish Balay branch (balay/fix-ftn-i8/maint) and faced to the same error when running test example ex5f call SNESCreate(PETSC_COMM_WORLD,snes,ierr) Error: Type mismatch in argument «z» at (1); passed INTEGER(4) to INTEGER(8) At the moment, some subroutines (such as PetscInitialize, PetscFinalize, MatSetValue, VecSetValue) work with the correct size of the variable ierr defined as PetscErrorCode, and some do not.The following subroutines still require ierr to be of type INTEGER(8): VecGetSubVector, VecAssemblyBegin, VecAssemblyEnd, VecScatterBegin, VecScatterEnd, VecScatterDestroy, VecCreateMPI, VecDuplicate, VecZeroEntries, VecAYPX, VecWAXPY, VecWAXPYMatMult, MatDestroy, MatAssemblyBegin, MatAssemblyEnd, MatZeroEntries, MatCreateSubMatrix, MatScale, MatDiagonalSet, MatGetDiagonal, MatDuplicat, MatSetSizes, MatSetFromOptionsUnfortunately, I'm not sure if this is the only issue that occurs when switching to the 64-bit version of PETSc.I can set the size of the variables ierr so that the solver compilation process completes successfully, but I get the following error when solving linear algebra system by use of KSPSolve subroutine:  [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range Because the solver with the 32-bit version of PETSc works properly, I suppose that the cause of the errors (for 64-bit version of PETSc) is the inappropriate size of the variables.I compiled PETSc with flags: with-64-bit-indices and -fdefault-integer-8. Also changed the size of MPI_Integer to MPI_Integer8:MPI_Bcast(npart,nnds,MPI_Integer8,0,MPI_Comm_World,ierr). I am probably missing something else.​​​Kind regards,Dmitry Melnichuk 16.01.2020, 01:26, "Balay, Satish" :I have some changes (incomplete) here -my hack to bfort.diff --git a/src/bfort/bfort.c b/src/bfort/bfort.cindex 0efe900..31ff154 100644--- a/src/bfort/bfort.c+++ b/src/bfort/bfort.c@@ -1654,7 +1654,7 @@ void PrintDefinition( FILE *fout, int is_function, char *name, int nstrings, /* Add a "decl/result(name) for functions */ if (useFerr) {- OutputFortranToken( fout, 7, "integer" );+ OutputFortranToken( fout, 7, "PetscErrorCode" );OutputFortranToken( fout, 1, errArgNameParm); } else if (is_function) {OutputFortranToken( fout, 7, ArgToFortran( rt->name ) );And my changes to petsc are on branch balay/fix-ftn-i8/maintSatishOn Wed, 15 Jan 2020, Smith, Barry F. via petsc-users wrote:Working on it now; may be doable > On Jan 15, 2020, at 11:55 AM, Matthew Knepley <knep...@gmail.com> wrote: > > On Wed, Jan 15, 2020 at 10:26 AM Дмитрий Мельничук <dmitry.melnic...@geosteertech.com> wrote: > > And I'm not sure why you are having to use PetscInt for ierr. All PETSc routines should be suing 'PetscErrorCode for ierr' > > If I define ierr as PetscErrorCode for all subroutines given below > > call VecDuplicate(Vec_U,Vec_Um,ierr) > call VecCopy(Vec_U,Vec_Um,ierr) > call VecGetLocalSize(Vec_U,j,ierr) > call VecGetOwnershipRange(Vec_U,j1,j2,ierr) > > then errors occur with first three subroutines: > Error: Type mismatch in argument «z» at (1); passed INTEGER(4) to INTEGER(8). > > Barry, > > It looks like the ftn-auto interfaces are using 'integer' for the error code, whereas the ftn-custom is using PetscErrorCode. > Could we make the generated ones use integer? > > Thanks, > > Matt > > Therefore I was forced to define ierr as PetscInt for VecDuplicate, VecCopy, VecGetLocalSize subroutines to fix these errors. > Why some subroutines sue 8-bytes integer type of ierr (PetscInt), while others - 4-bytes integer type of ierr (PetscErrorCode) remains a mystery for me. > > > What version of PETSc are you using? > > version 3.12.2 > > > Are you seeing this issue with a PETSc example? > > I will check it tomorrow and let you know. > > Kind regards, > Dmitry Melnichuk > > > > 15.01.2020, 17:14, "Balay, Satish" <ba...@mcs.anl.gov>: > -fdefault-integer-8 is likely to break things [esp with MPI - where 'integer' is used everywhere for ex - MPI_Comm etc - so MPI includes become incompatible with the MPI library with -fdefault-integer-8.] > > And I'm not sure why you are having to use PetscInt for ierr. All PETSc routines should be suing 'PetscErrorCode for ierr' > > What version of PETSc are you using? Are you seeing this issue with a PETSc example? > > Satish > > On Wed, 15 Jan 2020, Дмитрий Мельничук wrote: > > > Hello all! > At present time I need to compile solver called Defmod (https://bitbucket.org/stali/defmod/wiki/Home), which is written in Fortran 95. > Defmod uses PETSc for solving linear algebra system. > Solver compilation with 32-bit version of PETSc does not cause any problem. > 

Re: [petsc-users] Solver compilation with 64-bit version of PETSc under Windows 10 using Cygwin

2020-01-15 Thread Дмитрий Мельничук
> And I'm not sure why you are having to use PetscInt for ierr. All PETSc routines should be suing 'PetscErrorCode for ierr'If I define ierr as PetscErrorCode for all subroutines given belowcall VecDuplicate(Vec_U,Vec_Um,ierr)call VecCopy(Vec_U,Vec_Um,ierr)call VecGetLocalSize(Vec_U,j,ierr)call VecGetOwnershipRange(Vec_U,j1,j2,ierr)then errors occur with first three subroutines:Error: Type mismatch in argument «z» at (1); passed INTEGER(4) to INTEGER(8).Therefore I was forced to define ierr as PetscInt for VecDuplicate, VecCopy, VecGetLocalSize subroutines to fix these errors.Why some subroutines sue 8-bytes integer type of ierr (PetscInt), while others - 4-bytes integer type of ierr (PetscErrorCode) remains a mystery for me.> What version of PETSc are you using?version 3.12.2> Are you seeing this issue with a PETSc example?I will check it tomorrow  and let you know.Kind regards,Dmitry Melnichuk  15.01.2020, 17:14, "Balay, Satish" :-fdefault-integer-8 is likely to break things [esp with MPI - where 'integer' is used everywhere for ex - MPI_Comm etc - so MPI includes become incompatible with the MPI library with -fdefault-integer-8.]And I'm not sure why you are having to use PetscInt for ierr. All PETSc routines should be suing 'PetscErrorCode for ierr'What version of PETSc are you using? Are you seeing this issue with a PETSc example?SatishOn Wed, 15 Jan 2020, Дмитрий Мельничук wrote:  Hello all!  At present time I need to compile solver called Defmod (https://bitbucket.org/stali/defmod/wiki/Home), which is written in Fortran 95. Defmod uses PETSc for solving linear algebra system. Solver compilation with 32-bit version of PETSc does not cause any problem.  But solver compilation with 64-bit version of PETSc produces an error with size of ierr PETSc variable.1. For example, consider the following statements written in Fortran: PetscErrorCode :: ierr_m PetscInt :: ierr ... ... call VecDuplicate(Vec_U,Vec_Um,ierr)  call VecCopy(Vec_U,Vec_Um,ierr) call VecGetLocalSize(Vec_U,j,ierr) call VecGetOwnershipRange(Vec_U,j1,j2,ierr_m) As can be seen first three subroutunes require ierr to be size of INTEGER(8), while the last subroutine (VecGetOwnershipRange) requires ierr to be size of INTEGER(4). Using the same integer format gives an error:   There is no specific subroutine for the generic ‘vecgetownershiprange’ at (1)   2. Another example is: call MatAssemblyBegin(Mat_K,Mat_Final_Assembly,ierr) CHKERRA(ierr) call MatAssemblyEnd(Mat_K,Mat_Final_Assembly,ierr) I am not able to define an appropriate size if ierr in CHKERRA(ierr). If I choose INTEGER(8), the error "Type mismatch in argument ‘ierr’ at (1); passed INTEGER(8) to INTEGER(4)" occurs. If I define ierr  as INTEGER(4), the error "Type mismatch in argument ‘ierr’ at (1); passed INTEGER(4) to INTEGER(8)" appears.3. If I change the sizes of ierr vaiables as error messages require, the compilation completed successfully, but an error occurs when calculating the RHS vector with following message: [0]PETSC ERROR: Out of range index value -4 cannot be negativeCommand to configure 32-bit version of PETSc under Windows 10 using Cygwin: ./configure --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran --download-fblaslapack --with-mpi-include=/cygdrive/c/MPISDK/Include --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static -lpthread -fno-range-check' --with-shared-libraries=no  Command to configure 64-bit version of PETSc under Windows 10 using Cygwin:./configure --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran --download-fblaslapack --with-mpi-include=/cygdrive/c/MPISDK/Include --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static -lpthread -fno-range-check -fdefault-integer-8' --with-shared-libraries=no --with-64-bit-indices --known-64-bit-blas-indices   Kind regards, Dmitry Melnichuk 

[petsc-users] Solver compilation with 64-bit version of PETSc under Windows 10 using Cygwin

2020-01-15 Thread Дмитрий Мельничук
Hello all! At present time I need to compile solver called Defmod (https://bitbucket.org/stali/defmod/wiki/Home), which is written in Fortran 95.Defmod uses PETSc for solving linear algebra system.Solver compilation with 32-bit version of PETSc does not cause any problem. But solver compilation with 64-bit version of PETSc produces an error with size of ierr PETSc variable.  1. For example, consider the following statements written in Fortran:  PetscErrorCode :: ierr_mPetscInt :: ierr..call VecDuplicate(Vec_U,Vec_Um,ierr) call VecCopy(Vec_U,Vec_Um,ierr)call VecGetLocalSize(Vec_U,j,ierr)call VecGetOwnershipRange(Vec_U,j1,j2,ierr_m)  As can be seen first three subroutunes require ierr to be size of INTEGER(8), while the last subroutine (VecGetOwnershipRange) requires ierr to be size of INTEGER(4).Using the same integer format gives an error: There is no specific subroutine for the generic ‘vecgetownershiprange’ at (1) 2. Another example is:  call MatAssemblyBegin(Mat_K,Mat_Final_Assembly,ierr)CHKERRA(ierr)call MatAssemblyEnd(Mat_K,Mat_Final_Assembly,ierr)  I am not able to define an appropriate size if ierr in CHKERRA(ierr). If I choose INTEGER(8), the error "Type mismatch in argument ‘ierr’ at (1); passed INTEGER(8) to INTEGER(4)" occurs.If I define ierr  as INTEGER(4), the error "Type mismatch in argument ‘ierr’ at (1); passed INTEGER(4) to INTEGER(8)" appears.  3. If I change the sizes of ierr vaiables as error messages require, the compilation completed successfully, but an error occurs when calculating the RHS vector with following message:[0]PETSC ERROR: Out of range index value -4 cannot be negative  Command to configure 32-bit version of PETSc under Windows 10 using Cygwin:./configure --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran --download-fblaslapack --with-mpi-include=/cygdrive/c/MPISDK/Include --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static -lpthread -fno-range-check' --with-shared-libraries=no Command to configure 64-bit version of PETSc under Windows 10 using Cygwin:./configure --with-cc=x86_64-w64-mingw32-gcc --with-cxx=x86_64-w64-mingw32-g++ --with-fc=x86_64-w64-mingw32-gfortran --download-fblaslapack --with-mpi-include=/cygdrive/c/MPISDK/Include --with-mpi-lib=/cygdrive/c/MPISDK/Lib/libmsmpi.a --with-mpi-mpiexec=/cygdrive/c/MPI/Bin/mpiexec.exe --with-debugging=yes -CFLAGS='-O2' -CXXFLAGS='-O2' -FFLAGS='-O2 -static-libgfortran -static -lpthread -fno-range-check -fdefault-integer-8' --with-shared-libraries=no --with-64-bit-indices --known-64-bit-blas-indices Kind regards,Dmitry Melnichuk