einsums::hptt::Transpose#

Note

Generated from the C++ headers by apiary --emit-cpp-docs-json.

Defined in header Einsums/HPTT/Transpose.hpp.

template<typename floatType>
class Transpose#

Arch-neutral interface to a compiled tensor-transposition plan.

Create once (hptt::create_plan()), execute() many times; repoint buffers, scales and conjugation between runs. clone() copies; write_to_file()/read_from_file() persist.

Template Parameters:

floatType – The element type this plan transposes.

virtual ~Transpose() = default#
virtual void execute() noexcept = 0#

Executes the transposition.

virtual void set_input_ptr(const floatType *A) noexcept = 0#

Set the pointer for A.

Useful to reuse the compiled transposition over multiple invocations.

virtual void set_output_ptr(floatType *B) noexcept = 0#

Set the pointer for B.

Useful to reuse the compiled transposition over multiple invocations.

virtual void set_alpha(floatType alpha) noexcept = 0#

Set the scaling factor for A.

virtual void set_beta(floatType beta) noexcept = 0#

Set the scaling factor for B.

virtual void set_conj_a(bool conjA) noexcept = 0#

Change whether to conjugate the input tensor.

virtual void write_to_file(std::FILE *fp) const = 0#

Serialize this plan (parameters and compiled loop structure) to a file previously prepared with hptt::setup_file(). Restore with read_from_file().

virtual std::shared_ptr<Transpose<floatType>> clone() const = 0#

Deep-copy this plan.

Replaces the copy constructor of earlier versions: the concrete plan type is hidden behind this interface, so copying must go through a virtual call. Used to clone a cached template plan before repointing it at new buffers.

static std::shared_ptr<Transpose<floatType>> create(const size_t *sizeA, const int *perm, const size_t *outerSizeA, const size_t *outerSizeB, const size_t *offsetA, const size_t *offsetB, const size_t innerStrideA, const size_t innerStrideB, const int dim, const floatType *A, const floatType alpha, floatType *B, const floatType beta, const SelectionMethod selectionMethod, const int numThreads, const int *threadIds, const bool useRowMajor)#

Create a transposition plan.

The factory behind every hptt::create_plan() overload.

Parameters:
  • sizeA – dim-dimensional array with the sizes of each dimension of A.

  • perm – dim-dimensional array representing the permutation of the indices. For instance, perm[] = {1,0,2} denotes: \(B_{i1,i0,i2} \gets A_{i0,i1,i2}\).

  • outerSizeA – outer sizes of A, or NULL (meaning equal to sizeA); enables operating on sub-tensors.

  • outerSizeB – outer sizes of B, or NULL (meaning equal to perm(sizeA)).

  • offsetA – per-dimension offsets into A, or NULL (meaning zero).

  • offsetB – per-dimension offsets into B, or NULL (meaning zero).

  • innerStrideA – non-unit stride of A’s innermost dimension.

  • innerStrideB – non-unit stride of B’s innermost dimension.

  • dim – Dimensionality of the tensors.

  • A – Pointer to the raw data of the input tensor A.

  • alpha – Scaling factor for A.

  • B – Pointer to the raw data of the output tensor B.

  • beta – Scaling factor for B.

  • selectionMethod – Whether/how to auto-tune (see hptt::SelectionMethod). ATTENTION: auto-tuning (e.g. hptt::MEASURE) writes to B during tuning.

  • numThreads – Number of threads participating in the transposition.

  • threadIds – OpenMP thread IDs participating, for execution inside an existing parallel region.

  • useRowMajor – Row-major memory layout when set (default: column-major).

static std::shared_ptr<Transpose<floatType>> read_from_file(std::FILE *fp, floatType alpha, const floatType *A, floatType beta, floatType *B)#

Reconstruct a plan previously saved with write_to_file().

The data pointers, alpha, and beta are not part of the serialized form and must be supplied afresh.