SLATE 2024.05.31
Software for Linear Algebra Targeting Exascale
Loading...
Searching...
No Matches
Permute, internal

Functions

void slate::internal::makeParallelPivot (Direction direction, std::vector< Pivot > const &pivot, std::map< Pivot, Pivot > &pivot_map)
 Converts serial pivot vector to parallel pivot map.
 
template<typename scalar_t >
void slate::internal::permuteRows (internal::TargetType< Target::HostTask >, Direction direction, Matrix< scalar_t > &A, std::vector< Pivot > &pivot, Layout layout, int priority, int tag_base, int queue_index)
 Permutes rows of a general matrix according to the pivot vector.
 
template<Target target = Target::HostTask, typename scalar_t >
void slate::internal::permuteRows (Direction direction, Matrix< scalar_t > &&A, std::vector< Pivot > &pivot, Layout layout, int priority, int tag_base, int queue_index)
 Permutes rows according to the pivot vector.
 
template<typename scalar_t >
void slate::internal::permuteRows (internal::TargetType< Target::Devices >, Direction direction, Matrix< scalar_t > &A, std::vector< Pivot > &pivot, Layout layout, int priority, int tag_base, int queue_index)
 Permutes rows of a general matrix according to the pivot vector.
 
template<typename scalar_t >
void slate::internal::swapRow (int64_t j_offset, int64_t n, HermitianMatrix< scalar_t > &A, Op op1, std::tuple< int64_t, int64_t > &&ij_tuple_1, int64_t offset_i1, Op op2, std::tuple< int64_t, int64_t > &&ij_tuple_2, int64_t offset_i2, int tag)
 Swap a partial row of two tiles, either locally or remotely.
 
template<typename scalar_t >
void slate::internal::swapElement (HermitianMatrix< scalar_t > &A, std::tuple< int64_t, int64_t > &&ij_tuple_1, int64_t offset_i1, int64_t offset_j1, std::tuple< int64_t, int64_t > &&ij_tuple_2, int64_t offset_i2, int64_t offset_j2, int tag)
 Swap a single element of two tiles, either locally or remotely.
 
template<typename scalar_t >
void slate::internal::permuteRowsCols (internal::TargetType< Target::HostTask >, Direction direction, HermitianMatrix< scalar_t > &A, std::vector< Pivot > &pivot, int priority, int tag)
 Permutes rows and cols, symmetrically, of a Hermitian matrix according to the pivot vector.
 
template<Target target = Target::HostTask, typename scalar_t >
void slate::internal::permuteRowsCols (Direction direction, HermitianMatrix< scalar_t > &&A, std::vector< Pivot > &pivot, int priority, int tag)
 Permutes rows and columns symmetrically according to the pivot vector.
 

Detailed Description

Function Documentation

◆ makeParallelPivot()

void slate::internal::makeParallelPivot ( Direction  direction,
std::vector< Pivot > const &  pivot,
std::map< Pivot, Pivot > &  pivot_map 
)

Converts serial pivot vector to parallel pivot map.

Parameters
[in]directionDirection of pivoting:
  • Direction::Forward,
  • Direction::Backward.
[in]in_pivotSerial (LAPACK-style) pivot vector.
[in,out]pivotParallel pivot for out-of-place pivoting.

◆ permuteRows() [1/3]

template<Target target = Target::HostTask, typename scalar_t >
void slate::internal::permuteRows ( Direction  direction,
Matrix< scalar_t > &&  A,
std::vector< Pivot > &  pivot,
Layout  layout,
int  priority,
int  tag_base,
int  queue_index 
)

Permutes rows according to the pivot vector.

Dispatches to target implementations.

Parameters
[in]directionWhether the permutation matrix should be applied from the left or right
[in,out]AThe matrix to permute
[in]pivotThe vector of rows to swap
[in]layoutIndicates the Layout (ColMajor/RowMajor) to operate with. Local tiles of matrix on target devices will be converted to layout.
[in]priorityThe priority to use for internal tasks
[in]tag_baseThe communication for the jth tile column of A uses the MPI tag tag_base+j
[in]queue_indexFor Target::Devices, which BLAS++ queue to use

◆ permuteRows() [2/3]

