1.3.1. Matrix Classes

1.3.1.1. Sequential Matrices

1.3.1.2. chase::matrix::Matrix

template<typename T, typename Platform = chase::platform::CPU, template<typename> class Allocator = DefaultAllocator<Platform>::template type>
class Matrix

1.3.1.3. chase::matrix::QuasiHermitianMatrix

template<typename T, typename Platform = chase::platform::CPU, template<typename> class Allocator = DefaultAllocator<Platform>::template type>
class QuasiHermitianMatrix

1.3.1.4. Distributed Matrices

1.3.1.5. chase::distMatrix::BlockBlockMatrix

template<typename T, typename Platform = chase::platform::CPU>
class BlockBlockMatrix : public chase::distMatrix::AbstractDistMatrix<T, BlockBlockMatrix, chase::platform::CPU>

Class representing a distributed block-block matrix.

This class implements a matrix that is distributed across 2D MPI grids. It inherits from AbstractDistMatrix and provides methods for handling matrix data in distributed memory environments, including matrix manipulation, serialization, and redistribution.

Template Parameters:
  • T – The element type of the matrix (e.g., float, double).

  • Platform – The platform on which the matrix will be operated (e.g., CPU or GPU).

Public Types

using platform_type = Platform

Platform type (e.g., CPU or GPU).

using value_type = T

Alias for the element type.

using matrix_type = BlockBlock

Alias for the matrix type.

using hermitian_type = chase::matrix::Hermitian

Alias for the Hermitian matrix type.

Public Functions

inline ~BlockBlockMatrix() override

Destructor for BlockBlockMatrix.

BlockBlockMatrix()

Default constructor for BlockBlockMatrix.

