|
LBANN
0.103.0
LivermoreBigArtificialNeuralNetworkToolkit
|
#include <kfac_block_gru.hpp>
Public Member Functions | |
| kfac_block_gru (Layer *layer, kfac::KFACExecutionContext *context, size_t layer_id, size_t inverse_proc_rank, bool enable_copy_errors, bool enable_copy_activations, int input_size, int output_size) | |
| kfac_block_gru (const kfac_block_gru &)=default | |
| kfac_block_gru & | operator= (const kfac_block_gru &)=default |
| void | on_forward_prop_end (lbann_comm *comm) override |
| const std::vector< El::AbstractMatrix< DataType > * > | get_local_kronecker_buffers () override |
| Get buffers of Kronecker factors for reduce-scatter. More... | |
| int | get_local_memory_consumption () override |
| Get local Memory Consumption. More... | |
| void | compute_local_kronecker_factors (lbann_comm *comm, bool print_matrix, bool print_matrix_summary) override |
| Compute Kronecker factors. More... | |
| void | update_kronecker_average (lbann_comm *comm, DataType kronecker_decay, bool print_matrix, bool print_matrix_summary) override |
| Update the average Kronecker factors. More... | |
| void | update_kronecker_inverse (lbann_comm *comm, bool use_pi, DataType damping_act, DataType damping_err, DataType learning_rate_factor, bool use_eigen_decomposition, bool print_matrix, bool print_matrix_summary, bool print_time) override |
| Compute the inverse of the average Kronecker factors. More... | |
| void | compute_preconditioned_gradients (lbann_comm *comm, DataType learning_rate_factor, bool print_matrix, bool print_matrix_summary, bool print_time) override |
| Compute the inverse of the average Kronecker factors. More... | |
| void | initialize_activations_and_errors (lbann_comm *comm, int num_local_activations, int num_local_errors, int num_weights) override |
| Copies activations, errors, and weights from model class to private variables to be used in KFAC computation. More... | |
| int | get_inverse_matrices (El::Matrix< DataType, Device > &output, int offset) override |
| Copy inverse matrices to output buffer. More... | |
| int | get_inverse_matrices_size (lbann_comm *comm) override |
| Get inverse matrices size (offset). More... | |
| int | set_inverse_matrices (El::Matrix< DataType, Device > &workspace, int offset, lbann_comm *comm) override |
| Copy inverse matrices from output buffer. More... | |
| void | start_communication_forward_end (lbann_comm *comm) override |
| void | end_communication_forward_end (lbann_comm *comm) override |
| void | start_communication_backward_end (lbann_comm *comm) override |
| void | end_communication_backward_end (lbann_comm *comm) override |
| std::vector< int > | get_inverse_matrices_size_vector (lbann_comm *comm) override |
| Get inverse matrices size vector. More... | |
| void | resize_inverse_matrices_size (El::Matrix< double, El::Device::CPU > &inverse_matrices_size, int block_number) override |
| Get inverse matrices size vector. More... | |
| const std::vector< El::AbstractMatrix< DataType > * > | get_preconditioned_grad_buffers () override |
| Get buffers of preconditioned parameter gradients. More... | |
Public Member Functions inherited from lbann::kfac_block< Device > | |
| kfac_block (Layer *layer, kfac::KFACExecutionContext *context, size_t layer_id, size_t inverse_proc_rank, bool enable_copy_errors, bool enable_copy_activations, int input_size, int output_size) | |
| virtual | ~kfac_block ()=default |
| void | set_current_batch_size (El::Int batch_size) |
| virtual std::string | get_info () const |
| Get block's information in one line. More... | |
| std::string | get_name () const |
| size_t | get_inverse_proc_rank () const |
| DataType * | get_local_activation_buffer (int index) |
| DataType * | get_local_error_buffer (int index) |
| DataType * | get_weight_buffer (int index) |
| DataType * | get_gradient_wrt_weight_buffer (int index) |
| El::Int | get_current_batch_size () |
| El::Int | get_input_size () |
| El::Int | get_output_size () |
Private Member Functions | |
| void | check_dnn_lib_spec () const |
| void | get_r_i (El::Matrix< DataType, Device > &r, El::Matrix< DataType, Device > &i, const El::Matrix< DataType, Device > &biases_ones, const El::Matrix< DataType, Device > &local_inputs, const El::Matrix< DataType, Device > &local_outputs, const El::Matrix< DataType, Device > &h0, size_t local_batch_size, const El::SyncInfo< Device > &sync_info) |
| Recompute or copy (from cuDNN's reserve space if available) forward internal state (r and i). More... | |
| void | get_weight_matrix (kfac_gru_util::weight_type matrix_type, El::Matrix< DataType, Device > &view) |
| Get the view of a weight matrix or a bias vector or its gradients. More... | |
| void | get_gradient_matrix (kfac_gru_util::weight_type matrix_type, El::Matrix< DataType, Device > &view) |
| void | get_gradient_buffer (kfac_gru_util::weight_type matrix_type, El::Matrix< DataType, Device > &view) |
| std::vector< std::tuple< std::string, size_t, size_t > > | get_internal_matrix_info () const override |
| Return the list of internal matrices' (name, height, width) for debugging. All internal matrices should be ready when this function is called. More... | |
| gru_layer< DataType, data_layout::DATA_PARALLEL, Device > * | get_gru_layer () const |
| Get the pointer to its GRU_layer. More... | |
| size_t | get_input_size () const |
| size_t | get_hidden_size () const |
| size_t | get_seq_length () const |
| void | send_recv_reserve_space (lbann_comm *comm) |
Private Attributes | |
| hydrogen::simple_buffer< El::byte, Device > | m_reserve_space_fwd |
| A copy of the reserve space after forward passes. More... | |
| El::Matrix< DataType, Device > | m_kronecker_factor_buf_A_h |
| Lower triangle buffers of Kronecker factors. More... | |
| El::Matrix< DataType, Device > | m_kronecker_factor_buf_A_x |
| std::unordered_map< kfac_gru_util::weight_type, El::Matrix< DataType, Device > > | m_kronecker_factor_buf_G |
| El::Matrix< DataType, Device > | m_kronecker_average_A_h |
| Exponential moving average of Kronecker factors. More... | |
| El::Matrix< DataType, Device > | m_kronecker_average_A_x |
| std::unordered_map< kfac_gru_util::weight_type, El::Matrix< DataType, Device > > | m_kronecker_average_G |
| El::Matrix< DataType, Device > | m_kronecker_inverse_A_h |
| Inverse of the average Kronecker factors. More... | |
| El::Matrix< DataType, Device > | m_kronecker_inverse_A_x |
| std::unordered_map< kfac_gru_util::weight_type, El::Matrix< DataType, Device > > | m_kronecker_inverse_G |
| El::Matrix< DataType, Device > | m_grad_buffer_A_h |
| El::Matrix< DataType, Device > | m_grad_buffer_A_x |
| std::unordered_map< kfac_gru_util::weight_type, El::Matrix< DataType, Device > > | m_grad_buffer_G |
| size_t | m_reserve_space_fwd_size = 0 |
| std::vector< kfac::ReqT > | m_requests_workspace |
Additional Inherited Members | |
Protected Member Functions inherited from lbann::kfac_block< Device > | |
| El::Matrix< DataType, Device > & | get_workspace_matrix (const std::string &key, size_t height, size_t width) |
| Gets the Kronecker factor matrix of a FC layer. The same key is tied with the same matrix instance. More... | |
| El::SyncInfo< Device > | get_sync_info () |
| Return the default sync info that may used in update functions. More... | |
Protected Attributes inherited from lbann::kfac_block< Device > | |
| Layer * | m_layer |
| The target layer. More... | |
| const size_t | m_layer_id |
| The layer ID in the model. TODO: Remove this. More... | |
| const int | m_inverse_proc_rank |
| The process ID which perform inverse on Kronecker. More... | |
| std::vector< std::unique_ptr< AbsDistMat > > | m_parent_local_activations |
| distributed martices for activations and gradients. More... | |
| std::vector< std::unique_ptr< AbsDistMat > > | m_child_local_errors |
| std::vector< std::unique_ptr< AbsDistMat > > | m_weight_gradients |
| std::vector< std::unique_ptr< AbsDistMat > > | m_subset_matrix |
| std::vector< std::unique_ptr< AbsDistMat > > | m_errors_copy |
| std::vector< std::unique_ptr< AbsDistMat > > | m_activations_copy |
| std::vector< std::unique_ptr< AbsDistMat > > | m_weight_values |
| Translatebetweengrid funciton has a basic implementation for STAR,STAR distributed matrices. Therefore, using local matrices for weights. More... | |
| std::vector< kfac::ReqT > | m_requests_forward_end |
| std::vector< kfac::ReqT > | m_requests_backward_end |
| int | m_input_size |
| feature size and batch size (used in primary -> secondary grid communication) More... | |
| int | m_output_size |
| int | m_batch_size |
| bool | m_enable_copy_errors |
| Enable copying of errors to enhance async communication. More... | |
| bool | m_enable_copy_activations |
| Enable copying of activations to enhance async communication. More... | |
| bool | m_has_kronecker_inverse |
| Whether this block already has an inverse history. More... | |
A BN building block for K-FAC.
Definition at line 115 of file kfac_block_gru.hpp.
|
inline |
Constructor.
Definition at line 120 of file kfac_block_gru.hpp.
|
default |
|
private |
|
overridevirtual |
Compute Kronecker factors.
Reimplemented from lbann::kfac_block< Device >.
|
overridevirtual |
Compute the inverse of the average Kronecker factors.
Reimplemented from lbann::kfac_block< Device >.
|
overridevirtual |
Implements lbann::kfac_block< Device >.
|
overridevirtual |
Implements lbann::kfac_block< Device >.
|
private |
|
private |
|
inlineprivate |
Get the pointer to its GRU_layer.
Definition at line 255 of file kfac_block_gru.hpp.
|
inlineprivate |
Definition at line 266 of file kfac_block_gru.hpp.
|
inlineprivate |
Definition at line 261 of file kfac_block_gru.hpp.
|
overrideprivatevirtual |
Return the list of internal matrices' (name, height, width) for debugging. All internal matrices should be ready when this function is called.
Reimplemented from lbann::kfac_block< Device >.
|
overridevirtual |
Copy inverse matrices to output buffer.
Implements lbann::kfac_block< Device >.
|
overridevirtual |
Get inverse matrices size (offset).
Implements lbann::kfac_block< Device >.
|
inlineoverridevirtual |
Get inverse matrices size vector.
Implements lbann::kfac_block< Device >.
Definition at line 211 of file kfac_block_gru.hpp.
|
overridevirtual |
Get buffers of Kronecker factors for reduce-scatter.
Reimplemented from lbann::kfac_block< Device >.
|
inlineoverridevirtual |
Get local Memory Consumption.
Implements lbann::kfac_block< Device >.
Definition at line 156 of file kfac_block_gru.hpp.
|
overridevirtual |
Get buffers of preconditioned parameter gradients.
Reimplemented from lbann::kfac_block< Device >.
|
private |
Recompute or copy (from cuDNN's reserve space if available) forward internal state (r and i).
|
inlineprivate |
Definition at line 267 of file kfac_block_gru.hpp.
|
private |
Get the view of a weight matrix or a bias vector or its gradients.
|
overridevirtual |
Copies activations, errors, and weights from model class to private variables to be used in KFAC computation.
Reimplemented from lbann::kfac_block< Device >.
|
overridevirtual |
Reimplemented from lbann::kfac_block< Device >.
|
default |
|
inlineoverridevirtual |
Get inverse matrices size vector.
Implements lbann::kfac_block< Device >.
Definition at line 217 of file kfac_block_gru.hpp.
|
private |
|
overridevirtual |
Copy inverse matrices from output buffer.
Implements lbann::kfac_block< Device >.
|
overridevirtual |
Implements lbann::kfac_block< Device >.
|
overridevirtual |
Implements lbann::kfac_block< Device >.
|
overridevirtual |
Update the average Kronecker factors.
Reimplemented from lbann::kfac_block< Device >.
|
overridevirtual |
Compute the inverse of the average Kronecker factors.
Reimplemented from lbann::kfac_block< Device >.
|
private |
Definition at line 294 of file kfac_block_gru.hpp.
|
private |
Definition at line 294 of file kfac_block_gru.hpp.
|
private |
Definition at line 296 of file kfac_block_gru.hpp.
|
private |
Exponential moving average of Kronecker factors.
Definition at line 285 of file kfac_block_gru.hpp.
|
private |
Definition at line 285 of file kfac_block_gru.hpp.
|
private |
Definition at line 287 of file kfac_block_gru.hpp.
|
private |
Lower triangle buffers of Kronecker factors.
Definition at line 279 of file kfac_block_gru.hpp.
|
private |
Definition at line 279 of file kfac_block_gru.hpp.
|
private |
Definition at line 282 of file kfac_block_gru.hpp.
|
private |
Inverse of the average Kronecker factors.
Definition at line 290 of file kfac_block_gru.hpp.
|
private |
Definition at line 290 of file kfac_block_gru.hpp.
|
private |
Definition at line 292 of file kfac_block_gru.hpp.
|
private |
Definition at line 300 of file kfac_block_gru.hpp.
|
private |
A copy of the reserve space after forward passes.
Definition at line 276 of file kfac_block_gru.hpp.
|
private |
Definition at line 298 of file kfac_block_gru.hpp.