# run pvbatch in parallel using pvserver

**URL:** https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316
**Category:** ParaView Support
**Created:** [April 2, 2024, 11:54am UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316 "2024-04-02T11:54:10Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [April 2, 2024, 11:54am UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/1 "2024-04-02T11:54:10Z")

</div>

Hello,  
I have read the different posts around the forum, I am a little bit lost about this.  
I want to run a paraview script using several processors in a openfoam decomposed case (equal number of processors for paraview part and openfoam case data).  
I am in linux (ubuntu based) using the binaries from `ParaView-5.12.0-MPI-Linux-Python3.10-x86_64.tar.gz`  
which is the correct workflow?

1. create a server running `mpiexec -n $nProc pvserver`
2. run `mpiexec -np $nProc pvbatch --mpi myScript.py`  
should I use `mpiexec or mpirun`?  
while running the first command, I am already encountering the issue that the address is already used

```auto
mpirun -n 8 pvserver
Waiting for client...
Connection URL: cs://franco-precision7560:11111
Waiting for client...
Connection URL: cs://franco-precision7560:11111
Waiting for client...
Connection URL: cs://franco-precision7560:11111
Waiting for client...
Connection URL: cs://franco-precision7560:11111
Accepting connection(s): franco-precision7560:11111
( 0.436s) [pvserver] vtkSocket.cxx:241 ERR| vtkServerSocket (0x1d88050): Socket error in call to listen. Address already in use.
( 0.423s) [pvserver] vtkSocket.cxx:190 ERR| vtkServerSocket (0x2537060): Socket error in call to bind. Address already in use.
( 0.436s) [pvserver] vtkSocket.cxx:190 ERR| vtkServerSocket (0xd97060): Socket error in call to bind. Address already in use.
( 0.436s) [pvserver]vtkTCPNetworkAccessMana:441 ERR| vtkTCPNetworkAccessManager (0x1af4750): Failed to set up server socket.
( 0.423s) [pvserver]vtkTCPNetworkAccessMana:441 ERR| vtkTCPNetworkAccessManager (0x22a3750): Failed to set up server socket.
( 0.436s) [pvserver]vtkTCPNetworkAccessMana:441 ERR| vtkTCPNetworkAccessManager (0xb03750): Failed to set up server socket.
Exiting...

```

nevertheless I have tried to kill it using htop (looking for pvserver and kill the instance) but even after I am getting the error.  
how can I create a new pvserver? and associate it with pvbatch so it runs the script in the simulation in parallel.  
thanks in advance,

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 2, 2024, 11:58am UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/2 "2024-04-02T11:58:11Z")

</div>

> [@otaolafr](#):
>
> should I use `mpiexec or mpirun`?

you should use the `mpiexec` executable available in the `bin` directory

So your command should be (for pvserver)

```auto
cd path/to/paraview
./bin/mpiexec -np $nProc ./bin/pvserver

```

Then connect to your server using ParaView.

but since you want to use `pvbatch` you do not even need pvserver, just run:

```auto
cd path/to/paraview
./bin/mpiexec -np $nProc ./bin/pvbatch /path/to/myScript.py

```

---

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [April 2, 2024, 12:07pm UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/3 "2024-04-02T12:07:13Z")

</div>

hello mathieu,  
thanks for your answer, and what can I do for the error I am getting from the pvserver command?  
if I do, I get:

```auto
nProc=8
./bin/mpiexec -np $nProc ./bin/pvserver
Waiting for client...
Connection URL: cs://franco-precision7560:11111
( 0.380s) [pvserver.0] vtkSocket.cxx:190 ERR| vtkServerSocket (0x22b6700): Socket error in call to bind. Address already in use.
( 0.380s) [pvserver.0]vtkTCPNetworkAccessMana:441 ERR| vtkTCPNetworkAccessManager (0x201d370): Failed to set up server socket.
Exiting...
Exiting...
Exiting...
Exiting...
Exiting...
Exiting...
Exiting...
Exiting...

```

thanks in advance

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 2, 2024, 12:19pm UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/4 "2024-04-02T12:19:39Z")

</div>

reboot, you may have pvservers running in the background.

---

<div class="post-metadata">

### Author: ![otaolafr](https://discourse.paraview.org/user_avatar/discourse.paraview.org/otaolafr/32/3595_2.png) [@otaolafr](https://discourse.paraview.org/u/otaolafr)
#### Post date: [April 2, 2024, 12:26pm UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/5 "2024-04-02T12:26:32Z")

</div>

After rebooting, the command `./bin/mpiexec -np $nProc ./bin/pvserver` is not finishing of running, is it normal? (it has already passed several minutes)  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/8/8574c9e9e54c4df2fdf516ec1c64266a32a7cd94.png)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [April 2, 2024, 12:28pm UTC](https://discourse.paraview.org/t/run-pvbatch-in-parallel-using-pvserver/14316/6 "2024-04-02T12:28:06Z")

</div>

Well, yes, the distributed `pvserver` is running, waiting for you to connect to it.
