Skip to content

Partition Attributes

ddarriba edited this page Jun 2, 2016 · 7 revisions

Partition Attributes

This page explains how to use properly the attributes bitvector in the partition structure. The attributes should never be modified directly by accessing partition->attributes. They are set when the partition is created as a parameter to the function pll_partition_create.

As a brief description, the attributes is a bitvector that contains attributes that will determine how the computations are done, like for example which vector extensions are available or whether to use or not tip pattern compression.

In the interface, the individual attributes are defined as PLL_ATTRIB_%. In addition to these, some especial attributes with name PLL_ATTRIB_%_MASK are masks that cover a section of the bitvector for isolating a particular property. For example, PLL_ATTRIB_ARCH_MASK covers all different attributes regarding the architecture.

attributes bitvector

Architecture

Attribute Value Description
PLL_ATTRIB_ARCH_CPU 0 Do not use vector extensions
PLL_ATTRIB_ARCH_SSE (1 << 0) Use SSE3 vector extensions
PLL_ATTRIB_ARCH_AVX (1 << 1) Use AVX vector extensions
PLL_ATTRIB_ARCH_AVX2 (1 << 2) Use AVX2 vector extensions
PLL_ATTRIB_ARCH_AVX512 (1 << 3) Use AVX512 vector extensions
PLL_ATTRIB_ARCH_MASK 0xF Mask covering all the attributes in this section

Attributes in this section determine whether vector extensions can be used for the core pll computations or not. PLL_ATTRIB_ARCH_CPU is implicit as it does not involve any particular bit, so if no attribute regarding the architecture is set or the selected architecture is not available for any particular operation, pll will work with no vector extensions.

Architecture attributes are compatible between each other. That means that the attributes can be set as, for example,

attributes = PLL_ATTRIB_ARCH_CPU | PLL_ATTRIB_ARCH_SSE | PLL_ATTRIB_ARCH_AVX

For this example, the fastest available implementation (among AVX, SSE and CPU) will be selected in runtime for each operation.

Tip vectors

Attribute Value
PLL_ATTRIB_PATTERN_TIP (1 << 4)

//TODO: Complete

Ascertainment bias correction

Attribute Value Description
PLL_ATTRIB_ASC_BIAS_LEWIS (1<<5) Use Lewis correction
PLL_ATTRIB_ASC_BIAS_FELSENSTEIN (2<<5) Use Felsenstein correction
PLL_ATTRIB_ASC_BIAS_STAMATAKIS (3<<5) Use Stamatakis correction
PLL_ATTRIB_ASC_BIAS_MASK (7<<5) Mask covering the correction type
PLL_ATTRIB_ASC_BIAS_FLAG (1<<8) Flag determining asc bias support in the partition

Attributes in this section control whether the likelihood scores and derivatives are corrected for invariant sites or not by using ascertainment bias correction (from now on and in this section, ABC) algorithms. The PLL_ATTRIB_% values here work slightly different from a usual bitvector implementation. A set of 3 bits, from 5th to 7th, selects the ABC algorithm that will correct the likelihood scores. Additionally, 8th bit (PLL_ATTRIB_ASC_BIAS_FLAG) determines whether the partition is able to support ABC or not.

If the client code intends to use ABC, prior to create the partition the algorithm can be selected. However, another possibility is to set the PLL_ATTRIB_ASC_BIAS_FLAG and set (or change) the algorithm later by calling pll_set_asc_bias_type(). However, if the partition was created without ABC support, calling pll_set_asc_bias_type() will fail since the CLVs were not properly allocated to support ABC.

See the ascertainment bias correction section for specific and detailed information.