ALP User Documentation
0.8.preview
Algebraic Programming User Documentation
|
The ALP/GraphBLAS namespace. More...
Namespaces | |
algorithms | |
The namespace for ALP/GraphBLAS algorithms. | |
config | |
Compile-time configuration constants as well as implementation details that are derived from such settings. | |
descriptors | |
Collection of standard descriptors. | |
identities | |
Standard identities common to many operators. | |
interfaces | |
The namespace for programming APIs that automatically translate to ALP/GraphBLAS. | |
operators | |
This namespace holds various standard operators such as grb::operators::add and grb::operators::mul. | |
Classes | |
class | Benchmarker |
A class that follows the API of the grb::Launcher, but instead of launching the given ALP program once, it launches it multiple times while benchmarking its execution times. More... | |
class | collectives |
A static class defining various collective operations on scalars. More... | |
struct | has_immutable_nonzeroes |
Used to inspect whether a given semiring has immutable nonzeroes under addition. More... | |
struct | is_associative |
Used to inspect whether a given operator or monoid is associative. More... | |
struct | is_commutative |
Used to inspect whether a given operator or monoid is commutative. More... | |
struct | is_container |
Used to inspect whether a given type is an ALP/GraphBLAS container. More... | |
struct | is_idempotent |
Used to inspect whether a given operator or monoid is idempotent. More... | |
struct | is_monoid |
Used to inspect whether a given type is an ALP monoid. More... | |
struct | is_object |
Used to inspect whether a given type is an ALP/GraphBLAS object. More... | |
struct | is_operator |
Used to inspect whether a given type is an ALP operator. More... | |
struct | is_semiring |
Used to inspect whether a given type is an ALP semiring. More... | |
class | Launcher |
A group of user processes that together execute ALP programs. More... | |
class | Matrix |
An ALP/GraphBLAS matrix. More... | |
class | Monoid |
A generalised monoid. More... | |
class | PinnedVector |
Provides a mechanism to access ALP containers from outside of an ALP context. More... | |
class | Properties |
Collection of various properties on the given ALP/GraphBLAS backend. More... | |
class | Semiring |
A generalised semiring. More... | |
class | spmd |
For backends that support multiple user processes this class defines some basic primitives to support SPMD programming. More... | |
class | Vector |
A GraphBLAS vector. More... | |
Typedefs | |
template<typename InputType , typename OutputType > | |
using | AlpTypedFunc = void(*)(const InputType &, OutputType &) |
Type definition for an ALP function with input type information. | |
template<typename OutputType > | |
using | AlpUntypedFunc = void(*)(const void *, size_t, OutputType &) |
Type definition for an ALP function without input type information. | |
typedef unsigned int | Descriptor |
Descriptors indicate pre- or post-processing for some or all of the arguments to an ALP/GraphBLAS call. More... | |
Enumerations | |
enum | Backend { reference, reference_omp, hyperdags, nonblocking , BSP1D , hybrid , banshee } |
A collection of all backends. More... | |
enum | EXEC_MODE { AUTOMATIC = 0, MANUAL, FROM_MPI } |
The various ways in which the grb::Launcher can be used to execute an ALP program. More... | |
enum | IOMode { SEQUENTIAL = 0, PARALLEL } |
The GraphBLAS input and output functionalities can either be used in a sequential or parallel fashion. More... | |
enum | Phase { RESIZE, TRY, EXECUTE } |
Primitives with sparse ALP/GraphBLAS output containers may run into the issue where an appropriate grb::capacity may not always be clear. More... | |
enum | RC { SUCCESS = 0, PANIC, OUTOFMEM, MISMATCH, OVERLAP, OVERFLW, UNSUPPORTED, ILLEGAL, FAILED } |
Return codes of ALP primitives. More... | |
Functions | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType1 , typename InputType2 , typename OutputType > | |
static enum RC | apply (OutputType &out, const InputType1 &x, const InputType2 &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< OutputType >::value, void >::type *=nullptr) |
Out-of-place application of the operator OP on two data elements. More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename RIT , typename CIT , typename NIT , typename fwd_iterator1 = const RIT * __restrict__, typename fwd_iterator2 = const CIT * __restrict__, typename fwd_iterator3 = const InputType * __restrict__, Backend implementation = config::default_backend> | |
RC | buildMatrixUnique (Matrix< InputType, implementation, RIT, CIT, NIT > &A, fwd_iterator1 I, const fwd_iterator1 I_end, fwd_iterator2 J, const fwd_iterator2 J_end, fwd_iterator3 V, const fwd_iterator3 V_end, const IOMode mode) |
Assigns nonzeroes to the matrix from a coordinate format. More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename RIT , typename CIT , typename NIT , typename fwd_iterator1 = const RIT * __restrict__, typename fwd_iterator2 = const CIT * __restrict__, typename fwd_iterator3 = const InputType * __restrict__, Backend implementation = config::default_backend> | |
RC | buildMatrixUnique (Matrix< InputType, implementation, RIT, CIT, NIT > &A, fwd_iterator1 I, fwd_iterator2 J, fwd_iterator3 V, const size_t nz, const IOMode mode) |
Alias that transforms a set of pointers and an array length to the buildMatrixUnique variant based on iterators. | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename RIT , typename CIT , typename NIT , typename fwd_iterator1 = const RIT * __restrict__, typename fwd_iterator2 = const CIT * __restrict__, typename length_type = size_t, Backend implementation = config::default_backend> | |
RC | buildMatrixUnique (Matrix< InputType, implementation, RIT, CIT, NIT > &A, fwd_iterator1 I, fwd_iterator2 J, const length_type nz, const IOMode mode) |
Version of the above buildMatrixUnique that handles nullptr value pointers. | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename RIT , typename CIT , typename NIT , typename fwd_iterator1 = const RIT * __restrict__, typename fwd_iterator2 = const CIT * __restrict__, Backend implementation = config::default_backend> | |
RC | buildMatrixUnique (Matrix< InputType, implementation, RIT, CIT, NIT > &A, fwd_iterator1 I, const fwd_iterator1 I_end, fwd_iterator2 J, const fwd_iterator2 J_end, const IOMode mode) |
Version of the above buildMatrixUnique that handles nullptr value pointers. | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename RIT , typename CIT , typename NIT , typename fwd_iterator , Backend implementation = config::default_backend> | |
RC | buildMatrixUnique (Matrix< InputType, implementation, RIT, CIT, NIT > &A, fwd_iterator start, const fwd_iterator end, const IOMode mode) |
Version of buildMatrixUnique that works by supplying a single iterator (instead of three). More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType , typename fwd_iterator , Backend backend, typename Coords > | |
RC | buildVector (Vector< InputType, backend, Coords > &x, fwd_iterator start, const fwd_iterator end, const IOMode mode) |
Constructs a dense vector from a container of exactly grb::size(x) elements. More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType , class Merger = operators::right_assign< InputType >, typename fwd_iterator1 , typename fwd_iterator2 , Backend backend, typename Coords > | |
RC | buildVector (Vector< InputType, backend, Coords > &x, fwd_iterator1 ind_start, const fwd_iterator1 ind_end, fwd_iterator2 val_start, const fwd_iterator2 val_end, const IOMode mode, const Merger &merger=Merger()) |
Ingests possibly sparse input from a container to which iterators are provided. More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType , class Merger = operators::right_assign< InputType >, typename fwd_iterator1 , typename fwd_iterator2 , Backend backend, typename Coords > | |
RC | buildVectorUnique (Vector< InputType, backend, Coords > &x, fwd_iterator1 ind_start, const fwd_iterator1 ind_end, fwd_iterator2 val_start, const fwd_iterator2 val_end, const IOMode mode) |
Ingests a set of nonzeroes into a given vector x. More... | |
template<typename InputType , Backend backend, typename Coords > | |
size_t | capacity (const Vector< InputType, backend, Coords > &x) noexcept |
Queries the capacity of the given ALP/GraphBLAS container. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
size_t | capacity (const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept |
Queries the capacity of the given ALP/GraphBLAS container. More... | |
template<typename DataType , Backend backend, typename Coords > | |
RC | clear (Vector< DataType, backend, Coords > &x) noexcept |
Clears a given vector of all nonzeroes. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
RC | clear (Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept |
Clears a given matrix of all nonzeroes. More... | |
template<Descriptor descr = descriptors::no_operation, class AddMonoid , class AnyOp , typename OutputType , typename InputType1 , typename InputType2 , enum Backend backend, typename Coords > | |
RC | dot (OutputType &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const AddMonoid &addMonoid=AddMonoid(), const AnyOp &anyOp=AnyOp(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< AddMonoid >::value &&grb::is_operator< AnyOp >::value, void >::type *const =nullptr) |
Calculates the dot product, \( z += (x,y) \), under a given additive monoid and multiplicative operator. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , Backend backend, typename Coords > | |
RC | dot (IOType &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< IOType >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the dot product, \( z += (x,y) \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition of two vectors, \( z += x .+ y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += x .+ \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseAdd (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
Calculates the element-wise addition, \( z += \alpha .+ \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, operator and masked version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename OutputType , typename InputType1 , typename InputType2 , typename RIT1 , typename CIT1 , typename NIT1 , typename RIT2 , typename CIT2 , typename NIT2 , typename RIT3 , typename CIT3 , typename NIT3 , Backend backend> | |
RC | eWiseApply (Matrix< OutputType, backend, RIT1, CIT1, NIT1 > &C, const Matrix< InputType1, backend, RIT2, CIT2, NIT2 > &A, const Matrix< InputType2, backend, RIT3, CIT3, NIT3 > &B, const Monoid &monoid, const Phase phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( C = A \odot B \), out of place, monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, monoid version. More... | |
template<Descriptor descr = grb::descriptors::no_operation, class Operator , typename OutputType , typename InputType1 , typename InputType2 , typename RIT1 , typename CIT1 , typename NIT1 , typename RIT2 , typename CIT2 , typename NIT2 , typename RIT3 , typename CIT3 , typename NIT3 , Backend backend> | |
RC | eWiseApply (Matrix< OutputType, backend, RIT1, CIT1, NIT1 > &C, const Matrix< InputType1, backend, RIT2, CIT2, NIT2 > &A, const Matrix< InputType2, backend, RIT3, CIT3, NIT3 > &B, const Operator &op, const Phase phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< Operator >::value, void >::type *const =nullptr) |
Computes \( C = A \odot B \), out of place, operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot \beta \), out of place, masked monoid version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, masked operator version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, monoid version. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = \alpha \odot y \), out of place, masked monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, masked operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot \beta \), out of place, masked monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const OP &op=OP(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, masked operator variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, monoid variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , enum Backend backend, typename OutputType , typename MaskType , typename InputType1 , typename InputType2 , typename Coords > | |
RC | eWiseApply (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Monoid &monoid=Monoid(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Computes \( z = x \odot y \), out of place, masked monoid variant. More... | |
template<typename Func , typename DataType , typename RIT , typename CIT , typename NIT , Backend implementation = config::default_backend, typename... Args> | |
RC | eWiseLambda (const Func f, const Matrix< DataType, implementation, RIT, CIT, NIT > &A, Args...) |
Executes an arbitrary element-wise user-defined function f on all nonzero elements of a given matrix A. More... | |
template<typename Func , typename DataType , Backend backend, typename Coords , typename... Args> | |
RC | eWiseLambda (const Func f, const Vector< DataType, backend, Coords > &x, Args...) |
Executes an arbitrary element-wise user-defined function f on any number of vectors of equal length. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two vectors, \( z += x .* y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const Vector< InputType2, backend, Coords > &y, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a scalar and vector, \( z += \alpha .* y \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &x, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of a vector and scalar, \( z += x .* \beta \), under a given semiring, masked variant. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , enum Backend backend, typename InputType1 , typename InputType2 , typename OutputType , typename MaskType , typename Coords > | |
RC | eWiseMul (Vector< OutputType, backend, Coords > &z, const Vector< MaskType, backend, Coords > &mask, const InputType1 alpha, const InputType2 beta, const Ring &ring=Ring(), const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&grb::is_semiring< Ring >::value, void >::type *const =nullptr) |
In-place element-wise multiplication of two scalars, \( z += \alpha .* \beta \), under a given semiring, masked variant. More... | |
template<enum Backend backend = config::default_backend> | |
RC | finalize () |
Finalises an ALP/GraphBLAS context opened by the last call to grb::init. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType , typename IOType > | |
static RC | foldl (IOType &x, const InputType &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType >::value &&!grb::is_object< IOType >::value, void >::type *=nullptr) |
Application of the operator OP on two data elements. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename InputType , typename IOType , typename MaskType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Vector< MaskType, backend, Coords > &mask, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Reduces, or folds, a vector into a scalar. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename IOType , typename InputType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, left-to-right. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , typename IOType , typename InputType , typename MaskType , Backend backend, typename Coords > | |
RC | foldl (IOType &x, const Vector< InputType, backend, Coords > &y, const Vector< MaskType, backend, Coords > &mask, const OP &op=OP(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< MaskType >::value &&grb::is_operator< OP >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, left-to-right. More... | |
template<Descriptor descr = descriptors::no_operation, class OP , typename InputType , typename IOType > | |
static RC | foldr (const InputType &x, IOType &y, const OP &op=OP(), const typename std::enable_if< grb::is_operator< OP >::value &&!grb::is_object< InputType >::value &&!grb::is_object< IOType >::value, void >::type *=nullptr) |
Application of the operator OP on two data elements. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename InputType , typename IOType , typename MaskType , Backend backend, typename Coords > | |
RC | foldr (const Vector< InputType, backend, Coords > &x, const Vector< MaskType, backend, Coords > &mask, IOType &y, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&!grb::is_object< InputType >::value &&!grb::is_object< MaskType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, right-to-left. More... | |
template<Descriptor descr = descriptors::no_operation, class Monoid , typename IOType , typename InputType , Backend backend, typename Coords > | |
RC | foldr (const Vector< InputType, backend, Coords > &y, IOType &x, const Monoid &monoid=Monoid(), const typename std::enable_if< !grb::is_object< IOType >::value &&grb::is_monoid< Monoid >::value, void >::type *const =nullptr) |
Folds a vector into a scalar, right-to-left. More... | |
template<typename ElementType , typename Coords , Backend implementation = config::default_backend> | |
uintptr_t | getID (const Vector< ElementType, implementation, Coords > &x) |
Function that returns a unique ID for a given non-empty container. More... | |
template<typename ElementType , typename RIT , typename CIT , typename NIT , Backend implementation = config::default_backend> | |
uintptr_t | getID (const Matrix< ElementType, implementation, RIT, CIT, NIT > &x) |
Specialisation of getID for matrix containers. More... | |
template<enum Backend backend = config::default_backend> | |
RC | init (const size_t s, const size_t P, void *const implementation_data) |
Initialises the calling user process. More... | |
template<enum Backend backend = config::default_backend> | |
RC | init () |
Initialises the calling user process. More... | |
template<Descriptor descr = descriptors::no_operation, typename OutputType , typename InputType1 , typename InputType2 , typename CIT1 , typename RIT1 , typename NIT1 , typename CIT2 , typename RIT2 , typename NIT2 , typename CIT3 , typename RIT3 , typename NIT3 , class Semiring , Backend backend> | |
RC | mxm (Matrix< OutputType, backend, CIT1, RIT1, NIT1 > &C, const Matrix< InputType1, backend, CIT2, RIT2, NIT2 > &A, const Matrix< InputType2, backend, CIT3, RIT3, NIT3 > &B, const Semiring &ring=Semiring(), const Phase &phase=EXECUTE) |
Unmasked and in-place sparse matrix–sparse matrix multiplication (SpMSpM), \( C += A+B \). More... | |
template<Descriptor descr = descriptors::no_operation, class Semiring , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename InputType4 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | mxv (Vector< IOType, backend, Coords > &u, const Vector< InputType3, backend, Coords > &u_mask, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const Vector< InputType1, backend, Coords > &v, const Vector< InputType4, backend, Coords > &v_mask, const Semiring &semiring=Semiring(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_semiring< Semiring >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< InputType3 >::value &&!grb::is_object< InputType4 >::value, void >::type *const =nullptr) |
Right-handed in-place doubly-masked sparse matrix times vector multiplication, \( u = u + Av \). More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename RIT , typename CIT , typename NIT , typename Coords , enum Backend implementation = config::default_backend> | |
RC | mxv (Vector< IOType, implementation, Coords > &u, const Vector< InputType3, implementation, Coords > &mask, const Matrix< InputType2, implementation, RIT, CIT, NIT > &A, const Vector< InputType1, implementation, Coords > &v, const Ring &ring=Ring(), const Phase &phase=EXECUTE, typename std::enable_if< grb::is_semiring< Ring >::value, void >::type *=nullptr) |
Right-handed in-place masked sparse matrix–vector multiplication, \( u = u + Av \), over a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , typename Coords , typename RIT , typename CIT , typename NIT , Backend implementation = config::default_backend> | |
RC | mxv (Vector< IOType, implementation, Coords > &u, const Matrix< InputType2, implementation, RIT, CIT, NIT > &A, const Vector< InputType1, implementation, Coords > &v, const Ring &ring, typename std::enable_if< grb::is_semiring< Ring >::value, void >::type *=nullptr) |
Right-handed in-place sparse matrix–vector multiplication, \( u = u + Av \), over a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename InputType4 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | mxv (Vector< IOType, backend, Coords > &u, const Vector< InputType3, backend, Coords > &mask, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const Vector< InputType1, backend, Coords > &v, const Vector< InputType4, backend, Coords > &v_mask, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< InputType3 >::value &&!grb::is_object< InputType4 >::value &&!std::is_same< InputType2, void >::value, void >::type *const =nullptr) |
Right-handed in-place doubly-masked sparse matrix–vector multiplication, \( u = u + Av \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | mxv (Vector< IOType, backend, Coords > &u, const Vector< InputType3, backend, Coords > &mask, const Matrix< InputType2, backend, RIT, NIT, CIT > &A, const Vector< InputType1, backend, Coords > &v, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< InputType3 >::value &&!std::is_same< InputType2, void >::value, void >::type *const =nullptr) |
Right-handed in-place masked sparse matrix–vector multiplication, \( u = u + Av \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | mxv (Vector< IOType, backend, Coords > &u, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const Vector< InputType1, backend, Coords > &v, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!std::is_same< InputType2, void >::value, void >::type *const =nullptr) |
Right-handed in-place sparse matrix–vector multiplication, \( u = u + Av \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
size_t | ncols (const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept |
Requests the column size of a given matrix. More... | |
template<typename DataType , Backend backend, typename Coords > | |
size_t | nnz (const Vector< DataType, backend, Coords > &x) noexcept |
Request the number of nonzeroes in a given vector. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
size_t | nnz (const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept |
Retrieve the number of nonzeroes contained in this matrix. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
size_t | nrows (const Matrix< InputType, backend, RIT, CIT, NIT > &A) noexcept |
Requests the row size of a given matrix. More... | |
template<typename InputType , Backend backend, typename Coords > | |
RC | resize (Vector< InputType, backend, Coords > &x, const size_t new_nz) noexcept |
Resizes the nonzero capacity of this vector. More... | |
template<typename InputType , Backend backend, typename RIT , typename CIT , typename NIT > | |
RC | resize (Matrix< InputType, backend, RIT, CIT, NIT > &A, const size_t new_nz) noexcept |
Resizes the nonzero capacity of this matrix. More... | |
template<Descriptor descr = descriptors::no_operation, typename DataType , typename T , typename Coords , Backend backend> | |
RC | set (Vector< DataType, backend, Coords > &x, const T val, const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< DataType >::value &&!grb::is_object< T >::value, void >::type *const =nullptr) noexcept |
Sets all elements of a vector to the given value. More... | |
template<Descriptor descr = descriptors::no_operation, typename DataType , typename MaskType , typename T , Backend backend, typename Coords > | |
RC | set (Vector< DataType, reference, Coords > &x, const Vector< MaskType, backend, Coords > &mask, const T val, const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< DataType >::value &&!grb::is_object< T >::value, void >::type *const =nullptr) |
Sets all elements of a vector to the given value whenever the given mask evaluates true . More... | |
template<Descriptor descr = descriptors::no_operation, typename OutputType , typename InputType , Backend backend, typename Coords > | |
RC | set (Vector< OutputType, backend, Coords > &x, const Vector< InputType, backend, Coords > &y, const Phase &phase=EXECUTE) |
Sets the content of a given vector x to be equal to that of another given vector y. More... | |
template<Descriptor descr = descriptors::no_operation, typename OutputType , typename MaskType , typename InputType , Backend backend, typename Coords > | |
RC | set (Vector< OutputType, backend, Coords > &x, const Vector< MaskType, backend, Coords > &mask, const Vector< InputType, backend, Coords > &y, const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< OutputType >::value &&!grb::is_object< MaskType >::value &&!grb::is_object< InputType >::value, void >::type *const =nullptr) |
Sets the content of a given vector x to be equal to that of another given vector y. More... | |
template<Descriptor descr = descriptors::no_operation, typename DataType , typename T , Backend backend, typename Coords > | |
RC | setElement (Vector< DataType, backend, Coords > &x, const T val, const size_t i, const Phase &phase=EXECUTE, const typename std::enable_if< !grb::is_object< DataType >::value &&!grb::is_object< T >::value, void >::type *const =nullptr) |
Sets the element of a given vector at a given position to a given value. More... | |
template<typename DataType , Backend backend, typename Coords > | |
size_t | size (const Vector< DataType, backend, Coords > &x) noexcept |
Request the size of a given vector. More... | |
std::string | toString (const RC code) |
static std::string | toString (const enum grb::Backend backend) |
Converts a backend identifier to a human-readable string. More... | |
template<Descriptor descr = descriptors::no_operation, class Semiring , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename InputType4 , typename Coords , typename RIT , typename CIT , typename NIT , enum Backend backend> | |
RC | vxm (Vector< IOType, backend, Coords > &u, const Vector< InputType3, backend, Coords > &u_mask, const Vector< InputType1, backend, Coords > &v, const Vector< InputType4, backend, Coords > &v_mask, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const Semiring &semiring=Semiring(), const Phase &phase=EXECUTE, typename std::enable_if< grb::is_semiring< Semiring >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< InputType3 >::value &&!grb::is_object< InputType4 >::value &&!grb::is_object< IOType >::value, void >::type *=nullptr) |
Left-handed in-place doubly-masked sparse matrix times vector multiplication, \( u = u + vA \). More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename Coords , typename RIT , typename CIT , typename NIT , enum Backend implementation = config::default_backend> | |
RC | vxm (Vector< IOType, implementation, Coords > &u, const Vector< InputType3, implementation, Coords > &mask, const Vector< InputType1, implementation, Coords > &v, const Matrix< InputType2, implementation, RIT, CIT, NIT > &A, const Ring &ring=Ring(), const Phase &phase=EXECUTE, typename std::enable_if< grb::is_semiring< Ring >::value, void >::type *=nullptr) |
Left-handed in-place masked sparse matrix–vector multiplication, \( u = u + vA \), over a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class Ring , typename IOType , typename InputType1 , typename InputType2 , typename Coords , typename RIT , typename CIT , typename NIT , enum Backend implementation = config::default_backend> | |
RC | vxm (Vector< IOType, implementation, Coords > &u, const Vector< InputType1, implementation, Coords > &v, const Matrix< InputType2, implementation, RIT, CIT, NIT > &A, const Ring &ring=Ring(), const Phase &phase=EXECUTE, typename std::enable_if< grb::is_semiring< Ring >::value, void >::type *=nullptr) |
Left-handed in-place sparse matrix–vector multiplication, \( u = u + vA \), over a given semiring. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename InputType4 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | vxm (Vector< IOType, backend, Coords > &u, const Vector< InputType3, backend, Coords > &mask, const Vector< InputType1, backend, Coords > &v, const Vector< InputType4, backend, Coords > &v_mask, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!grb::is_object< InputType3 >::value &&!grb::is_object< InputType4 >::value &&!std::is_same< InputType2, void >::value, void >::type *const =nullptr) |
Left-handed in-place doubly-masked sparse matrix–vector multiplication, \( u = u + vA \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename Coords , typename RIT , typename CIT , typename NIT , Backend backend> | |
RC | vxm (Vector< IOType, backend, Coords > &u, const Vector< InputType1, backend, Coords > &v, const Matrix< InputType2, backend, RIT, CIT, NIT > &A, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, const typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!std::is_same< InputType2, void >::value, void >::type *const =nullptr) |
Left-handed in-place sparse matrix–vector multiplication, \( u = u + vA \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<Descriptor descr = descriptors::no_operation, class AdditiveMonoid , class MultiplicativeOperator , typename IOType , typename InputType1 , typename InputType2 , typename InputType3 , typename Coords , typename RIT , typename CIT , typename NIT , Backend implementation> | |
RC | vxm (Vector< IOType, implementation, Coords > &u, const Vector< InputType3, implementation, Coords > &mask, const Vector< InputType1, implementation, Coords > &v, const Matrix< InputType2, implementation, RIT, CIT, NIT > &A, const AdditiveMonoid &add=AdditiveMonoid(), const MultiplicativeOperator &mul=MultiplicativeOperator(), const Phase &phase=EXECUTE, typename std::enable_if< grb::is_monoid< AdditiveMonoid >::value &&grb::is_operator< MultiplicativeOperator >::value &&!grb::is_object< IOType >::value &&!grb::is_object< InputType1 >::value &&!grb::is_object< InputType2 >::value &&!std::is_same< InputType2, void >::value, void >::type *=nullptr) |
Left-handed in-place masked sparse matrix–vector multiplication, \( u = u + vA \), over a given commutative additive monoid and any binary operator acting as multiplication. More... | |
template<Backend backend = config::default_backend> | |
RC | wait () |
Depending on the backend, ALP/GraphBLAS primitives may be non-blocking, meaning that the operation immediately returns even though the requested computation has not been performed. More... | |
template<Backend backend, typename InputType , typename Coords , typename... Args> | |
RC | wait (const Vector< InputType, backend, Coords > &x, const Args &... args) |
A variant of grb::wait that executes, at minimum, all nonblocking primitives required for computing a given output vector as well as, optionally, for any additional output containers given in the variadic argument list. More... | |
template<Backend backend, typename InputType , typename RIT , typename CIT , typename NIT , typename... Args> | |
RC | wait (const Matrix< InputType, backend, RIT, CIT, NIT > &A, const Args &... args) |
A variant of grb::wait that executes, at minimum, all nonblocking primitives required for computing a given output matrix as well as, optionally, for any additional output containers given in the variadic argument list. More... | |
template<Descriptor descr = descriptors::no_operation, typename OutputType , typename InputType1 , typename InputType2 , typename InputType3 , typename RIT , typename CIT , typename NIT , Backend backend, typename Coords > | |
RC | zip (Matrix< OutputType, backend, RIT, CIT, NIT > &A, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Vector< InputType3, backend, Coords > &z, const Phase &phase=EXECUTE) |
The grb::zip merges three vectors into a matrix. More... | |
template<Descriptor descr = descriptors::no_operation, typename InputType1 , typename InputType2 , typename InputType3 , typename RIT , typename CIT , typename NIT , Backend backend, typename Coords > | |
RC | zip (Matrix< void, backend, RIT, CIT, NIT > &A, const Vector< InputType1, backend, Coords > &x, const Vector< InputType2, backend, Coords > &y, const Phase &phase=EXECUTE) |
Merges two vectors into a void matrix. More... | |
The ALP/GraphBLAS namespace.
All ALP/GraphBLAS primitives, container types, algebraic structures, and type traits are defined within.
typedef unsigned int Descriptor |
Descriptors indicate pre- or post-processing for some or all of the arguments to an ALP/GraphBLAS call.
An example is to transpose the input matrix during a sparse matrix–vector multiplication: grb::mxv< grb::descriptors::transpose_matrix >( y, A, x, ring );
the above thus computes \( y \to y + A^Tx \) and not \( y \to y + Ax \).
Such pre-processing often happens on-the-fly, without significant overhead to the primitive costings in any of its cost dimensions – work, intra- and inter-process data movement, synchronisations, and memory usage.
Descriptors may be combined using bit-wise operators. For instance, to both indicate the matrix needs be transposed and the mask needs be inverted, the following descriptor can be passed: transpose_matrix | invert_mask
enum EXEC_MODE |
The various ways in which the grb::Launcher can be used to execute an ALP program.
grbcxx
, alpcxx
, grbrun
, and/or alprun
for more details; or refer to the implementation documentation.An ALP program remains unaware of which mode the launcher employs. Normally, it requires no change depending on how it is launched. An exception is when data is passed through and from the caller program:
Enumerator | |
---|---|
AUTOMATIC | Automatic mode. The grb::Launcher may spawn additional user processes which will jointly execute a given ALP program. |
MANUAL | Manual mode. The user controls nprocs external processes which jointly should form an ALP context and execute one or more given ALP programs. |
FROM_MPI | From MPI mode. The user controls nprocs external MPI processes which jointly should form an ALP context and execute one or more given ALP programs. The only difference with the manual mode is that this mode guarantees that the pre-existing external processes are MPI processes. |
enum IOMode |
The GraphBLAS input and output functionalities can either be used in a sequential or parallel fashion.
Input functions such as buildVector or buildMatrixUnique default to sequential behaviour, which means that the collective calls to either function must have the exact same arguments– that is, each user process is passed the exact same input data.
This default behaviour comes with obvious performance penalties; each user process must scan the full input data set, which takes \( \Theta( n ) \) time. Scalable behaviour would instead incur \( \Theta( n / P ) \) time, with P the number of user processes. Using a parallel IOMode provides exactly this scalable performance. On input, this means that each user process can pass different data to the same collective call to, e.g., buildVector or buildMatrixUnique.
For output, which GraphBLAS provides via const iterators, sequential mode means that each user process retrieves an iterator over all output elements– this requires costly all-to-all communication. Parallel mode output instead only returns those elements that do not require inter user- process communication.
See the respective functions and classes for full details:
enum Phase |
Primitives with sparse ALP/GraphBLAS output containers may run into the issue where an appropriate grb::capacity may not always be clear.
This is classically the case for level-3 sparse BLAS primitives, which commonly is solved by splitting up the computation into a symbolic and numeric phase. During the symbolic phase, the computation is simulated in order to derive the required capacity of the output container, which is then immediately resized. Then during the numeric phase, the actual computation is carried out, knowing that the output container is large enough to hold the requested output.
A separation in a symbolic and numeric phase is not the only possible split; for example, required output capacities may be estimated during a first stage, while a second stage will then dynamically allocate additional memory if the estimation proved too optimistic.
We recognise that:
To cater to a wide range of approaches and use cases, we support the following three phases:
Backends must give precise performance semantics to primitives executing in each of the three possible phases. Backends can only fail with grb::OUTOFMEM or grb::PANIC when an operation is called using the resize phase and is immediately followed by an equivalent call using the execute phase– otherwise, it must succeed and complete the requested computation.
Summarising the above, a call to any ALP/GraphBLAS primitive f with (potentially sparse) output container A can be made in three ways:
The following code snippets, assuming all unchecked return codes are grb::SUCCESS, thus are semantically equivalent:
f( A, ..., EXECUTE )
may be replaced with f( A, ... )
.The above code snippets do not include try phases since whenever output containers do not have enough capacity, primitives executed using grb::TRY will not generate equivalent results.
Enumerator | |
---|---|
RESIZE | Speculatively assumes that the output container(s) of the requested operation lack the necessary capacity to hold all outputs of the computation. Instead of executing the requested operation, this phase attempts to both estimate and resize the output container(s). A successful call using this phase guarantees that a subsequent and equivalent call using the grb::EXECUTE phase shall be successful. Here, an equivalent call means that the operation must be called with exactly the same arguments, except for the grb::Phase argument. Here, subsequent means that all involved containers are not arguments to any other ALP/GraphBLAS primitives prior to the final call that requests the execute phase. Different from grb::resize, calling operations using the resize phase does not modify the contents of output containers, and may only enlargen capacities– not shrink them.
A backend must define clear performance semantics for each primitive and for each phase that primitive can be called with. In particular, backends must specify whether system calls such as dynamic memory allocations or frees may occur, and whether primtives operating in a resize phase may return grb::OUTOFMEM. |
TRY | Speculatively assumes that the output container of the requested operation has enough capacity to complete the computation, and attempts to do so. If the capacity was indeed found to be sufficient, then the computation must complete as specified– unless grb::PANIC is returned. If, nevertheless, capacity was not sufficient then the result of the computation is incomplete and the primitive shall return grb::FAILED. Regarding each output container A, the following are guaranteed:
A backend must define clear performance semantics for each primitive and for each phase that primitive can be called with.
|
EXECUTE | Speculatively assumes that the output container of the requested operation has enough capacity to complete the computation, and attempts to do so. If the capacity was indeed found to be sufficient, then the computation must complete as specified. In this case, capacities are additionally not allowed to be modified by the call to the primitive using the execute phase. If, instead, the output container capacity was found to be insufficient, then the requested operation may return grb::FAILED, in which case the contents of output containers shall be cleared.
A backend must define clear performance semantics for each primitive and for each phase that primitive can be called with. In particular, backends must specify whether system calls such as dynamic memory allocations or frees may occur, and whether primtives operating in a resize phase may return grb::OUTOFMEM.
|
enum RC |
Return codes of ALP primitives.
All primitives that are not getters return one of the codes defined here. All primitives may return SUCCESS, and all primitives may return PANIC. All other error codes are optional– please see the description of each primitive which other error codes may be valid.
For core ALP primitives, any non-SUCCESS and non-PANIC error code shall have no side effects; if a call fails, it shall be as though the call was never made.
Enumerator | |
---|---|
SUCCESS | Indicates the primitive has executed successfully. All primitives may return this error code. |
PANIC | Generic fatal error code. Signals that ALP has entered an undefined state. Users can only do their best to exit their application gracefully once PANIC has been encountered. An implementation (backend) is encouraged to write clear error messages to stderr prior to returning this error code. All primitives may return this error code even if not explicitly documented. |
OUTOFMEM | Signals an out-of-memory error while executing the requested primitive. User can mitigate by freeing memory and retrying the call or by reducing the amount of memory required by this call. This error code may only be returned when explicitly documented as such. |
MISMATCH | One or more of the ALP/GraphBLAS objects passed to the primitive that returned this error have mismatching dimensions. User can mitigate by reissuing with correct parameters. It is usually not possible to mitigate at run-time; more often than not, this error signals a logical programming error. This error code may only be returned when explicitly documented as such. |
OVERLAP | One or more of the GraphBLAS objects corresponding to the call returning this error refer to the same object while this explicitly is forbidden.
User can mitigate by reissuing with correct parameters. It is usually not possible to mitigate at run-time; more often than not, this error signals a logical programming error. This error code may only be returned when explicitly documented as such, but note the deprecation message– any uses of OVERLAP will be replaced with ILLEGAL before v1.0 is released. |
OVERFLW | Indicates that execution of the requested primitive with the given arguments would result in overflow. Users can mitigate by modifying the offending call. It is usually not possible to mitigate at run-time; more often than not, this error signals the underlying problem is too large to handle with whatever current resources have been assigned to ALP. This error code may only be returned when explicitly documented as such. |
UNSUPPORTED | Indicates that the execution of the requested primitive with the given arguments is not supported by the selected backend. This error code should never be returned by a fully compliant backend. If encountered, the end-user may mitigate by selecting a different backend. |
ILLEGAL | A call to a primitive has determined that one of its arguments was illegal as per the specification of the primitive. User can mitigate by reissuing with correct parameters. It is usually not possible to mitigate at run-time; more often than not, this error signals a logical programming error. This error code may only be returned when explicitly documented as such; in other words, the specification precisely determines which (combinations of) inputs are illegal. |
FAILED | Indicates when one of the grb::algorithms has failed to achieve its intended result, for instance, when an iterative method failed to converged within its alloted resources. This error code may only be returned when explicitly documented as such, and may never be returned by core ALP primitives– it is reserved for use by algorithms only. |
RC grb::finalize | ( | ) |
Finalises an ALP/GraphBLAS context opened by the last call to grb::init.
This function must be called collectively and must follow a call to grb::init. After successful execution of this function, a new call to grb::init may be made. (This function is re-entrant.)
After a call to this function, any ALP/GraphBLAS objects that remain in scope become invalid.
backend | Which ALP/GraphBLAS backend to finalise. |
RC grb::init | ( | const size_t | s, |
const size_t | P, | ||
void *const | implementation_data | ||
) |
Initialises the calling user process.
backend | Which GraphBLAS backend this call to init initialises. |
By default, the backend that is selected by the user at compile-time is used. If no backend was selected, grb::reference is assumed.
[in] | s | The ID of this user process. |
[in] | P | The total number of user processes. |
If the backend supports multiple user processes, the user can invoke this function with P equal to one or higher; if the backend supports only a single user process, then P must equal one.
The value for the user process ID s must be larger or equal to zero and must be strictly smaller than P. If P > 1, each user process must call this function collectively, each user process should pass the same value for P, and each user process should pass a unique value for s amongst all P collective calls made.
[in] | implementation_data | Any implementation-defined data structure required for successful completion of this call. |
An implementation may define that additional data is required for a call to this function to complete successfully. Such data may be passed via the final argument to this function, implementation_data.
If the implementation does not support multiple user processes, then a value for implementation_data shall not be required. In particular, a call to this function with an empty parameter list shall then be legal and infer the following default arguments: zero for s, one for P, and NULL for implementation_data. When such an implementation is requested to initialise multiple user processes, then grb::UNSUPPORTED shall be returned.
A call to this function must be matched with a call to grb::finalize. After a successful call to this function, a new call to grb::init without first calling grb::finalize shall incur undefined behaviour. The construction of ALP/GraphBLAS containers without a preceding successful call to grb::init will result in undefined behaviour. Any valid GraphBLAS containers will become invalid after a call to grb::finalize.
After a call to this function that exits with a non-SUCCESS and non-PANIC error code, the program shall behave as though the call were never made.
RC grb::init | ( | ) |
Initialises the calling user process.
This variant takes no input arguments. It will assume a single user process exists; i.e., the call is equivalent to one to grb::init with s zero and P one (and implementation_data NULL
).
backend | The backend implementation to initialise. |
std::string grb::toString | ( | const RC | code | ) |
|
inlinestatic |
Converts a backend identifier to a human-readable string.
[in] | backend | The backend whose string to return. |