ryujin 2.1.1 revision ee5cbcbf2346c1299c942d0e1f13b46449973c18
Loading...
Searching...
No Matches
List of all members
ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length > Class Template Reference

#include <source/sparse_matrix.h>

Inheritance diagram for ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >:
Inheritance graph
[legend]
Collaboration diagram for ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >:
Collaboration graph
[legend]

Public Member Functions

Constructor and initialization
 SparseMatrix ()=default
 
 SparseMatrix (const SparsityPattern< warp_size > &sparsity, const TransferPolicy transfer_policy=TransferPolicy::explicit_transfers)
 
void reinit (const SparsityPattern< warp_size > &sparsity, const TransferPolicy transfer_policy=TransferPolicy::explicit_transfers)
 
 ACCESSOR_READ_ONLY (sparsity_pattern)
 
Memory space access and synchronization
template<typename MemorySpace = dealii::MemorySpace::Host>
SparseMatrixView< Number, n_comp, warp_size, simd_length, MemorySpace, true > view ()
 
template<typename MemorySpace = dealii::MemorySpace::Host>
SparseMatrixView< Number, n_comp, warp_size, simd_length, MemorySpace, false > view () const
 
MPI synchronization
template<typename MemorySpace >
void zero_out_ghost_rows_on_memory_space ()
 
template<typename MemorySpace >
void update_ghost_rows_on_memory_space ()
 
template<typename MemorySpace >
void compress_on_memory_space (dealii::VectorOperation::values operation)
 
template<typename MemorySpace >
void populate_exchange_buffer_on_memory_space ()
 
- Public Member Functions inherited from ryujin::MirroredStorage< Derived >
template<typename MemorySpace >
bool is_resident () const
 
template<typename MemorySpace >
bool is_pinned () const
 
template<typename MemorySpace >
void copy_to_memory_space () const
 
template<typename MemorySpace >
void move_to_memory_space ()
 
TransferPolicy transfer_policy () const
 
void set_transfer_policy (const TransferPolicy transfer_policy)
 

Internal fields, methods, and friends

class MirroredStorage< SparseMatrix< Number, n_comp, warp_size, simd_length > >
 
template<typename , int , int , int , typename , bool >
class SparseMatrixView
 

Additional Inherited Members

- Protected Member Functions inherited from ryujin::MirroredStorage< Derived >
 MirroredStorage ()=default
 
template<typename MemorySpace >
void prepare_read_access () const
 
template<typename MemorySpace >
void prepare_write_access ()
 
void reset_residency (const bool host_resident, const bool default_resident)
 

Detailed Description

template<typename Number, int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
class ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >

A specialized sparse matrix for efficient vectorized SIMD access.

In the vectorized row index region [0, n_internal_dofs) we store data as an array-of-struct-of-array type (see the documentation of class SparsityPattern for details). For the non-vectorized row index region [n_internal_dofs, n_locally_relevant_dofs) we store the matrix in CSR format (equivalent to the static dealii::SparsityPattern).

The two template parameters warp_size and simd_length describe two different concepts: warp_size is the number of rows that the underlying SparsityPattern groups together in the internal index range, whereas simd_length is the number of packed doubles/floats that the access operators of this class read and write at once. The warp size has to be an integer multiple of the SIMD length.

Definition at line 58 of file sparse_matrix.h.

Constructor & Destructor Documentation

◆ SparseMatrix() [1/2]

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::SparseMatrix ( )
default

Default constructor.

◆ SparseMatrix() [2/2]

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::SparseMatrix ( const SparsityPattern< warp_size > &  sparsity,
const TransferPolicy  transfer_policy = TransferPolicy::explicit_transfers 
)

Constructor taking a SIMD sparsity pattern as an argument.

Member Function Documentation

◆ reinit()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
void ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::reinit ( const SparsityPattern< warp_size > &  sparsity,
const TransferPolicy  transfer_policy = TransferPolicy::explicit_transfers 
)

Reinit function reinitializes the matrix with the given SIMD sparsity pattern. The locally owned and ghost ranges are zeroed.

Note
Construction and initialization always happen in the host memory space. After reinit() the matrix is resident on the host memory space only; device storage is allocated lazily on the first copy_to_memory_space() / move_to_memory_space(). (If the host and default memory spaces coincide the matrix is resident on both.)
Because the matrix ends up resident on the host memory space only, TransferPolicy::implicit_transfers_default_resident is not an admissible transfer_policy for this function.

◆ ACCESSOR_READ_ONLY()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::ACCESSOR_READ_ONLY ( sparsity_pattern  )

Return the underlying sparsity pattern.

◆ view() [1/2]

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace = dealii::MemorySpace::Host>
SparseMatrixView< Number, n_comp, warp_size, simd_length, MemorySpace, true > ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::view ( )

Return a writable view on the sparse matrix for the selected memory space. Depending on the selected TransferPolicy the method either asserts that the memory space is resident (TransferPolicy::explicit_transfers), or performs an implicit move_to_memory_space() invalidating the other memory space (TransferPolicy::implicit_transfers).

◆ view() [2/2]

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace = dealii::MemorySpace::Host>
SparseMatrixView< Number, n_comp, warp_size, simd_length, MemorySpace, false > ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::view ( ) const

Return a read-only view on the sparse matrix for the selected memory space. Depending on the selected TransferPolicy the method either asserts that the memory space is resident (TransferPolicy::explicit_transfers), or performs an implicit copy_to_memory_space() (TransferPolicy::implicit_transfers).

◆ zero_out_ghost_rows_on_memory_space()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace >
void ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::zero_out_ghost_rows_on_memory_space ( )

MPI synchronization: Zero out all ghost rows.

◆ update_ghost_rows_on_memory_space()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace >
void ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::update_ghost_rows_on_memory_space ( )

MPI synchronization: Import all ghost rows from neighboring MPI ranks on the templated memory space.

◆ compress_on_memory_space()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace >
void ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::compress_on_memory_space ( dealii::VectorOperation::values  operation)

MPI synchronization: Copy the data that has accumulated in the ghost range to the owning processor. This function operates on the templated memory space.

◆ populate_exchange_buffer_on_memory_space()

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename MemorySpace >
void ryujin::SparseMatrix< Number, n_comp, warp_size, simd_length >::populate_exchange_buffer_on_memory_space ( )

Gather all entries that have to be sent to neighboring MPI ranks into the exchange buffer of the selected memory space.

Note: This function is an implementation detail of compress_on_memory_space(). It is public because nvcc does not allow an extended host device lambda in a member function with private or protected access.

Friends And Related Symbol Documentation

◆ MirroredStorage< SparseMatrix< Number, n_comp, warp_size, simd_length > >

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
friend class MirroredStorage< SparseMatrix< Number, n_comp, warp_size, simd_length > >
friend

Definition at line 225 of file sparse_matrix.h.

◆ SparseMatrixView

template<typename Number , int n_comp = 1, int warp_size = ryujin::warp_size, int simd_length = dealii::VectorizedArray<Number>::size()>
template<typename , int , int , int , typename , bool >
friend class SparseMatrixView
friend

Definition at line 232 of file sparse_matrix.h.


The documentation for this class was generated from the following file: