WavefrontExecutionPolicy - SeqAn API Documentation

# Spec WavefrontExecutionPolicy
Policy to select runtime execution mode for algorithms.

Extends | ExecutionPolicy
All Extended | ExecutionPolicy
Defined in | <seqan/align_parallel.h>
Signature | `template<typename TWaveSpec, typename TVectorizationMode> struct ExecutionPolicy<WavefrontAlignment<TWaveSpec>, TVectorizationMode>;`

## Template Parameters

`TWaveSpec` | Type specializing the wave-front threading model. Can be `void` (default) or BlockOffsetOptimization.
`TVectorizationMode` | Type specifying the vectorization model. Can be Vectorial or Serial (default).

## Interface Function Overview

- `size_t blockSize(exec);`
  Getter for the current block size.
- `void parallelAlignments(exec);`
  Getter for the current number of alignments executed in parallel.
- `void setBlockSize(exec, bs);`
  Setter for the current block size.
- `void setParallelAlignments(exec, pa);`
  Setter for the current number of alignments executed in parallel.

### Interface Functions Inherited From ExecutionPolicy

- `numThreads`
- `setNumThreads`

## Interface Metafunction Overview

### Interface Metafunctions Inherited From ExecutionPolicy

- `IsExecutionPolicy`
- `IsParallel`
- `IsVectorized`

## Member Variable Overview

- `size_t WavefrontExecutionPolicy::blockSize`
  The size of the blocks to use. Defaults to 100.
- `size_t WavefrontExecutionPolicy::parallelAlignments`
  Number of alignments scheduled concurrently. Defaults to `std::thread::hardware_concurrency()`.

### Member Variables Inherited From ExecutionPolicy

- `numThreads`

## Detailed Description

Special execution policy for computing sequence alignments with wave-front parallelization strategy. In the wave-front execution the DP matrix is partitioned into blocks which can be executed in parallel along the minor diagonal of the DP matrix. The execution policy can be further specialized if used in combination with the Vectorial execution mode (see WavefrontExecutionPolicy).

### Vectorization

In the vectorization mode, the blocks are gathered into SIMD registers. The BlockOffsetOptimization can be used to always ensure that `sizeof(SIMD) / 2` many blocks can be packed into one SIMD register. This requires, that the available instruction set supports 16 bit packed SIMD operations (e.g. SSE4, AVX2) and the score value type (Score) is bigger then 16 bit. In the default mode, the optimization is disabled and the number of packed alignment blocks is solely determined by the score value type passed to the algorithm as a parameter (e.g. see globalAlignmentScore).

## Interface Functions Detail

### `size_t blockSize(exec);`

Getter for the current block size.

#### Parameters

`exec` | The wave-front execution policy to query.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void parallelAlignments(exec);`

Getter for the current number of alignments executed in parallel.

#### Parameters

`exec` | The wave-front execution policy to update.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void setBlockSize(exec, bs);`

Setter for the current block size.

#### Parameters

`exec` | The wave-front execution policy to update.
`bs` | The new block size to set. Must be a positive integral number greater or equal than 5.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

### `void setParallelAlignments(exec, pa);`

Setter for the current number of alignments executed in parallel.

#### Parameters

`exec` | The wave-front execution policy to update.
`pa` | The number of alignments to execute in parallel. Must be a positive integral number greater than 0.

#### Data Races

If not stated otherwise, concurrent invocation is not guaranteed to be thread-safe.

## Member Variables Detail

### `size_t WavefrontExecutionPolicy::blockSize`

The size of the blocks to use. Defaults to 100.

### `size_t WavefrontExecutionPolicy::parallelAlignments`

Number of alignments scheduled concurrently. Defaults to `std::thread::hardware_concurrency()`.

#### Dox Sources

    /*!
     * @class WavefrontExecutionPolicy
     *
     * @extends ExecutionPolicy
     *
     * @headerfile <seqan/align_parallel.h>
     *
     * @brief Policy to select runtime execution mode for algorithms.
     *
     * @signature template<typename TWaveSpec, typename TVectorizationMode> struct
     *            ExecutionPolicy<WavefrontAlignment<TWaveSpec>,
     *            TVectorizationMode>;
     *
     * @tparam TWaveSpec Type specializing the wave-front threading model. Can be
     *                   <tt>void</tt> (default) or @link BlockOffsetOptimization
     *                   @endlink.
     * @tparam TVectorizationMode Type specifying the vectorization model. Can be
     *                            @link ParallelismTags#Vectorial @endlink or @link
     *                            ParallelismTags#Serial @endlink (default).
     *
     * Special execution policy for computing sequence alignments with wave-front
     * parallelization strategy. In the wave-front execution the DP matrix is
     * partitioned into blocks which can be executed in parallel along the minor
     * diagonal of the DP matrix. The execution policy can be further specialized if
     * used in combination with the @link ParallelismTags#Vectorial @endlink
     * execution mode (see @link WavefrontExecutionPolicy @endlink).
     *
     * @section Vectorization
     *
     * In the vectorization mode, the blocks are gathered into SIMD registers. The
     * @link BlockOffsetOptimization @endlink can be used to always ensure that
     * <tt>sizeof(SIMD) / 2</tt> many blocks can be packed into one SIMD register.
     * This requires, that the available instruction set supports 16 bit packed SIMD
     * operations (e.g. SSE4, AVX2) and the score value type (@link Score @endlink)
     * is bigger then 16 bit. In the default mode, the optimization is disabled and
     * the number of packed alignment blocks is solely determined by the score value
     * type passed to the algorithm as a parameter (e.g. see @link
     * globalAlignmentScore @endlink).
     *
     * @fn WavefrontExecutionPolicy#blockSize
     *
     * @brief Getter for the current block size.
     *
     * @signature size_t blockSize(exec);
     *
     * @param[in] exec The wave-front execution policy to query.
     *
     * @fn WavefrontExecutionPolicy#setBlockSize
     *
     * @brief Setter for the current block size.
     *
     * @signature void setBlockSize(exec, bs);
     *
     * @param[in,out] exec The wave-front execution policy to update.
     * @param[in] bs The new block size to set. Must be a positive integral number
     *               greater or equal than 5.
     *
     * @fn WavefrontExecutionPolicy#parallelAlignments
     *
     * @brief Getter for the current number of alignments executed in parallel.
     *
     * @signature void parallelAlignments(exec);
     *
     * @param[in] exec The wave-front execution policy to update.
     *
     * @fn WavefrontExecutionPolicy#setParallelAlignments
     *
     * @brief Setter for the current number of alignments executed in parallel.
     *
     * @signature void setParallelAlignments(exec, pa);
     *
     * @param[in,out] exec The wave-front execution policy to update.
     * @param[in] pa The number of alignments to execute in parallel. Must be a
     *               positive integral number greater than 0.
     *
     * @var size_t WavefrontExecutionPolicy::blockSize;
     *
     * @brief The size of the blocks to use. Defaults to 100.
     *
     *
     *
     * @var size_t WavefrontExecutionPolicy::parallelAlignments;
     *
     * @brief Number of alignments scheduled concurrently. Defaults to
     *        <tt>std::thread::hardware_concurrency()</tt>.
     */