# pvbatch in Slurm

**URL:** https://discourse.paraview.org/t/pvbatch-in-slurm/12307
**Category:** ParaView Support
**Tags:** python
**Created:** [June 13, 2023, 12:54pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307 "2023-06-13T12:54:22Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [June 13, 2023, 12:54pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/1 "2023-06-13T12:54:22Z")

</div>

Hi,

I am trying to run pvbatch in parallel in a Slurm supercomputer. My submission script is:

```auto
#!/bin/bash

#SBATCH --account gen6879@skylake
#SBATCH --partition skylake
#SBATCH -n 2
#SBATCH --mail-type=BEGIN,FAIL,END
#SBATCH -J heat_map-post
#SBATCH -t 0-00:10:00

echo `which pvbatch`

srun -o %j-%t.cout -e %j-%t.cerr pvbatch toy.py

```

The output of `which pvbatch` is the one expected (it points to my installation of ParaView 5.11.1, the default one downloaded from ParaView’s website). `Toy.py` is a very simple MPI python script:

```auto
from mpi4py import MPI

MPI_rank = MPI.COMM_WORLD.Get_rank()
MPI_size = MPI.COMM_WORLD.Get_size()

print("MPI_rank =", MPI_rank)
print("MPI_size =", MPI_size)

```

At the moment, both ranks are printing exactly the same thing:

```auto
MPI_rank = 0
MPI_size = 1

```

I.e. pvbatch is not recognizing it is in a parallel environment composed of two ranks. Could you help me figure out what I am doing wrong?

Thanks a lot,

---

<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: [June 13, 2023, 12:56pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/2 "2023-06-13T12:56:16Z")

</div>

HI @Rigel

You need to run pvbatch itself with mpi.

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [June 13, 2023, 12:59pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/3 "2023-06-13T12:59:55Z")

</div>

Thanks Mathieu for your reply. How can we do it? Adding `--mpi` after `pvbatch` makes no difference.

---

<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: [June 13, 2023, 1:01pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/4 "2023-06-13T13:01:15Z")

</div>

`mpirun -np 2 pvbatch`

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [June 13, 2023, 1:04pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/5 "2023-06-13T13:04:33Z")

</div>

Thanks, but that’s it: I need to use `srun` in order to properly run the script within the supercomputer. How can we make `pvbatch` work in parallel with `srun`? For comparison, the corresponding command `srun -o %j-%t.cout -e %j-%t.cerr python3 toy.py` works as expected.

---

<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: [June 13, 2023, 1:13pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/6 "2023-06-13T13:13:43Z")

</div>

do you build paraview against the srun provided mpi implementation ?

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [June 13, 2023, 1:15pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/7 "2023-06-13T13:15:41Z")

</div>

No, I am just using the pre-compiled binaries that we download from ParaView’s website, stored in my home directory within the cluster

---

<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: [June 13, 2023, 1:17pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/8 "2023-06-13T13:17:06Z")

</div>

Then you either need to use MPICH compatibility if available on your system or build ParaView yourself.

> [@Leveraging MPICH ABI compatibility for distributed binaries](https://discourse.paraview.org/t/leveraging-mpich-abi-compatibility-for-distributed-binaries/3441):
>
> Note: this discussion only applies to Linux, and not Windows or macOS Anyone who has used ParaView in HPC environments should be very familiar with this MPI specific issue: if want to use the MPI implementation provided by your HPC system (which is most likely tuned for your HPC hardware) you must make sure your application executables are built against the same MPI implementation. For most ParaView HPC site administrators and users, this translates to the aphorism: for HPC, build your own Para…

`pvbatch --system-mpi`

---

<div class="post-metadata">

### Author: ![Rigel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/r/8e7dd6/32.png) [@Rigel](https://discourse.paraview.org/u/Rigel)
#### Post date: [June 13, 2023, 2:46pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/9 "2023-06-13T14:46:57Z")

</div>

Ok. Thanks. It is sad that we cannot use pvbatch in parallel with the pre-compiled binaries within clusters…

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [June 13, 2023, 2:59pm UTC](https://discourse.paraview.org/t/pvbatch-in-slurm/12307/10 "2023-06-13T14:59:00Z")

</div>

I don’t think that’s the right takeaway here. Just to clarify:

First, determine which MPI implementations are provided by your HPC system.

If any MPI implementaiton that is listed [here](https://www.mpich.org/abi/) are available on your system i.e. it is compatible with MPICH ABI, then you’re golden. `module load ...` (or whatever is recommended on your system) the appropriate MPI implementation and then ensure you pass `--system-mpi` command line argument to pvbatch.

If not, you’ll need to build ParaView from source using the MPI implementation available.