inline BlockBlockMatrix(std::size_t M, std::size_t N, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor for BlockBlockMatrix with given dimensions and MPI grid.

Initializes the matrix with global dimensions M and N and sets up MPI communication grid. Calculates the local matrix dimensions based on the MPI grid configuration.

Parameters:
  • M – Global number of rows of the matrix.

  • N – Global number of columns of the matrix.

  • mpi_grid – Shared pointer to the MPI grid configuration.

inline BlockBlockMatrix(std::size_t m, std::size_t n, std::size_t ld, T *data, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor for BlockBlockMatrix with local data.

Initializes the matrix with local dimensions m and n, and loads the matrix data. Also sets up the global matrix size using MPI operations.

Parameters:
  • m – Local number of rows of the matrix.

  • n – Local number of columns of the matrix.

  • ld – Leading dimension of the matrix.

  • data – Pointer to the data buffer holding the matrix data.

  • mpi_grid – Shared pointer to the MPI grid configuration.

inline virtual std::size_t g_rows() const override

Get the global number of rows in the matrix.

Returns:

Global number of rows.

inline virtual std::size_t g_cols() const override

Get the global number of columns in the matrix.

Returns:

Global number of columns.

inline virtual std::size_t l_ld() const override

Get the leading dimension of the local matrix.

Returns:

Leading dimension of the local matrix.

inline virtual std::size_t l_rows() const override

Get the number of rows in the local matrix.

Returns:

Number of rows in the local matrix.

inline virtual std::size_t l_cols() const override

Get the number of columns in the local matrix.

Returns:

Number of columns in the local matrix.

inline std::size_t *g_offs()

Get the global offsets for this matrix.

Returns:

Pointer to the array holding global offsets for the matrix.

inline virtual std::size_t mb() const override

Get the block size in the row direction (not implemented).

Returns:

Always returns 0.

inline virtual std::size_t nb() const override

Get the block size in the column direction (not implemented).

Returns:

Always returns 0.

inline virtual std::size_t l_half() const override

Get the local index for the lower half.

Returns:

Index of the lower half

inline virtual T *l_data() override

Get the local data pointer for the matrix.

Returns:

Pointer to the local data of the matrix.

inline virtual chase::matrix::Matrix<T, Platform> &loc_matrix() override

Get the local matrix object.

Returns:

Reference to the local matrix.

inline virtual chase::grid::MpiGrid2DBase *getMpiGrid() const override

Get the MPI grid configuration.

Returns:

Pointer to the MPI grid configuration.

inline virtual std::shared_ptr<chase::grid::MpiGrid2DBase> getMpiGrid_shared_ptr() const override

Get the shared pointer to the MPI grid configuration.

Returns:

Shared pointer to the MPI grid configuration.

template<typename CloneVectorType>
inline CloneVectorType cloneMultiVector(std::size_t g_M, std::size_t g_N)

Clone the matrix as a multi-vector of a different type.

Template Parameters:

CloneVectorType – Type of the vector to be cloned.

Parameters:
  • g_M – Global number of rows in the cloned vector.

  • g_N – Global number of columns in the cloned vector.

Returns:

The cloned vector of the given type.

inline void saveToBinaryFile(const std::string &filename)

Save the matrix data to a binary file.

Saves the matrix data to a binary file, with special handling for CPU and GPU platforms. Only CPU buffer data is saved, and GPU data is transferred to CPU before saving.

Parameters:

filename – Name of the file where the matrix data is saved.

Throws:

std::runtime_error – If the matrix data is not initialized.

inline void readFromBinaryFile(const std::string &filename)

Read matrix data from a binary file.

Reads the matrix data from a binary file. If the matrix is on a GPU, data is transferred to the CPU first before reading. For MPI I/O, MPI is used to read the matrix.

Parameters:

filename – Name of the file from which to read the matrix data.

Throws:

std::runtime_error – If the matrix data is not initialized or if the file cannot be opened.

inline std::size_t *get_scalapack_desc()

Get the ScaLAPACK descriptor for the matrix.

Returns:

Pointer to the ScaLAPACK descriptor.

inline std::size_t *scalapack_descriptor_init()

Initialize the ScaLAPACK descriptor for the matrix.

Initializes the ScaLAPACK descriptor based on the matrix dimensions and MPI grid configuration.

Returns:

Pointer to the initialized ScaLAPACK descriptor.

template<template<typename, typename> class targetType>
inline void redistributeImpl(targetType<T, Platform> *targetMatrix)

Redistribute the matrix to another type of matrix.

Redistributes the matrix data to another matrix of a different type (e.g., from BlockBlockMatrix to another matrix type).

Template Parameters:

targetType – Type of the target matrix to redistribute data to.

Parameters:

targetMatrix – Pointer to the target matrix.

1.3.1.6. chase::distMatrix::BlockCyclicMatrix

template<typename T, typename Platform = chase::platform::CPU>
class BlockCyclicMatrix : public chase::distMatrix::AbstractDistMatrix<T, BlockCyclicMatrix, chase::platform::CPU>

A class representing a block-cyclic distributed matrix.

This class inherits from AbstractDistMatrix and provides functionality for a block-cyclic distributed matrix, which is partitioned into blocks that are distributed across multiple MPI processes. The matrix is represented locally on each process, and global matrix properties are derived from the local data and distribution.

Template Parameters:
  • T – The data type of the matrix elements (e.g., float, double).

  • Platform – The platform type (e.g., CPU, GPU) specifying the hardware on which the matrix is stored.

Public Types

using platform_type = Platform

Alias for platform type.

using value_type = T

Alias for element type.

using matrix_type = BlockCyclic

Alias for matrix type.

using hermitian_type = chase::matrix::Hermitian

Alias for the Hermitian matrix type.

Public Functions

inline ~BlockCyclicMatrix() override

Destructor for BlockCyclicMatrix.

BlockCyclicMatrix()

Default constructor for BlockCyclicMatrix.

inline BlockCyclicMatrix(std::size_t M, std::size_t N, std::size_t mb, std::size_t nb, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor for BlockCyclicMatrix given global matrix dimensions, block sizes, and MPI grid.

This constructor initializes the matrix with the given global dimensions, block sizes, and MPI grid for the 2D block-cyclic distribution.

Parameters:
  • M – The global number of rows in the matrix.

  • N – The global number of columns in the matrix.

  • mb – The block size for rows.

  • nb – The block size for columns.

  • mpi_grid – A shared pointer to the MpiGrid2DBase object representing the MPI grid for the distribution.

inline BlockCyclicMatrix(std::size_t M, std::size_t N, std::size_t m, std::size_t n, std::size_t mb, std::size_t nb, std::size_t ld, T *data, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor for BlockCyclicMatrix with pre-allocated data.

This constructor initializes the matrix with pre-allocated data and validates that the local matrix dimensions match the block-cyclic distribution.

Parameters:
  • M – The global number of rows in the matrix.

  • N – The global number of columns in the matrix.

  • m – The local number of rows on this process.

  • n – The local number of columns on this process.

  • mb – The block size for rows.

  • nb – The block size for columns.

  • ld – The leading dimension of the local matrix.

  • data – Pointer to the pre-allocated data for the local matrix.

  • mpi_grid – A shared pointer to the MpiGrid2DBase object representing the MPI grid for the distribution.

inline virtual std::size_t g_rows() const override

Returns the global number of rows in the matrix.

Returns:

The global number of rows.

inline virtual std::size_t g_cols() const override

Returns the global number of columns in the matrix.

Returns:

The global number of columns.

inline virtual std::size_t l_ld() const override

Returns the local leading dimension.

Returns:

The local leading dimension.

inline virtual std::size_t l_rows() const override

Returns the local number of rows.

Returns:

The local number of rows.

inline virtual std::size_t l_cols() const override

Returns the local number of columns.

Returns:

The local number of columns.

inline virtual std::size_t mb() const override

Returns the block size for rows.

Returns:

The block size for rows.

inline virtual std::size_t nb() const override

Returns the block size for columns.

Returns:

The block size for columns.

inline virtual std::size_t l_half() const override

Get the local index for the lower half.

Returns:

Index of the lower half

inline std::size_t mblocks()

Returns the number of row blocks.

Returns:

The number of row blocks.

inline std::size_t nblocks()

Returns the number of column blocks.

Returns:

The number of column blocks.

inline std::vector<std::size_t> m_contiguous_global_offs()
inline std::vector<std::size_t> n_contiguous_global_offs()
inline std::vector<std::size_t> m_contiguous_local_offs()
inline std::vector<std::size_t> n_contiguous_local_offs()
inline std::vector<std::size_t> m_contiguous_lens()
inline std::vector<std::size_t> n_contiguous_lens()
inline virtual T *l_data() override

Returns a pointer to the local matrix data.

Returns:

A pointer to the local matrix data.

inline virtual chase::matrix::Matrix<T, Platform> &loc_matrix() override

Returns the local matrix object.

Returns:

A reference to the local matrix.

inline virtual chase::grid::MpiGrid2DBase *getMpiGrid() const override

Returns a pointer to the MPI grid.

Returns:

A pointer to the MPI grid.

inline virtual std::shared_ptr<chase::grid::MpiGrid2DBase> getMpiGrid_shared_ptr() const override

Returns a shared pointer to the MPI grid.

Returns:

A shared pointer to the MPI grid.

template<typename CloneVectorType>
inline CloneVectorType cloneMultiVector(std::size_t g_M, std::size_t g_N)

Clones a multi-vector for the given global dimensions.

Template Parameters:

CloneVectorType – The type of the vector to clone.

Parameters:
  • g_M – The global number of rows for the clone.

  • g_N – The global number of columns for the clone.

Returns:

A new multi-vector of the given type.

inline void saveToBinaryFile(const std::string &filename)

Saves the matrix data to a binary file.

This method saves the matrix data from the CPU buffer to a binary file using MPI I/O. For GPU data, it must first be copied to the CPU.

Parameters:

filename – The name of the file to save the matrix data.

Throws:

std::runtime_error – If the data cannot be saved.

inline void readFromBinaryFile(const std::string &filename)

Reads matrix data from a binary file.

This method reads the matrix data from a binary file using MPI I/O. For GPU data, it will copy the data to the CPU buffer first.

Parameters:

filename – The name of the file to read the matrix data.

Throws:

std::runtime_error – If the data cannot be read.

inline std::size_t *get_scalapack_desc()

Returns the Scalapack descriptor for the matrix.

Returns:

A pointer to the Scalapack descriptor.

inline std::size_t *scalapack_descriptor_init()

Initialize the ScaLAPACK descriptor for the matrix.

Initializes the ScaLAPACK descriptor based on the matrix dimensions and MPI grid configuration.

Returns:

Pointer to the initialized ScaLAPACK descriptor.

template<template<typename, typename> class targetType>
inline void redistributeImpl(targetType<T, Platform> *targetMatrix)

Redistribute the matrix to another type of matrix.

Redistributes the matrix data to another matrix of a different type (e.g., from BlockCyclicMatrix to another matrix type).

Template Parameters:

targetType – Type of the target matrix to redistribute data to.

Parameters:

targetMatrix – Pointer to the target matrix.

template<template<typename, typename> class targetType>
inline void redistributeImplAsync(targetType<T, Platform> *targetMatrix, cudaStream_t *stream_ = nullptr)

1.3.1.7. chase::distMatrix::RedundantMatrix

template<typename T, typename Platform = chase::platform::CPU>
class RedundantMatrix : public chase::distMatrix::AbstractDistMatrix<T, RedundantMatrix, chase::platform::CPU>

A class representing a distributed matrix with redundant storage.

This class inherits from AbstractDistMatrix and represents a matrix that is distributed across an MPI 2D grid. It supports operations like redistribution to other matrix types (BlockBlock, BlockCyclic), and provides access to the matrix’s local data and MPI grid.

Template Parameters:
  • T – The element type of the matrix.

  • Platform – The platform on which the matrix is hosted (defaults to CPU).

Public Types

using platform_type = Platform

Alias for the platform type.

using value_type = T

Alias for the element type of the matrix.

using matrix_type = Redundant

Alias for the matrix type (Redundant)

Public Functions

inline ~RedundantMatrix() override

Destructor for RedundantMatrix.

RedundantMatrix()

Default constructor for RedundantMatrix.

inline RedundantMatrix(std::size_t m, std::size_t n, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor initializing a RedundantMatrix with given dimensions and MPI grid.

Parameters:
  • m – Number of rows for the local matrix.

  • n – Number of columns for the local matrix.

  • mpi_grid – A shared pointer to the MPI grid for the distribution.

inline RedundantMatrix(std::size_t m, std::size_t n, std::size_t ld, T *data, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructor initializing a RedundantMatrix with given data, dimensions, and MPI grid.

Parameters:
  • m – Number of rows for the local matrix.

  • n – Number of columns for the local matrix.

  • ld – Leading dimension of the local matrix.

  • data – Pointer to the data for initializing the matrix.

  • mpi_grid – A shared pointer to the MPI grid for the distribution.

inline virtual std::size_t g_rows() const override

Get the global number of rows.

Returns:

Global number of rows in the matrix.

inline virtual std::size_t g_cols() const override

Get the global number of columns.

Returns:

Global number of columns in the matrix.

inline virtual std::size_t l_rows() const override

Get the local number of rows.

Returns:

Local number of rows in the matrix.

inline virtual std::size_t l_cols() const override

Get the local number of columns.

Returns:

Local number of columns in the matrix.

inline virtual std::size_t l_ld() const override

Get the local leading dimension (stride).

Returns:

Local leading dimension of the matrix.

inline virtual std::size_t mb() const override

Get the block size in the row direction (unused for redundant matrices).

Returns:

0 as the block size is not applicable.

inline virtual std::size_t nb() const override

Get the block size in the column direction (unused for redundant matrices).

Returns:

0 as the block size is not applicable.

inline virtual std::size_t l_half() const override

Get the local index for the lower half.

Returns:

Index of the lower half

inline virtual T *l_data() override

Get the pointer to the local matrix data.

Returns:

A pointer to the local matrix data.

inline virtual chase::matrix::Matrix<T, Platform> &loc_matrix() override

Get a reference to the local matrix.

Returns:

A reference to the local matrix object.

inline virtual chase::grid::MpiGrid2DBase *getMpiGrid() const override

Get the MPI grid associated with this matrix.

Returns:

A raw pointer to the MPI grid.

inline virtual std::shared_ptr<chase::grid::MpiGrid2DBase> getMpiGrid_shared_ptr() const override

Get the shared pointer to the MPI grid.

Returns:

A shared pointer to the MPI grid.

inline void mapToNewMpiGrid(std::shared_ptr<chase::grid::MpiGrid2DBase> new_mpi_grid)

Map the matrix to a new MPI grid.

This method updates the MPI grid of the matrix to a new one.

Parameters:

new_mpi_grid – A shared pointer to the new MPI grid.

template<template<typename, typename> class targetType>
inline void redistributeImpl(targetType<T, Platform> *targetMatrix, std::size_t startRow, std::size_t subRows, std::size_t startCol, std::size_t subCols)

Redistribute the matrix to another matrix type.

This method supports redistribution to BlockBlock, BlockCyclic, or other supported types.

Template Parameters:

targetType – The target matrix type to redistribute to.

Parameters:
  • targetMatrix – A pointer to the target matrix to redistribute the data to.

  • startRow – Starting row index for the redistribution (global index).

  • subRows – Number of rows to redistribute.

  • startCol – Starting column index for the redistribution (global index).

  • subCols – Number of columns to redistribute.

Throws:

std::runtime_error – If the global dimensions do not match between matrices.

template<template<typename, typename> class targetType>
inline void redistributeImpl(targetType<T, Platform> *targetMatrix)

Redistribute the matrix to another matrix type with full global dimensions.

This method redistributes the entire matrix without specifying a sub-region.

Template Parameters:

targetType – The target matrix type to redistribute to.

Parameters:

targetMatrix – A pointer to the target matrix to redistribute the data to.

template<typename TargetMatrixType>
inline void redistributeImpl_2(TargetMatrixType *targetMatrix, std::size_t startRow, std::size_t subRows, std::size_t startCol, std::size_t subCols)

Redistribute the matrix to another matrix type with extended logic.

Similar to redistributeImpl, but includes additional logic to handle more complex cases.

Template Parameters:

TargetMatrixType – The target matrix type to redistribute to.

Parameters:
  • targetMatrix – A pointer to the target matrix.

  • startRow – Starting row index (global index).

  • subRows – Number of rows to redistribute.

  • startCol – Starting column index (global index).

  • subCols – Number of columns to redistribute.

Throws:

std::runtime_error – If global dimensions do not match.

template<typename TargetMatrixType>
inline void redistributeImpl_2(TargetMatrixType *targetMatrix)

Redistribute the matrix to another matrix type with full global dimensions.

Similar to redistributeImpl_2, but without specifying a sub-region.

Template Parameters:

TargetMatrixType – The target matrix type to redistribute to.

Parameters:

targetMatrix – A pointer to the target matrix.

1.3.1.8. chase::distMatrix::QuasiHermitianBlockBlockMatrix

template<typename T, typename Platform>
class QuasiHermitianBlockBlockMatrix

1.3.1.9. chase::distMatrix::QuasiHermitianBlockCyclicMatrix

template<typename T, typename Platform>
class QuasiHermitianBlockCyclicMatrix

1.3.1.10. Distributed Multi-Vectors

1.3.1.11. chase::distMultiVector::DistMultiVector1D

template<typename T, CommunicatorType comm_type, typename Platform = chase::platform::CPU>
class DistMultiVector1D : public chase::distMultiVector::AbstractDistMultiVector<T, comm_type, DistMultiVector1D, chase::platform::CPU>

Distributed multi-vector with 1D distribution.

Distributed MultiVector class for 1D block distribution within either row or column communicator of a 2D MPI grid.

This class template represents a distributed multi-vector with 1D data distribution, templated by type, communicator type, and platform.

This class represents a distributed matrix structure where data can be split across either the row or column communicators in a 2D MPI grid setup. The implementation is platform-specific, allowing for both CPU and GPU usage.

Template Parameters:
  • T – Element type.

  • comm_type – Specifies the communicator type (row or column) for 1D distribution within the 2D MPI grid.

  • Platform – Specifies the computational platform, with a default to chase::platform::CPU.

Public Types

using platform_type = Platform

Alias for the computational platform type.

using value_type = T

Alias for the element type.

Public Functions

inline ~DistMultiVector1D() override

Default destructor.

DistMultiVector1D()

Default constructor.

inline DistMultiVector1D(std::size_t M, std::size_t N, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructs a distributed multivector with specified global dimensions and MPI grid.

Initializes the 1D distribution according to the specified communicator type, handling dimensions and block sizes.

Parameters:
  • M – Global number of rows.

  • N – Global number of columns.

  • mpi_grid – Shared pointer to the 2D MPI grid for distribution.

inline DistMultiVector1D(std::size_t m, std::size_t n, std::size_t ld, T *data, std::shared_ptr<chase::grid::MpiGrid2DBase> mpi_grid)

Constructs a distributed multivector with specified local dimensions, leading dimension, and data pointer.

Parameters:
  • m – Local number of rows.

  • n – Local number of columns.

  • ld – Leading dimension of the data pointer.

  • data – Pointer to the data array.

  • mpi_grid – Shared pointer to the 2D MPI grid.

inline virtual DistributionType getMultiVectorDistributionType() const override

Retrieves the distribution type of the multi-vector.

Returns:

Returns the distribution type as Block.

inline virtual CommunicatorType getMultiVectorCommunicatorType() const override

Retrieves the communicator type for distribution.

Returns:

Returns the specified communicator type (row or column).

inline virtual chase::grid::MpiGrid2DBase *getMpiGrid() const override

Provides a raw pointer to the MPI grid used for distribution.

Returns:

Raw pointer to the MPI grid object.

inline virtual std::shared_ptr<chase::grid::MpiGrid2DBase> getMpiGrid_shared_ptr() const override

Provides a shared pointer to the MPI grid used for distribution.

Returns:

Shared pointer to the MPI grid object.

template<typename CloneType>
inline CloneType clone()

Clones the distributed multivector to a specified type with the same global dimensions and MPI grid.

Template Parameters:

CloneType – The type of the cloned object.

Returns:

Cloned object of specified type.

template<typename CloneType>
inline CloneType clone(std::size_t g_M, std::size_t g_N)

Clones the distributed multivector to a specified type with new global dimensions.

Template Parameters:

CloneType – The type of the cloned object.

Parameters:
  • g_M – New global row dimension.

  • g_N – New global column dimension.

Returns:

Cloned object of specified type with new dimensions.

template<typename CloneType>
inline std::unique_ptr<CloneType> clone2()

Creates a unique pointer to a clone of the distributed multivector with the same dimensions.

Template Parameters:

CloneType – The type of the cloned object.

Returns:

Unique pointer to the cloned object.

template<typename CloneType>
inline std::unique_ptr<CloneType> clone2(std::size_t g_M, std::size_t g_N)

Creates a unique pointer to a clone of the distributed multivector with new global dimensions.

Template Parameters:

CloneType – The type of the cloned object.

Parameters:
  • g_M – New global row dimension.

  • g_N – New global column dimension.

Returns:

Unique pointer to the cloned object with new dimensions.

template<CommunicatorType OtherCommType, typename OtherPlatform>
inline void swap(DistMultiVector1D<T, OtherCommType, OtherPlatform> &other)

Swaps data and metadata with another distributed multivector with compatible types.

Template Parameters:
  • OtherCommType – Communicator type of the other multivector.

  • OtherPlatform – Platform type of the other multivector.

Parameters:

other – The other multivector to swap with.

Throws:

std::runtime_error – if communicator types or platforms do not match.

inline void swap_ij(std::size_t i, std::size_t j)

Swaps columns i and j in the distributed multivector.

Parameters:
  • i – Index of the first column.

  • j – Index of the second column.

inline void D2H()

Transfers data from device to host.

This operation is only supported on GPU platforms.

Throws:

std::runtime_error – if executed on a CPU platform.

inline void H2D()

Transfers data from host to device.

This operation is only supported on GPU platforms.

Throws:

std::runtime_error – if executed on a CPU platform.

inline T *cpu_data()

Provides a pointer to the CPU data.

Returns:

Pointer to the CPU data.

inline std::size_t cpu_ld()

Retrieves the leading dimension for the CPU data.

Returns:

Leading dimension of the CPU data.

template<CommunicatorType target_comm_type, typename OtherPlatform>
inline void redistributeImpl(DistMultiVector1D<T, target_comm_type, OtherPlatform> *targetMultiVector, std::size_t offset, std::size_t subsetSize)

Redistributes data to another distributed multivector with a specified communicator type.

Template Parameters:
  • target_comm_type – Communicator type of the target multivector.

  • OtherPlatform – Platform type of the target multivector.

Parameters:
  • targetMultiVector – Target multivector for redistribution.

  • offset – Column offset for redistribution.

  • subsetSize – Number of columns to redistribute.

Throws:
  • std::runtime_error – if platforms or communicator types do not match.

  • std::invalid_argument – if subset range is invalid.

template<CommunicatorType target_comm_type, typename OtherPlatform>
inline void redistributeImpl(DistMultiVector1D<T, target_comm_type, OtherPlatform> *targetMultiVector)

Redistributes the full data range to another distributed multivector.

Template Parameters:
  • target_comm_type – Communicator type of the target multivector.

  • OtherPlatform – Platform type of the target multivector.

Parameters:

targetMultiVector – Target multivector for redistribution.

template<CommunicatorType target_comm_type>
inline void redistributeImplAsync(DistMultiVector1D<T, target_comm_type, chase::platform::GPU> *targetMultiVector, std::size_t offset, std::size_t subsetSize, cudaStream_t *stream_ = nullptr)

Asynchronous redistribution of data to another distributed multivector on GPU with specified communicator type.

Template Parameters:

target_comm_type – Communicator type of the target multivector.

Parameters:
  • targetMultiVector – Target multivector for redistribution.

  • offset – Column offset for redistribution.

  • subsetSize – Number of columns to redistribute.

  • stream_ – CUDA stream for asynchronous operation (optional).

template<CommunicatorType target_comm_type>
inline void redistributeImplAsync(DistMultiVector1D<T, target_comm_type, chase::platform::GPU> *targetMultiVector, cudaStream_t *stream_ = nullptr)

Redistributes the full data on GPU with range to another distributed multivector.

Template Parameters:
  • target_comm_type – Communicator type of the target multivector.

  • OtherPlatform – Platform type of the target multivector.

Parameters:

targetMultiVector – Target multivector for redistribution.

inline virtual std::size_t g_rows() const override

Get the number of rows in the global matrix.

Returns:

The global row count.

inline virtual std::size_t g_cols() const override

Get the number of columns in the global matrix.

Returns:

The global column count.

inline virtual std::size_t g_off() const override

Get the global offset.

Returns:

The global offset of the local data.

inline virtual std::size_t l_rows() const override

Get the number of rows in the local matrix (i.e., rows stored on this process).

Returns:

The local row count.

inline virtual std::size_t l_cols() const override

Get the number of columns in the local matrix (i.e., columns stored on this process).

Returns:

The local column count.

inline virtual std::size_t l_ld() const override

Get the leading dimension of the local matrix storage.

Returns:

The leading dimension for the local matrix.

inline virtual std::size_t mb() const override

Get the block size used in the distributed matrix layout.

Returns:

The matrix block size.

inline virtual std::size_t mblocks() const override

Returns the number of row blocks.

Returns:

The number of row blocks.

inline virtual std::size_t l_half() const override

Get the block size used in the distributed matrix layout.

Returns:

The matrix block size.

inline virtual T *l_data() override

Access the raw pointer to the local matrix data.

Returns:

Pointer to the local matrix data.

inline virtual chase::matrix::Matrix<T, Platform> &loc_matrix() override

Access the local matrix object.

Returns:

Reference to the local matrix of type chase::matrix::Matrix.

inline std::size_t *get_scalapack_desc()

Get the ScaLAPACK descriptor for the matrix.

Returns:

Pointer to the ScaLAPACK descriptor array.

inline std::size_t *scalapack_descriptor_init()

Initialize the ScaLAPACK descriptor for the matrix.

Initializes the ScaLAPACK descriptor array with parameters based on the MPI grid and matrix layout.

If the platform is GPU, CPU data is allocated if it is not already allocated.

Returns:

Pointer to the initialized ScaLAPACK descriptor.

Public Static Attributes

static constexpr chase::distMultiVector::CommunicatorType communicator_type = comm_type