Skip to content

Parallel computations

Arne Morten Kvarving edited this page Aug 2, 2018 · 2 revisions

Parallel computations using IFEM

The IFEM library was designed with parallel computations in mind, both from a user's point of view as well as for application designers. The parallel nature of the computer is abstracted away to the extent possible, leaving practically no interaction between application designers and parallel APIs such as MPI necessary.

Support available in IFEM

IFEM supports two modes of parallel computations.

  • Distributed memory (MPI) parallelization through PETSc
  • Shared memory (OpenMP) parallelization through OpenMP

Distributed memory parallelization

When you utilize distributed memory parallelization through PETSc, a patch is the smallest entity. You can then map the different patches from a multi-patch model onto different processes. You do this through adding one or several blocks to the geometry context in your input file. These blocks are of the format

<partitioning procs=2">
  <part proc="0" lower="1" upper="3"/>
  <part proc="1" lower="4" upper="6"/>
</partitioning>

or the shorter form

<partitioning procs="2" nperproc="3"/>

Here procs is the number of processes, proc indicates the particular rank in the process (0 indexed), while lower and upper are lower and upper patch bounds (1 indexed). Here we have 6 patches in total, divided among 2 processes each holding 3 patches.

You can have several such blocks corresponding to different amount of processes. The appropriate one will be chosen by the system.

Shared memory parallelization

By itself, this mode only enables parallel assembly, leaving you with a serial equation solver. You can enable it by passing '-DIFEM_USE_OPENMP=1' to CMake when configuring the IFEM build system.

Contrary to distributed memory parallelization, no input is needed from the user. IFEM will determine the amount of available threads and subdivide the patches in appropriate thread groups that allow for simultaneous assembly.

You can control the amount of used threads through the OMP_NUM_THREADS environment variable as for other OpenMP based code.