3.10. MPI Applications¶
From a RP perspective, tasks that execute MPI applications are analogous to non-MPI tasks: they define an executable alongside its arguments and other related parameters. MPI tasks have two main characteristics: (a) allocating a specified number of cores; and (b) needing to be started under an MPI regime. The respective task description entries are shown below:
cud = rp.TaskDescription()
cud.executable = '/bin/echo'
cud.arguments = ['-n', '$RP_TASK_ID ']
cud.cores = 2
cud.mpi = True
This example should result in the task ID echo’ed twice, once per MPI rank.
Note
Some RP configurations require MPI applications to be linked against a specific version of OpenMPI. Please open a ticket if you need support with relinking your application.
3.10.1. Running the Example¶
09_mpi_tasks.py.
uses the code above to run a bag of duplicated echo commands.
Note
This example requires a working MPI installation. Without it, it will fail.
3.10.2. What’s Next?¶
The next section describes how to insert arbitrary setup commands before and after .. the execution of a task.