Update MPI jobs authored by Alain O' Miniussi's avatar Alain O' Miniussi
:construction_site: under construction, please consult [this](https://crimson.oca.eu/fr/acces-fonctionnement/gestion-des-jobs/1340-exemples-de-scripts) in the meantime
[**M**essage **P**assing **I**nterface](https://www.mpi-forum.org/) (MPI) can be used to distribute parallel aplication on more than one node. We support the Intel implementation.[^1] [**M**essage **P**assing **I**nterface](https://www.mpi-forum.org/) (MPI) can be used to distribute parallel aplication on more than one node. We support the Intel implementation.[^1]
## Get the example
```
14:56:53 [alainm@pollux view]# git clone https://gitlab.oca.eu/DSI/HPC.git
Cloning into 'HPC'...
...
Resolving deltas: 100% (39/39), done.
14:58:03 [alainm@pollux view]# cd HPC/SLURM/MPI/
14:58:10 [alainm@pollux MPI]# ls
build.sh CMakeLists.txt mpi.cpp run.slurm
14:58:12 [alainm@pollux MPI]#
```
## Build
```
15:06:26 [alainm@pollux MPI]# ./build.sh
~/view/HPC/SLURM/MPI/rel ~/view/HPC/SLURM/MPI
...
Scanning dependencies of target dice
[ 50%] Building CXX object CMakeFiles/dice.dir/mpi.cpp.o
[100%] Linking CXX executable dice
[100%] Built target dice
~/view/HPC/SLURM/MPI
‘rel/dice’ -> ‘./dice’
15:07:12 [alainm@pollux MPI]#
```
## Run
```
15:07:12 [alainm@pollux MPI]# sbatch --partition=x40 --nodes=2 ./run.slurm
Submitted batch job 33544995
15:08:47 [alainm@pollux MPI]# more log-dice-33544995.out
Hi, this is processs 0 from node x001.cluster.local
...
Hi, this is processs 3 from node x002.cluster.local
..
Let's play dices.
Who's de best ?
This is 0, I got 2, I'm such a looser...
...
This is 3, I got 4, I'm so talented
15:08:54 [alainm@pollux MPI]#
```
## Script explanation
We are now describing the Slurm script [run.slurm](SLURM/MPI/build.sh). Note that we will run 2 task per node to illustrate the fact that the job will use more than one node, although this toy example would be happy with one job per core.
```
[^1]: which has an impact in term of Slurm integration. ```
[^1]: which has an impact in term of Slurm integration.
\ No newline at end of file