# PETSc reports an error

**URL:** <https://community.freefem.org/t/petsc-reports-an-error/1987>\
**Category:** General Discussion\
**Created:** [September 4, 2022, 1:48pm UTC](https://community.freefem.org/t/petsc-reports-an-error/1987 "2022-09-04T13:48:41Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Post date:** [September 4, 2022, 1:48pm UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/1 "2022-09-04T13:48:41Z")

</div>

Hello. When I use PETSc, when I use PETSc, the program can run smoothly when calculating the coarse grid(getARGV(“-global”, 128)). When the grid is refined(getARGV(“-global”, 2048)), PETSc calculates very slowly and reports an error. why?

[space.edp](https://community.freefem.org/uploads/short-url/12P0uRAsbWBimsJbVkhboidmIb7.edp) (1.7 KB)

---

<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:** [September 4, 2022, 7:13pm UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/2 "2022-09-04T19:13:41Z")

</div>

Use more MPI processes, or switch to a preconditioned iterative method instead of an exact LU solver.

---

<div class="post-metadata">

**Author:** ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Post date:** [September 5, 2022, 2:42am UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/3 "2022-09-05T02:42:43Z")

</div>

Thank you for your answer. I tried the iterative method, which can be calculated, but when the grid is refined to h = 1 / 256, an error will still be reported; Can you provide the example of adding MPI process under PETSc mentioned above? thank you

---

<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:** [September 5, 2022, 5:18am UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/4 "2022-09-05T05:18:26Z")

</div>

`ff-mpirun -n X script.edp` , with an increasing `X`.

---

<div class="post-metadata">

**Author:** ![Qianrui](https://avatars.discourse-cdn.com/v4/letter/q/9fc348/32.png) [@Qianrui](https://community.freefem.org/u/Qianrui)\
**Post date:** [September 5, 2022, 5:41am UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/5 "2022-09-05T05:41:31Z")

</div>

Hello, the number of processes has been increased, but the above problems still occur.

 ![屏幕截图 2022-09-05 134015](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/a/a0046d2c7f30b73521b9e0ae2a36be8f66ea22c3.png)  
 ![屏幕截图 2022-09-05 133851](https://canada1.discourse-cdn.com/flex030/uploads/freefem/original/2X/2/2dce4e40e8bffc968486117883f1d713ca110dec.png)

---

<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:** [September 5, 2022, 5:52am UTC](https://community.freefem.org/t/petsc-reports-an-error/1987/6 "2022-09-05T05:52:02Z")

</div>

That means the problem is too big for your machine, you’ll need to switch to a cluster.
