|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
cuTT-based implementation of tensor permute. More...
#include <cutt_permuteimpl.hpp>
Public Types | |
| using | DimsType = ColMajorDims< int > |
Public Member Functions | |
Lifecycle | |
| cuTT_PermuteImpl (ColMajorPerm perm) | |
| ~cuTT_PermuteImpl () noexcept | |
Read-only Accessors (for testing) | |
| ColMajorPerm const & | perm () const noexcept |
| DimsType const & | input_dims () const noexcept |
| DimsType const & | output_dims () const noexcept |
Permute interface | |
| void | set_dims (DimsType input_dims) |
| Setup the dimensions. More... | |
| template<typename DataT > | |
| void | permute (El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
| Permute the tensor. More... | |
| template<typename DataT > | |
| void | inverse_permute (El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
| Apply the inverse permutation to the tensor. More... | |
Modifiers | |
| void | swap (cuTT_PermuteImpl &other) |
Private Types | |
| using | BatchSizeT = El::Int |
| using | Plan = cuttHandle |
| using | PlanMap = std::unordered_map< BatchSizeT, Plan > |
Private Member Functions | |
| template<typename DataT > | |
| cuttHandle | get_mb_plan (PlanMap &plan_map, ColMajorPerm const &perm, DimsType const &in_dims, DimsType const &out_dims, El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > const &out) const |
| template<typename DataT > | |
| cuttHandle | get_sample_plan (ColMajorPerm const &perm, DimsType const &in_dims, DimsType const &out_dims, El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > const &out) const |
| template<typename DataT > | |
| bool | is_mb_permutable (El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > const &out) const |
| template<typename DataT > | |
| void | do_mb_permute (PlanMap &plan_map, ColMajorPerm const &perm, DimsType const &in_dims, DimsType const &out_dims, El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
| template<typename DataT > | |
| void | do_sample_permute (Plan &plan, ColMajorPerm const &perm, DimsType const &in_dims, DimsType const &out_dims, El::Matrix< DataT, El::Device::GPU > const &in, El::Matrix< DataT, El::Device::GPU > &out) const |
Private Attributes | |
| ColMajorPerm | m_perm |
| ColMajorPerm | m_inv_perm |
| DimsType | m_input_dims |
| DimsType | m_output_dims |
| PlanMap | m_fwd_plans |
| PlanMap | m_inv_plans |
| Plan | m_sample_fwd_plan = 0U |
| Plan | m_sample_inv_plan = 0U |
cuTT-based implementation of tensor permute.
cuTT only supports packed tensors. LBANN currently assumes that all sample tensors are packed, so this is generally fine. However, LBANN allows the minibatch storage matrices to have a leading dimension that exceeds the height. This class handles this allowance by branching the code based on the relationship of the leading dimension and the height of the input/output matrices. When possible, it will create a transpose plan for the entire minibatch and launch a single kernel. When this is not possible, it will create a plan to transpose each sample and apply it sample-wise.
When a plan for the entire minibatch is possible, it will be required to create a new plan for any different minibatch size encountered.
Definition at line 93 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 152 of file cutt_permuteimpl.hpp.
| using lbann::cuTT_PermuteImpl::DimsType = ColMajorDims<int> |
Definition at line 96 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 153 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 154 of file cutt_permuteimpl.hpp.
|
inline |
|
inlinenoexcept |
|
private |
Definition at line 358 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 374 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 258 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 288 of file cutt_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 241 of file cutt_permuteimpl.hpp.
| void lbann::cuTT_PermuteImpl::inverse_permute | ( | El::Matrix< DataT, El::Device::GPU > const & | in, |
| El::Matrix< DataT, El::Device::GPU > & | out | ||
| ) | const |
Apply the inverse permutation to the tensor.
Applies the inverse permutation to the tensor represented by "in". In line with the rest of LBANN, the permutation is applied to each column, which is treated as a packed tensor with the dimensions stored in this object.
Definition at line 334 of file cutt_permuteimpl.hpp.
|
private |
|
inlinenoexcept |
Definition at line 246 of file cutt_permuteimpl.hpp.
|
inlinenoexcept |
Definition at line 236 of file cutt_permuteimpl.hpp.
| void lbann::cuTT_PermuteImpl::permute | ( | El::Matrix< DataT, El::Device::GPU > const & | in, |
| El::Matrix< DataT, El::Device::GPU > & | out | ||
| ) | const |
Permute the tensor.
Applies the permutation to the tensor represented by "in". In line with the rest of LBANN, the permutation is applied to each column, which is treated as a packed tensor with the dimensions stored in this object.
Definition at line 316 of file cutt_permuteimpl.hpp.
|
inline |
Setup the dimensions.
Must be compatible with the provided perm vector.
Definition at line 251 of file cutt_permuteimpl.hpp.
|
inline |
Definition at line 400 of file cutt_permuteimpl.hpp.
|
mutableprivate |
Definition at line 203 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 199 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 198 of file cutt_permuteimpl.hpp.
|
mutableprivate |
Definition at line 204 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 200 of file cutt_permuteimpl.hpp.
|
private |
Definition at line 197 of file cutt_permuteimpl.hpp.
|
mutableprivate |
Definition at line 205 of file cutt_permuteimpl.hpp.
|
mutableprivate |
Definition at line 206 of file cutt_permuteimpl.hpp.