# MPMD: Multiple Program Multiple Data Execution Model

There is currently no direct support for starting multiple executables (MPMD model) in ParaStation's mpiexec. However, a wrapper shell script can be employed to use this model on JUROPA as explained in the following.

Suppose three executables prog1.x, prog2.x, and prog3.x should be executed in the MPMD model on three nodes, each executable running on one node with 8 MPI tasks. Then the following job script can be used

#MSUB -l nodes=3:ppn=8
#MSUB -l walltime=02:00:00
#MSUB -v tpt=1

mpiexec -np 24 mpmd_start.bash

where mpmd_start.bash looks as follows:

#!/bin/bash
if [ $PMI_RANK -lt 8 ]; then  exec ./prog1.x elif [$PMI_RANK -lt 16 ]; then
 exec ./prog2.x
else
 exec ./prog3.x
fi

The environment variable PMI_RANK contains the MPI rank of the corresponding process. Therefore, in the setup above the first 8 MPI tasks (rank 0 to 7) are executing prog1.x, the next 8 tasks (rank 8 to 15) are executing prog2.x and the remaining 8 tasks are executing prog3.x.