# How can i mute PETSc?

**URL:** https://community.freefem.org/t/how-can-i-mute-petsc/1079
**Category:** General Discussion
**Created:** [July 4, 2021, 3:02pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079 "2021-07-04T15:02:03Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![mazzman](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mazzman](https://community.freefem.org/u/mazzman)
#### Post date: [July 4, 2021, 3:02pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/1 "2021-07-04T15:02:03Z")

</div>

How can I mute the messages coming from PETSc such as " — system solved with PETSc (in …)"?

Can I use `verbosity` to only print my cout massages to the console?

---

<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: [July 4, 2021, 7:47pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/2 "2021-07-04T19:47:00Z")

</div>

`-v 0` on your command line or `verbosity = 0` in your .edp script.  
These messages don’t come from PETSc by the way, but from the PETSc \<\> FreeFEM interface, just to be precise 😄

---

<div class="post-metadata">

### Author: ![mazzman](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mazzman](https://community.freefem.org/u/mazzman)
#### Post date: [July 6, 2021, 12:15pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/3 "2021-07-06T12:15:16Z")

</div>

With `verbosity=0` I don’t get any output.

---

<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: [July 6, 2021, 12:16pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/4 "2021-07-06T12:16:09Z")

</div>

That’s what you asked for, right?

---

<div class="post-metadata">

### Author: ![mazzman](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mazzman](https://community.freefem.org/u/mazzman)
#### Post date: [July 6, 2021, 12:17pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/5 "2021-07-06T12:17:09Z")

</div>

I want to see my `cout` messages only 😄

---

<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: [July 6, 2021, 12:19pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/6 "2021-07-06T12:19:24Z")

</div>

If you don’t see your `cout`, that means that your `cout` are guarded by `if(verbosity)`. Simple example:

```auto
$ cat test.edp
verbosity = 0;
cout << "foo" << endl;
if(verbosity > 0)
    cout << "bar1" << endl;
verbosity = 1;
if(verbosity > 0)
    cout << "bar2" << endl;
$ FreeFem++ test.edp
foo
bar2

```

---

<div class="post-metadata">

### Author: ![mazzman](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@mazzman](https://community.freefem.org/u/mazzman)
#### Post date: [July 6, 2021, 12:43pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/7 "2021-07-06T12:43:44Z")

</div>

I think I found the problem but not the solution:

```auto
verbosity=0;

real t=clock();
int n=0;

while(n<5){
	if(clock()-t > 1){
		cout << n <<endl;
		t=clock();
		n=n+1;
	}
}

```

From this delayed loop (eg. from solving systems) the messages are only printed ones the program has finished.

---

<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: [July 6, 2021, 3:40pm UTC](https://community.freefem.org/t/how-can-i-mute-petsc/1079/8 "2021-07-06T15:40:13Z")

</div>

This has nothing to do with the verbosity of PETSc.