template<typename scalar_t >
void slate::internal::permuteRows ( internal::TargetType< Target::Devices ,
Direction  direction,
Matrix< scalar_t > &  A,
std::vector< Pivot > &  pivot,
Layout  layout,
int  priority,
int  tag_base,
int  queue_index 
)

Permutes rows of a general matrix according to the pivot vector.

GPU device implementation. todo: Restructure similarly to Hermitian permute (use the auxiliary swap functions). todo: Just one function forwarding target.

◆ permuteRows() [3/3]

template<typename scalar_t >
void slate::internal::permuteRows ( internal::TargetType< Target::HostTask ,
Direction  direction,
Matrix< scalar_t > &  A,
std::vector< Pivot > &  pivot,
Layout  layout,
int  priority,
int  tag_base,
int  queue_index 
)

Permutes rows of a general matrix according to the pivot vector.

Host implementation. todo: Restructure similarly to Hermitian permuteRowsCols (use the auxiliary swap functions).

◆ permuteRowsCols() [1/2]

template<Target target = Target::HostTask, typename scalar_t >
void slate::internal::permuteRowsCols ( Direction  direction,
HermitianMatrix< scalar_t > &&  A,
std::vector< Pivot > &  pivot,
int  priority,
int  tag 
)

Permutes rows and columns symmetrically according to the pivot vector.

Dispatches to target implementations.

◆ permuteRowsCols() [2/2]

template<typename scalar_t >
void slate::internal::permuteRowsCols ( internal::TargetType< Target::HostTask ,
Direction  direction,
HermitianMatrix< scalar_t > &  A,
std::vector< Pivot > &  pivot,
int  priority,
int  tag 
)

Permutes rows and cols, symmetrically, of a Hermitian matrix according to the pivot vector.

Host implementation.

Here, lowercase & uppercase are conjugate pairs, e.g., d = conj( D ). Input is lower part of:

        i1          i2
    [ . A   |   |   P   |   ]  }
i1: [ a b C | D | E F G | H ]  } tile row 0
    [   c . |   |   Q   |   ]  }
    [-------+---+-------+---]
    [   d   | . |   R   |   ]  } tile rows 1
    [-------+---+-------+---]
    [   e   |   | . S   |   ]  }
i2: [ p f q | r | s t U | V ]  } tile row 2
    [   g   |   |   u . |   ]  }
    [-------+---+-------+---]
    [   h   |   |   v   | . ]  } tile rows 3

On output, rows i1, i2 and cols i1, i2 are swapped. Output is lower part of:

    [ . P   |   |   A   |   ]  }
i1: [ p t q | r | s f U | V ]  } tile row 0
    [   Q . |   |   c   |   ]  }
    [-------+---+-------+---]
    [   R   | . |   d   |   ]  } tile rows 1
    [-------+---+-------+---]
    [   S   |   | . e   |   ]  }
i2: [ a F C | D | E b G | H ]  } tile row 2
    [   u   |   |   g . |   ]  }
    [-------+---+-------+---]
    [   v   |   |   h   | . ]  } tile rows 3

◆ swapElement()

template<typename scalar_t >
void slate::internal::swapElement ( HermitianMatrix< scalar_t > &  A,
std::tuple< int64_t, int64_t > &&  ij_tuple_1,
int64_t  offset_i1,
int64_t  offset_j1,
std::tuple< int64_t, int64_t > &&  ij_tuple_2,
int64_t  offset_i2,
int64_t  offset_j2,
int  tag 
)

Swap a single element of two tiles, either locally or remotely.

Swaps A( ij_tuple_1 )[ offset_i1, offset_j1 ] and A( ij_tuple_2 )[ offset_i2, offset_j2 ].

◆ swapRow()

template<typename scalar_t >
void slate::internal::swapRow ( int64_t  j_offset,
int64_t  n,
HermitianMatrix< scalar_t > &  A,
Op  op1,
std::tuple< int64_t, int64_t > &&  ij_tuple_1,
int64_t  offset_i1,
Op  op2,
std::tuple< int64_t, int64_t > &&  ij_tuple_2,
int64_t  offset_i2,
int  tag 
)

Swap a partial row of two tiles, either locally or remotely.

Swaps op1( A( ij_tuple_1 ) )[ offset_i1, j_offset : j_offset+n-1 ] and op2( A( ij_tuple_2 ) )[ offset_i2, j_offset : j_offset+n-1 ]. If op1 != op2, also conjugates both vectors.