# PETSc with errors depend on the number of processors

**URL:** <https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136>\
**Category:** General Discussion\
**Created:** [November 22, 2022, 11:17am UTC](https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136 "2022-11-22T11:17:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![agTSL](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@agTSL](https://community.freefem.org/u/agTSL)\
**Post date:** [November 22, 2022, 11:17am UTC](https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136/1 "2022-11-22T11:17:38Z")

</div>

Hello,  
I have difficulties to use PETSc with freefem.  
When I run a exemple script (stokes-3d-PETSc.edp) with 4 proc everything work fine. But when I change the number of proc, 6 or 8, I have (sometime) error message, Segmentation Violation, probably memory access out of range .

> Blockquote  
> – Square mesh : nb vertices =625 , nb triangles = 1152 , nb boundary edges 96  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> – Build Nodes/DF on mesh : n.v. 3934, n. elmt. 17496, n b. elmt. 3996  
> nb of Nodes 17496 nb of DoF 17496 DFon=0001  
> – FESpace: Nb of Nodes 17496 Nb of DoF 17496  
> – FESpace: Nb of Nodes 3934 Nb of DoF 3934  
> — global mesh of 17496 elements (prior to refinement) partitioned with metis --metis←OA: 6-way Edge-Cut: 4, Balance: 1.03 Nodal=0/Dual 1  
> (in 2.869030e-02)  
> – FESpace: Nb of Nodes 867 Nb of DoF 867  
> – FESpace: Nb of Nodes 902 Nb of DoF 902  
> – FESpace: Nb of Nodes 889 Nb of DoF 889  
> – FESpace: Nb of Nodes 976 Nb of DoF 976  
> – FESpace: Nb of Nodes 1072 Nb of DoF 1072  
> – FESpace: Nb of Nodes 1071 Nb of DoF 1071  
> – FESpace: Nb of Nodes 776 Nb of DoF 776  
> – Build Nodes/DF on mesh : n.v. 867, n. elmt. 3727, n b. elmt. 995  
> nb of Nodes 3727 nb of DoF 3727 DFon=0001  
> – FESpace: Nb of Nodes 3727 Nb of DoF 3727  
> – FESpace: Nb of Nodes 790 Nb of DoF 790  
> – FESpace: Nb of Nodes 811 Nb of DoF 811  
> – Build Nodes/DF on mesh : n.v. 889, n. elmt. 3672, n b. elmt. 984  
> nb of Nodes 3672 nb of DoF 3672 DFon=0001  
> – FESpace: Nb of Nodes 3672 Nb of DoF 3672  
> – Build Nodes/DF on mesh : n.v. 902, n. elmt. 3734, n b. elmt. 994  
> nb of Nodes 3734 nb of DoF 3734 DFon=0001  
> – FESpace: Nb of Nodes 3734 Nb of DoF 3734  
> – FESpace: Nb of Nodes 878 Nb of DoF 878  
> – Build Nodes/DF on mesh : n.v. 976, n. elmt. 3874, n b. elmt. 1146  
> nb of Nodes 3874 nb of DoF 3874 DFon=0001  
> – FESpace: Nb of Nodes 3874 Nb of DoF 3874  
> – FESpace: Nb of Nodes 895 Nb of DoF 895  
> – Build Nodes/DF on mesh : n.v. 1072, n. elmt. 4549, n b. elmt. 1230  
> nb of Nodes 4549 nb of DoF 4549 DFon=0001  
> – FESpace: Nb of Nodes 4549 Nb of DoF 4549  
> – FESpace: Nb of Nodes 889 Nb of DoF 889  
> – Build Nodes/DF on mesh : n.v. 776, n. elmt. 3295, n b. elmt. 911  
> nb of Nodes 5249 nb of DoF 16523 DFon=4300  
> – FESpace: Nb of Nodes 5249 Nb of DoF 16523  
> – Build Nodes/DF on mesh : n.v. 790, n. elmt. 3255, n b. elmt. 876  
> nb of Nodes 5272 nb of DoF 16606 DFon=4300  
> – Build Nodes/DF on mesh : n.v. 284, n. elmt. 921, n b. elmt. 466  
> – Build Nodes/DF on mesh : n.v. 1071, n. elmt. 4649, n b. elmt. 1197  
> nb of Nodes 1707 nb of DoF 5405 DFon=4300  
> – FESpace: Nb of Nodes 5272 Nb of DoF 16606  
> nb of Nodes 4649 nb of DoF 4649 DFon=0001  
> – FESpace: Nb of Nodes 1707 Nb of DoF 5405  
> – FESpace: Nb of Nodes 4649 Nb of DoF 4649  
> – Build Nodes/DF on mesh : n.v. 811, n. elmt. 3356, n b. elmt. 892  
> – Build Nodes/DF on mesh : n.v. 129, n. elmt. 376, n b. elmt. 208  
> nb of Nodes 5423 nb of DoF 17080 DFon=4300  
> nb of Nodes 737 nb of DoF 2340 DFon=4300  
> – FESpace: Nb of Nodes 5423 Nb of DoF 17080  
> – FESpace: Nb of Nodes 737 Nb of DoF 2340  
> – Build Nodes/DF on mesh : n.v. 98, n. elmt. 252, n b. elmt. 172  
> nb of Nodes 533 nb of DoF 1697 DFon=4300  
> – FESpace: Nb of Nodes 533 Nb of DoF 1697  
> – Build Nodes/DF on mesh : n.v. 776, n. elmt. 3295, n b. elmt. 911  
> nb of Nodes 5249 nb of DoF 16523 DFon=4300  
> – FESpace: Nb of Nodes 5249 Nb of DoF 16523  
> – Build Nodes/DF on mesh : n.v. 811, n. elmt. 3356, n b. elmt. 892  
> – Build Nodes/DF on mesh : n.v. 790, n. elmt. 3255, n b. elmt. 876  
> – Build Nodes/DF on mesh : n.v. 878, n. elmt. 3442, n b. elmt. 1050  
> nb of Nodes 5423 nb of DoF 17080 DFon=4300  
> nb of Nodes 5272 nb of DoF 16606 DFon=4300  
> nb of Nodes 5721 nb of DoF 18041 DFon=4300  
> – FESpace: Nb of Nodes 5423 Nb of DoF 17080  
> – FESpace: Nb of Nodes 5272 Nb of DoF 16606  
> – FESpace: Nb of Nodes 5721 Nb of DoF 18041  
> – Build Nodes/DF on mesh : n.v. 152, n. elmt. 459, n b. elmt. 242  
> nb of Nodes 883 nb of DoF 2801 DFon=4300  
> – FESpace: Nb of Nodes 883 Nb of DoF 2801  
> – Build Nodes/DF on mesh : n.v. 152, n. elmt. 459, n b. elmt. 242  
> nb of Nodes 883 nb of DoF 2801 DFon=4300  
> – Build Nodes/DF on mesh : n.v. 152, n. elmt. 459, n b. elmt. 242  
> – FESpace: Nb of Nodes 883 Nb of DoF 2801  
> nb of Nodes 883 nb of DoF 2801 DFon=4300  
> – FESpace: Nb of Nodes 883 Nb of DoF 2801  
> – Build Nodes/DF on mesh : n.v. 811, n. elmt. 3356, n b. elmt. 892  
> nb of Nodes 5423 nb of DoF 17080 DFon=4300  
> – FESpace: Nb of Nodes 5423 Nb of DoF 17080  
> – Build Nodes/DF on mesh : n.v. 790, n. elmt. 3255, n b. elmt. 876  
> nb of Nodes 5272 nb of DoF 16606 DFon=4300  
> – FESpace: Nb of Nodes 5272 Nb of DoF 16606  
> – Build Nodes/DF on mesh : n.v. 878, n. elmt. 3442, n b. elmt. 1050  
> nb of Nodes 5721 nb of DoF 18041 DFon=4300  
> – FESpace: Nb of Nodes 5721 Nb of DoF 18041  
> – Build Nodes/DF on mesh : n.v. 152, n. elmt. 459, n b. elmt. 242  
> nb of Nodes 883 nb of DoF 2801 DFon=4300  
> – FESpace: Nb of Nodes 883 Nb of DoF 2801  
> – Build Nodes/DF on mesh : n.v. 889, n. elmt. 3785, n b. elmt. 1029  
> nb of Nodes 6023 nb of DoF 18958 DFon=4300  
> – FESpace: Nb of Nodes 6023 Nb of DoF 18958  
> – Build Nodes/DF on mesh : n.v. 284, n. elmt. 921, n b. elmt. 466  
> nb of Nodes 1707 nb of DoF 5405 DFon=4300  
> – FESpace: Nb of Nodes 1707 Nb of DoF 5405  
> – Build Nodes/DF on mesh : n.v. 878, n. elmt. 3442, n b. elmt. 1050  
> nb of Nodes 5721 nb of DoF 18041 DFon=4300  
> – FESpace: Nb of Nodes 5721 Nb of DoF 18041  
> – Build Nodes/DF on mesh : n.v. 895, n. elmt. 3784, n b. elmt. 1036  
> nb of Nodes 6043 nb of DoF 19024 DFon=4300  
> – FESpace: Nb of Nodes 6043 Nb of DoF 19024  
> – Build Nodes/DF on mesh : n.v. 290, n. elmt. 954, n b. elmt. 468  
> nb of Nodes 1753 nb of DoF 5549 DFon=4300  
> – FESpace: Nb of Nodes 1753 Nb of DoF 5549  
> – Build Nodes/DF on mesh : n.v. 889, n. elmt. 3785, n b. elmt. 1029  
> nb of Nodes 6023 nb of DoF 18958 DFon=4300  
> – FESpace: Nb of Nodes 6023 Nb of DoF 18958  
> – Build Nodes/DF on mesh : n.v. 290, n. elmt. 954, n b. elmt. 468  
> nb of Nodes 1753 nb of DoF 5549 DFon=4300  
> – FESpace: Nb of Nodes 1753 Nb of DoF 5549  
> – Build Nodes/DF on mesh : n.v. 895, n. elmt. 3784, n b. elmt. 1036  
> nb of Nodes 6043 nb of DoF 19024 DFon=4300  
> – FESpace: Nb of Nodes 6043 Nb of DoF 19024  
> – Build Nodes/DF on mesh : n.v. 129, n. elmt. 376, n b. elmt. 208  
> nb of Nodes 737 nb of DoF 2340 DFon=4300  
> – FESpace: Nb of Nodes 737 Nb of DoF 2340  
> – Build Nodes/DF on mesh : n.v. 889, n. elmt. 3785, n b. elmt. 1029  
> nb of Nodes 6023 nb of DoF 18958 DFon=4300  
> – FESpace: Nb of Nodes 6023 Nb of DoF 18958  
> – Build Nodes/DF on mesh : n.v. 895, n. elmt. 3784, n b. elmt. 1036  
> nb of Nodes 6043 nb of DoF 19024 DFon=4300  
> – FESpace: Nb of Nodes 6043 Nb of DoF 19024  
> – Build Nodes/DF on mesh : n.v. 98, n. elmt. 252, n b. elmt. 172  
> nb of Nodes 533 nb of DoF 1697 DFon=4300  
> – FESpace: Nb of Nodes 533 Nb of DoF 1697  
> – Build Nodes/DF on mesh : n.v. 895, n. elmt. 3784, n b. elmt. 1036  
> nb of Nodes 6043 nb of DoF 19024 DFon=4300  
> – FESpace: Nb of Nodes 6043 Nb of DoF 19024  
> — partition of unity built (in 2.700030e-02)  
> — global numbering created (in 1.303900e-03)  
> — global CSR created (in 6.216000e-04)  
> – Build Nodes/DF on mesh : n.v. 776, n. elmt. 3295, n b. elmt. 911  
> nb of Nodes 5249 nb of DoF 16523 DFon=4300  
> – FESpace: Nb of Nodes 5249 Nb of DoF 16523  
> – Build Nodes/DF on mesh : n.v. 878, n. elmt. 3442, n b. elmt. 1050  
> nb of Nodes 5721 nb of DoF 18041 DFon=4300  
> – Build Nodes/DF on mesh : n.v. 790, n. elmt. 3255, n b. elmt. 876  
> – Build Nodes/DF on mesh : n.v. 895, n. elmt. 3784, n b. elmt. 1036  
> nb of Nodes 5272 nb of DoF 16606 DFon=4300  
> nb of Nodes 6043 nb of DoF 19024 DFon=4300  
> – FESpace: Nb of Nodes 5721 Nb of DoF 18041  
> – FESpace: Nb of Nodes 5272 Nb of DoF 16606  
> – FESpace: Nb of Nodes 6043 Nb of DoF 19024  
> – Build Nodes/DF on mesh : n.v. 811, n. elmt. 3356, n b. elmt. 892  
> nb of Nodes 5423 nb of DoF 17080 DFon=4300  
> – FESpace: Nb of Nodes 5423 Nb of DoF 17080  
> – Build Nodes/DF on mesh : n.v. 889, n. elmt. 3785, n b. elmt. 1029  
> nb of Nodes 6023 nb of DoF 18958 DFon=4300  
> – FESpace: Nb of Nodes 6023 Nb of DoF 18958  
> [2]PETSC ERROR: ------------------------------------------------------------------------  
> [2]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range  
> [2]PETSC ERROR: Try option -start\_in\_debugger or -on\_error\_attach\_debugger  
> [2]PETSC ERROR: or see [FAQ — PETSc 3.20.1 documentation](https://petsc.org/release/faq/#valgrind)  
> [2]PETSC ERROR: or try [http://valgrind.org](http://valgrind.org) on GNU/linux and Apple MacOS to find memory corruption errors  
> [2]PETSC ERROR: configure using --with-debugging=yes, recompile, link, and run  
> [2]PETSC ERROR: to get more information on the crash.  
> [2]PETSC ERROR: --------------------- Error Message --------------------------------------------------------------  
> [2]PETSC ERROR: Signal received  
> [2]PETSC ERROR: See [FAQ — PETSc 3.20.1 documentation](https://petsc.org/release/faq/) for trouble shooting.  
> [2]PETSC ERROR: Petsc Release Version 3.17.0, Mar 30, 2022  
> [2]PETSC ERROR: C:\TSL\programme\FreeFem411\FreeFem+±mpi.exe on a named TSL-ORDI24 by aguilloux Tue Nov 22 12:09:59 2022  
> [2]PETSC ERROR: Configure options --prefix=/mingw64/ff-petsc/r MAKEFLAGS= --with-debugging=0 COPTFLAGS=“-O3 -mtune=generic” CXXOPTFLAGS=“-O3 -mtune=generic” FOPTFLAGS=“-O3 -mtune=generic” --with-cxx-dialect=11 --with-ssl=0 --with-x=0 --with-fortran-bindings=0 --with-cudac=0 --with-shared-libraries=0 --with-cc=gcc --with-cxx=g++ CXXFLAGS=-fno-stack-protector CFLAGS=-fno-stack-protector FFLAGS=“-g -O2 -fallow-argument-mismatch -fallow-invalid-boz” --with-mpi-lib=/c/Windows/System32/msmpi.dll --with-mpi-include=/c/builds/workspace/deployEXE/3rdparty/include/msmpi CXXPPFLAGS=-I/c/builds/workspace/deployEXE/3rdparty/include/msmpi --with-mpiexec=“/C/Program\ Files/Microsoft\ MPI/Bin/mpiexec” --with-fc=gfortran --with-scalar-type=real --with-blaslapack-include= --with-blaslapack-lib=“-Wl,-rpath,/mingw64/bin -L/mingw64/bin -lopenblas” --download-metis --download-ptscotch --download-hypre --download-parmetis --download-mmg --download-parmmg --download-superlu --download-suitesparse --download-tetgen --download-slepc --download-hpddm --download-metis-cmake-arguments=“-G “MSYS Makefiles”” --download-parmetis-cmake-arguments=“-G “MSYS Makefiles”” --download-mmg-cmake-arguments=“-G “MSYS Makefiles”” --download-parmmg-cmake-arguments=“-DMPI\_GUESS\_LIBRARY\_NAME=MSMPI -G “MSYS Makefiles”” --download-superlu-cmake-arguments=“-G “MSYS Makefiles”” --download-hypre-configure-arguments=“–build=x86\_64-linux-gnu --host=x86\_64-linux-gnu” --download-slepc-configure-arguments=–download-arpack=[https://github.com/prj-/arpack-ng/archive/9fc0c71.tar.gz](https://github.com/prj-/arpack-ng/archive/9fc0c71.tar.gz) --download-superlu\_dist --download-superlu\_dist-cmake-arguments=“-DMPI\_GUESS\_LIBRARY\_NAME=MSMPI -G “MSYS Makefiles” -DXSDK\_ENABLE\_Fortran=OFF” PETSC\_ARCH=fr  
> [2]PETSC ERROR: #1 User provided function() at unknown file:0  
> [2]PETSC ERROR: Run with -malloc\_debug to check if memory corruption is causing the crash.

> job aborted:
> 
> [ranks] message
> 
> [0-1] terminated
> 
> [2] application aborted  
> aborting MPI\_COMM\_WORLD (comm=0x44000000), error 59, comm rank 2
> 
> [3-5] terminated
> 
> ---- error analysis -----
> 
> [2] on TSL-ORDI  
> C:\TSL\programme\FreeFem411\FreeFem+±mpi.exe aborted the job. abort code 59
> 
> ---- error analysis -----

Details of my installation :

- Windows 10 (32 coeurs, RAM=32Go)
- freefem++ 4.11 (install with exe file)
- MPI V10.1.2

Has anyone had the same problem or have an idea of solution?

Best Regards

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [November 22, 2022, 8:43pm UTC](https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136/2 "2022-11-22T20:43:24Z")

</div>

I cannot reproduce this error. Could you update to Windows 11 by any chance? Or try on a Linux box?

---

<div class="post-metadata">

**Author:** ![agTSL](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@agTSL](https://community.freefem.org/u/agTSL)\
**Post date:** [November 23, 2022, 8:31am UTC](https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136/3 "2022-11-23T08:31:47Z")

</div>

thank you for your answer. I will try on a ubuntu boot.

---

<div class="post-metadata">

**Author:** ![agTSL](https://avatars.discourse-cdn.com/v4/letter/a/f05b48/32.png) [@agTSL](https://community.freefem.org/u/agTSL)\
**Post date:** [November 23, 2022, 9:17am UTC](https://community.freefem.org/t/petsc-with-errors-depend-on-the-number-of-processors/2136/4 "2022-11-23T09:17:29Z")

</div>

It works with ubuntu, It will be the solution before update to W11.  
Thanks you
