# MPI Test for Apptainer Hybrid Approach

## Description

The basic idea behind the Hybrid Approach of apptainer is when you execute a
ApptainerCE container with MPI code, you will call `mpiexec` or a similar
launcher on the apptainer command itself. The MPI process outside of the
container will then work in tandem with MPI inside the container and the
containerized MPI code to instantiate the job.

The Open MPI/ApptainerCE workflow in detail:

- The MPI launcher (e.g., mpirun, mpiexec) is called by the resource manager or
  the user directly from a shell.
- Open MPI then calls the process management daemon (ORTED).
- The ORTED process launches the ApptainerCE container requested by the
  launcher command.
- ApptainerCE instantiates the container and namespace environment.
- ApptainerCE then launches the MPI application within the container.
- The MPI application launches and loads the Open MPI libraries.
- The Open MPI libraries connect back to the ORTED process via the Process
  Management Interface (PMI).

For more information refer to the apptainer documentation[^1].

## Technical Information

This test case features a simple mpi hello world program to test an OpenMPI
installation named `mpitest.c`. Furthermore, the test contains a apptainer
definition file `hybrid-mpi.def` to build `libfabric` and `OpenMPI` into a
apptainer image for testing the hybrid approach. The apptainer image can be
build with

```shell
sudo apptainer build hybrid-openmpi.sif hybrid-openmpi.def
```

and run with

```shell
mpirun -n 2 apptainer run hybrid-openmpi.sif /opt/mpitest
```

## Additional Remarks

The test case is built into the openfoam docker image as well. It is located at
`/opt/mpitest`.

The test case is not executed in the frame of merge requests.

## Literature

[^1]: <https://docs.sylabs.io/guides/latest/user-guide/mpi.html>
