DSMat

This class is used to represent Distributed Sparse Matrix. More…

#include "DSMat.h"

Inherits from MatrixProd

Inherited by DSMat_CPU

Public Functions

Name
void collect_jc(VEC_CPU< iExt > & comm_index_L_Lst, VEC_CPU< iReg > & L_jc_Lst, VEC_CPU< iExt > & comm_index_R_Lst, VEC_CPU< iReg > & R_jc_Lst, VEC_CPU< iReg > & vec_ncols, iExt & nterms_AexD)
Evaluates and Store L/R_jc_Snd/RcvLst using external scratches.
DSMat & operator=(DSMat const & other)
Copy operator.
void set_sym_flag(bool input_sym_flag)
Set the symmetric flag.
void set_nrows(iReg input_nrows, iReg input_nrows_i)
Set nrows and nrows_i.
void set_maxsize_comm(iReg input_maxsize_comm)
Set maximum number of unknowns among all the local CSR matrix;.
bool get_sym_flag() const
Get symmetric flag.
virtual iReg get_nrows() const
Get nrows.
iReg get_nrows_i() const
Get nrows_i.
iReg get_maxsize_comm() const
Get maximum number of unknowns among all the local CSR matrix (maxsize_comm).
iReg * get_ptr_ptDom_data()
Get pointer to ptDom.
const iReg * get_ptr_ptDom_data() const
iReg * get_ptr_OutptDom_data()
Get OutptDom.
const iReg * get_ptr_OutptDom_data() const
virtual iGlo Get_Globalnrows_inner() const
void mk_OutptDom()
Creates OutptDom from the Outgoing communication graph.
virtual void SyncDevice() =0
Synchronize the device according to HostMat.
virtual DSMat * get_HostMat() =0
Retrieve pointer to the DSMat structure stored on the host.
virtual void CreateFromCPU(const DSMat & Mat) =0
Creates a DSMat from a DSMat_CPU.
virtual void CreateCPU(DSMat & Mat) =0
Creates a DSMat_CPU.
virtual ~DSMat() =0
Deletes the object.
virtual void evaluate_and_store_maxsize_comm() =0
Evaluate maximum number of incoming unknowns of the local csr matrices and store the result in maxsize_comm.
virtual void copy(MatrixProd const & other) =0
virtual void clean() =0
virtual iExt get_nterm() const =0
Get local nterm (total number of terms in the process stripe).
virtual matInfo GetInfo() =0
This function retrieves some basic properties of the DSMAT and returns this information in the ad hoc structure info.
virtual iGlo Get_Globalnterm() const =0
Evaluates the total number of nterm of the distributed csr matrices.
virtual rExt Get_GlobalMaxRowNorm() const =0
Evaluates the maximum value of the norm of a row of the matrix.
virtual struct LocMax Get_GlobalLocMaxRowNorm() const =0
Evaluates the maximum value and location of the norm of a row of the matrix.
virtual rExt Get_GlobalAvgRowNorm() =0
Evaluates the average value of the norm of a row of the matrix.
virtual void Prepare_MxV(const iReg nRHS) =0
Prepares the data structure necessary for MxV.
virtual void UndoPrepare_MxV() =0
Undoes the data structure necessary for MxV.
virtual void MxV(DDMat & x, DDMat & b, bool Barrier_flag) =0
Computes the Matrix by vector Product.
virtual void MxM(DSMat & B, DSMat & C) =0
Computes the Matrix by Matrix Product A x B = C (with A equal to this).
virtual void RAP(DSMat & A, DSMat & P, DSMat & An) =0
Computes the RAP product for AMG as R x A x P = An (with R equal to ‘this’).
virtual void sum(DSMat & B, DSMat & C, const rExt fb =1.0, const rExt fa =1.0) =0
Computes the Matrix sum fa x A + fb x B = C (with A equal to this).
virtual void MxM_pattB_init(DSCoef_CPU & B, MPI_DSMat_SendRecvCompactCSR & Buffers, MxM_pattB_Scratch & SCR) =0
Initializes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.
virtual void MxM_pattB_comp(DSCoef_CPU const & B, DSCoef_CPU & C, MPI_DSMat_SendRecvCompactCSR & Buffers, MxM_pattB_Scratch & SCR) =0
Computes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.
virtual void MxM_pattB_finalize(MPI_DSMat_SendRecvCompactCSR & Buffers, MxM_pattB_Scratch & SCR) =0
Finalizes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.
virtual void TreatBC() =0
virtual void Accumulate(const rExt fa, const rExt fb, DSMat & B) =0
Accumulate a matrix B over A (with ‘this’ == A) such that A = fa x A + fb x B.
virtual void Transpose(DSMat & MatT) =0
Transpose the matrix.
virtual void PartKway(const type_MPI_int rank, const type_MPI_int size, VEC_CPU< iGlo > & vec_part, VEC_CPU< iGlo > & vec_iperm) =0
Redistributes the entries currently stored locally into this process to all the other process according to a partition generated by metis.
virtual void PartRevAug(const type_MPI_int rank, const type_MPI_int size, VEC_CPU< iGlo > & vec_part, VEC_CPU< iGlo > & vec_iperm) =0
Redistributes the entries currently stored locally into this process to all the other process according to a partition for Reverse Augmented preconditioned.
virtual void Redist(const type_MPI_int rank, const type_MPI_int size, const VEC_CPU< iGlo > & vec_part, const VEC_CPU< iGlo > & vec_iperm, DSMat & mat_AP) =0
Creates through metis a partition of the DSMat instance.
virtual void Redist_Rect(const type_MPI_int rank, const type_MPI_int size, const VEC_CPU< iGlo > & vec_part_row, const VEC_CPU< iGlo > & vec_iperm_row, const VEC_CPU< iGlo > & vec_part_col, const VEC_CPU< iGlo > & vec_iperm_col, DSMat & mat_AP) =0
Creates through metis a partition of the DSMat instance (rectangular DSMat).
virtual void LocalRCM(VEC_CPU< iReg > & vec_perm, VEC_CPU< iReg > & vec_iperm) =0
Computes a local permutation (i.e. each subdomain has a local independent ordering) on an input DSMat using the reverse Cuthill-McKee (RCM) algorithm.
virtual void Print_ASCII(const string & filename) const =0
Prints the distributed sparse matrix in ASCII filename (overwrite if it exists). It uses Convert_arrayCSR_To_ScalarLRGCSR and CreateGlobalOffset.
virtual void Print_BIN(const string & filename) const =0
Prints the distributed sparse matrix in BINARY filename (overwrite if it exists). It uses Convert_arrayCSR_To_ScalarLRGCSR and CreateGlobalOffset.
void DumpInfo(const string & filename) const
Prints the distributed sparse matrix information in an ASCII filename (overwrite if it exists).
virtual void CreateCompactCSR(CSRMAT & mat_out, iReg & shift_diag) const =0
Creates a compacted CSR matrix from a stripe of DSMat.
virtual void Load_CompactCSR(const CSRMAT & mat_in) =0
This function loads a compacted CSR matrix into a stripe of DSMat.
virtual void SparseToDense(DDMat & DenseMat) =0
Compacts the DSMat into a DDMat.
virtual void RemoveEmptyCSRs() =0
Remove empty CSRs. For safety, the output matrix is non-symmetric.
virtual void RowStats(const int nb, const rExt * UpBounds, rExt * Stats) =0
Function to compute row statistics of the DSMat matrix. The norm of the rows will be divided in the user provided classes and written in the Stats array. The array UpBound defines the upper bound of each rownorm category, i.e. if the row norm is below to UpBound[i], it belongs to the class i.
virtual bool isOnGPU() const =0
Check if the matrix is on GPU.
virtual void CreateFromCSRMAT(const CSRMAT & csr_A, VEC_CPU< iReg > & vec_hos_pt_dom, VEC_CPU< type_MPI_int > & footprint) =0
Create A block of CSR from a CSR.
virtual void SymPatt() =0
Symmetrizes the Matrix pattern adding null coefficients.
virtual void DxM(DDMat & D) =0
Diagonal matrix by Matrix product.
virtual void MxD_Beta(DDMat & D_Beta, DDMat & D_Theta) =0
Compute tilde As_FF from As_FF for the EXTI MxM computation.
const iExt * get_ptr_comm_index_L_RcvLst_data() const
Get pointer to comm_index_L_RcvLst.
const iExt * get_ptr_comm_index_L_SndLst_data() const
Get pointer to comm_index_L_SndLst.
const iExt * get_ptr_comm_index_R_RcvLst_data() const
Get pointer to comm_index_R_RcvLst.
const iExt * get_ptr_comm_index_R_SndLst_data() const
Get pointer to comm_index_R_SndLst.
rExt * get_ptr_WL_snd_data()
Get pointer to WL_snd.
rExt * get_ptr_WR_snd_data()
Get pointer to WR_snd.
MPI_Request * get_ptr_Recv_req_data()
Get pointer to Recv_req.
MPI_Request * get_ptr_Send_req_data()
Get pointer to Send_req.
const iReg * get_ptr_L_jc_RcvLst_data() const
Get pointer to L_jc_RcvLst.
const iReg * get_ptr_L_jc_SndLst_data() const
Get pointer to L_jc_SndLst.
iReg get_L_jc_SndLst_size() const
Get size of L_jc_SndLst.
const iReg * get_ptr_R_jc_RcvLst_data() const
Get pointer to R_jc_RcvLst.
const iReg * get_ptr_R_jc_SndLst_data() const
Get pointer to R_jc_SndLst.
iReg get_R_jc_SndLst_size() const
Get size of R_jc_SndLst.
type_MPI_int * get_ptr_in_list_com_scr_data()
Get global incoming comunication list.
type_MPI_int * get_ptr_out_list_com_scr_data()
Get global outgoing comunication list.

Protected Functions

Name
virtual bool Check_inner() const
Internal check.
void collect_jc_NoSort(VEC_CPU< iExt > & comm_index_L_Lst, VEC_CPU< iReg > & L_jc_Lst, VEC_CPU< iExt > & comm_index_R_Lst, VEC_CPU< iReg > & R_jc_Lst, VEC_CPU< iReg > & comm_ncols, iExt & nterms_AexD, iExt & nterms_Adiag, VEC_CPU< CSRMAT_CPU > & CSR)
Evaluates and Store L/R_jc_Snd/RcvLst using external scratches.
void CompletePreliminaryComm_MxM(VEC_CPU< type_MPI_int > & Rcv_nb, VEC_CPU< MPI_Request > & vec_snd_nb_req, VEC_CPU< MPI_Request > & vec_rcv_nb_req, VEC_CPU< iReg > & Snd_ids_nc, VEC_CPU< VEC_CPU< iReg >> & Rcv_ids_nc, VEC_CPU< MPI_Request > & vec_snd_ids_nc_req, VEC_CPU< MPI_Request > & vec_rcv_ids_nc_req, const VEC_CPU< iReg > & Snd_nrows, VEC_CPU< iReg > & Rcv_nrows, VEC_CPU< MPI_Request > & vec_snd_nrows_req, VEC_CPU< MPI_Request > & vec_rcv_nrows_req, VEC_CPU< VEC_CPU< iReg >> & Rcv_lst_rows, VEC_CPU< MPI_Request > & vec_snd_lst_rows_req, VEC_CPU< MPI_Request > & vec_rcv_lst_rows_req, VEC_CPU< VEC_CPU< iReg >> & vec_loc_offset, type_MPI_int & nb_B_tot, type_MPI_int tag_ids_nc, type_MPI_int tag_Lst_rows)
Complete preliminary communications for MxM.
void restore_jc(const iReg nrows, const iExt nterm, iExt restrict iat, iReg restrict ja, iReg *restrict jc_RcvLst)
Restore column index.
void copy_DSMat(DSMat const & other)
Copy DSMat members.
void clean_DSMat()
Clean DSMat internal structures.
void Prepare_MxV_DSMat(const iReg nRHS)
Prepares the DSMat data structure necessary for MxV.
void Prepare_MxV_DSMat_new()
void UndoPrepare_MxV_DSMat()
Undoes Prepare of the DSMat data structure necessary for MxV.
void UndoPrepare_MxV_DSMat_new()
CSRMAT_CPU Convert_arrayCSR_To_ScalarLRGCSR(iReg * new_order =nullptr) const
Creates a CSRMAT_CPU starting from the array of local csr matrices. Useful in printing (used by Print_ASCII/BIN).

Public Attributes

Name
bool sym_flag
flag for symmetric matrix.
iReg nrows
number of rows (matrix size).
CommGraph * MatGraph
Incoming (for MxV and MxM) Communication graph.
CommGraph * OutMatGraph
Outgoing (for MxV and MxM) Communication graph If the matrix is symmetric OutMatGraph just points to the same MatGraph data.
VEC_CPU< iReg > * ptDom
vector of pointers to the compacted column indices of each incoming block. That is, ptDom[ib+1] - ptDom[ib] gives the number of columns of the incoming block ib (ib block on this row of blocks).
VEC_CPU< iReg > * OutptDom
transposed local compact vector to the unknowns
VEC_CPU< CSRMAT_CPU > csr
vector of CSR matrices stored on the host.
CSRMAT_CPU * matR
array to the Right CSR: each of this will be a reference to the previous vector of CSR (no memory associated)
CSRMAT_CPU * matL
array to the left CSR: each of this will be a reference to a CSR mat (no memory associated)
CSRMAT_CPU * matC
pointer to the diagonal entry of the vector csr (no memory associated)
VEC_CPU< type_MPI_int > in_list_com_scr
global incoming comunication list
VEC_CPU< type_MPI_int > out_list_com_scr
global outgoing comunication list
VEC_CPU< MPI_Request > Send_req
request handle for unknowns send
VEC_CPU< MPI_Request > Recv_req
request handle for unknowns received

Protected Attributes

Name
bool DUMP_STRIPE
Debug flag for DSMat printing in case of ‘deep’ debug in EMIN.
iReg maxsize_comm
maximum number of unknowns among all the local CSR matrix
iReg nrows_i
number of internal rows (internal variables).
VEC_CPU< iReg > L_jc_SndLst
list of column indices for Snd of left blocks (local to global)
VEC_CPU< iExt > comm_index_L_SndLst
list of indices to access the L_jc_SndLst
VEC_CPU< iReg > R_jc_SndLst
list of column indices for Snd of right blocks (local to global)
VEC_CPU< iExt > comm_index_R_SndLst
list of indices to access the R_jc_SndLst
VEC_CPU< iReg > L_jc_RcvLst
list of column indices for recv of left blocks (local to global)
VEC_CPU< iExt > comm_index_L_RcvLst
list of indices to access the L_jc_RcvLst
VEC_CPU< iReg > R_jc_RcvLst
list of column indices for recv of right blocks (local to global)
VEC_CPU< iExt > comm_index_R_RcvLst
list of indices to access the R_jc_RcvLst
VEC_CPU< rExt > WL_snd
work array to send unknowns to left
VEC_CPU< rExt > WR_snd
work array to send unknowns to right
VEC_CPU< bool > Recv_flag
logical vector to check weather or not the message has been sent

Friends

Name
class DSCoef_CPU
void cptAugMat(DSMat & Bt, DSMat const & A, VEC_CPU< rExt > & D)

Additional inherited members

Public Functions inherited from MatrixProd

Name
bool get_Prepared_flag() const
Get flag for MxV prepare.
iReg get_nRHS_prep() const
Get the number of rhs the matrix is prepared for.
iGlo Get_Globalnrows() const
Retrieve the global number of rows using internal variable.
iGlo Get_Globalnrows()
Retrieve the global number of rows using internal variable.
void set_Prepared_flag(const bool input_Prepared_flag)
Get flag for MxV prepare.
bool Check()
Checks that the MatrixProd instance has been correctly constructed.
virtual ~MatrixProd() =0
Deletes the object.

Protected Functions inherited from MatrixProd

Name
void copy_MatrixProd(MatrixProd const & other)
Copy members.

Protected Attributes inherited from MatrixProd

Name
iGlo glob_nrows
total number of rows (matrix size).
bool Prepared_flag
flag for MxV prepare.
iReg nRHS_prep
number of rhs the matrix is prepared for

Detailed Description

class DSMat;

This class is used to represent Distributed Sparse Matrix.

class DSMat.

Public Functions Documentation

function collect_jc

void collect_jc(
    VEC_CPU< iExt > & comm_index_L_Lst,
    VEC_CPU< iReg > & L_jc_Lst,
    VEC_CPU< iExt > & comm_index_R_Lst,
    VEC_CPU< iReg > & R_jc_Lst,
    VEC_CPU< iReg > & vec_ncols,
    iExt & nterms_AexD
)

Evaluates and Store L/R_jc_Snd/RcvLst using external scratches.

function operator=

DSMat & operator=(
    DSMat const & other
)

Copy operator.

function set_sym_flag

void set_sym_flag(
    bool input_sym_flag
)

Set the symmetric flag.

function set_nrows

void set_nrows(
    iReg input_nrows,
    iReg input_nrows_i
)

Set nrows and nrows_i.

function set_maxsize_comm

void set_maxsize_comm(
    iReg input_maxsize_comm
)

Set maximum number of unknowns among all the local CSR matrix;.

function get_sym_flag

bool get_sym_flag() const

Get symmetric flag.

function get_nrows

virtual iReg get_nrows() const

Get nrows.

Reimplements: MatrixProd::get_nrows

function get_nrows_i

iReg get_nrows_i() const

Get nrows_i.

function get_maxsize_comm

iReg get_maxsize_comm() const

Get maximum number of unknowns among all the local CSR matrix (maxsize_comm).

function get_ptr_ptDom_data

iReg * get_ptr_ptDom_data()

Get pointer to ptDom.

function get_ptr_ptDom_data

const iReg * get_ptr_ptDom_data() const

function get_ptr_OutptDom_data

iReg * get_ptr_OutptDom_data()

Get OutptDom.

function get_ptr_OutptDom_data

const iReg * get_ptr_OutptDom_data() const

function Get_Globalnrows_inner

virtual iGlo Get_Globalnrows_inner() const

Reimplements: MatrixProd::Get_Globalnrows_inner

Evaluates the total number of rows of the distributed matrix using a reduction.

function mk_OutptDom

void mk_OutptDom()

Creates OutptDom from the Outgoing communication graph.

function SyncDevice

virtual void SyncDevice() =0

Synchronize the device according to HostMat.

Reimplemented by: DSMat_CPU::SyncDevice

function get_HostMat

virtual DSMat * get_HostMat() =0

Retrieve pointer to the DSMat structure stored on the host.

Reimplemented by: DSMat_CPU::get_HostMat

function CreateFromCPU

virtual void CreateFromCPU(
    const DSMat & Mat
) =0

Creates a DSMat from a DSMat_CPU.

Reimplemented by: DSMat_CPU::CreateFromCPU

function CreateCPU

virtual void CreateCPU(
    DSMat & Mat
) =0

Creates a DSMat_CPU.

Reimplemented by: DSMat_CPU::CreateCPU

function ~DSMat

virtual ~DSMat() =0

Deletes the object.

function evaluate_and_store_maxsize_comm

virtual void evaluate_and_store_maxsize_comm() =0

Evaluate maximum number of incoming unknowns of the local csr matrices and store the result in maxsize_comm.

Reimplemented by: DSMat_CPU::evaluate_and_store_maxsize_comm

function copy

virtual void copy(
    MatrixProd const & other
) =0

Reimplements: MatrixProd::copy

Reimplemented by: DSMat_CPU::copy

@ brief Copy the object.

function clean

virtual void clean() =0

Reimplemented by: DSMat_CPU::clean

@ brief Clean internal structures.

function get_nterm

virtual iExt get_nterm() const =0

Get local nterm (total number of terms in the process stripe).

Reimplemented by: DSMat_CPU::get_nterm

function GetInfo

virtual matInfo GetInfo() =0

This function retrieves some basic properties of the DSMAT and returns this information in the ad hoc structure info.

Reimplemented by: DSMat_CPU::GetInfo

function Get_Globalnterm

virtual iGlo Get_Globalnterm() const =0

Evaluates the total number of nterm of the distributed csr matrices.

Reimplemented by: DSMat_CPU::Get_Globalnterm

function Get_GlobalMaxRowNorm

virtual rExt Get_GlobalMaxRowNorm() const =0

Evaluates the maximum value of the norm of a row of the matrix.

Reimplemented by: DSMat_CPU::Get_GlobalMaxRowNorm

function Get_GlobalLocMaxRowNorm

virtual struct LocMax Get_GlobalLocMaxRowNorm() const =0

Evaluates the maximum value and location of the norm of a row of the matrix.

Reimplemented by: DSMat_CPU::Get_GlobalLocMaxRowNorm

function Get_GlobalAvgRowNorm

virtual rExt Get_GlobalAvgRowNorm() =0

Evaluates the average value of the norm of a row of the matrix.

Reimplemented by: DSMat_CPU::Get_GlobalAvgRowNorm

function Prepare_MxV

virtual void Prepare_MxV(
    const iReg nRHS
) =0

Prepares the data structure necessary for MxV.

Reimplements: MatrixProd::Prepare_MxV

Reimplemented by: DSMat_CPU::Prepare_MxV

function UndoPrepare_MxV

virtual void UndoPrepare_MxV() =0

Undoes the data structure necessary for MxV.

Reimplements: MatrixProd::UndoPrepare_MxV

Reimplemented by: DSMat_CPU::UndoPrepare_MxV

function MxV

virtual void MxV(
    DDMat & x,
    DDMat & b,
    bool Barrier_flag
) =0

Computes the Matrix by vector Product.

Parameters:

  • x vector that is multiplied by the matrix.
  • b vector where result is stored.
  • Barrier_flag if true global Barrier is called before return.

Reimplements: MatrixProd::MxV

Reimplemented by: DSMat_CPU::MxV

function MxM

virtual void MxM(
    DSMat & B,
    DSMat & C
) =0

Computes the Matrix by Matrix Product A x B = C (with A equal to this).

Parameters:

  • B matrix that multiplies the matrix.
  • C matrix where result is stored.

Reimplemented by: DSMat_CPU::MxM

function RAP

virtual void RAP(
    DSMat & A,
    DSMat & P,
    DSMat & An
) =0

Computes the RAP product for AMG as R x A x P = An (with R equal to ‘this’).

Parameters:

  • A operator matrix.
  • P prolongation matrix.
  • An next operator matrix.

Reimplemented by: DSMat_CPU::RAP

function sum

virtual void sum(
    DSMat & B,
    DSMat & C,
    const rExt fb =1.0,
    const rExt fa =1.0
) =0

Computes the Matrix sum fa x A + fb x B = C (with A equal to this).

Parameters:

  • B matrix that multiplies the matrix.
  • C matrix where result is stored.
  • fb multiplication factor of A.
  • fa multiplication factor of A.

Reimplemented by: DSMat_CPU::sum

function MxM_pattB_init

virtual void MxM_pattB_init(
    DSCoef_CPU & B,
    MPI_DSMat_SendRecvCompactCSR & Buffers,
    MxM_pattB_Scratch & SCR
) =0

Initializes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.

Parameters:

  • B matrix that multiplies the matrix.
  • Buffers object that manages the communications
  • SCR matrix where result is stored.

Reimplemented by: DSMat_CPU::MxM_pattB_init

function MxM_pattB_comp

virtual void MxM_pattB_comp(
    DSCoef_CPU const & B,
    DSCoef_CPU & C,
    MPI_DSMat_SendRecvCompactCSR & Buffers,
    MxM_pattB_Scratch & SCR
) =0

Computes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.

Parameters:

  • B matrix that multiplies the matrix.
  • Buffers object that manages the communications
  • SCR matrix where result is stored.

Reimplemented by: DSMat_CPU::MxM_pattB_comp

function MxM_pattB_finalize

virtual void MxM_pattB_finalize(
    MPI_DSMat_SendRecvCompactCSR & Buffers,
    MxM_pattB_Scratch & SCR
) =0

Finalizes the Matrix by Matrix Product A x B = C (with A equal to this). where C has the same pattern of B.

Parameters:

  • B matrix that multiplies the matrix.
  • Buffers object that manages the communications
  • SCR matrix where result is stored.

Reimplemented by: DSMat_CPU::MxM_pattB_finalize

function TreatBC

virtual void TreatBC() =0

Reimplemented by: DSMat_CPU::TreatBC

This function modifies a DSMat_CPU instance by detecting rows/columns associated to Dirichlet boundary conditions and setting to those rows/columns a diagonal entry equal to the maximum diagonal entry of the whole matrix. In such a way the minimum eigenvalue of the matrix is not erroneously associated to the arbitrary value given to the diagonal entries of boundary dofs. Detection is carried out by performing one Jacobi smoothing step on the constant vector and setting as BC those dofs whose value is zero

function Accumulate

virtual void Accumulate(
    const rExt fa,
    const rExt fb,
    DSMat & B
) =0

Accumulate a matrix B over A (with ‘this’ == A) such that A = fa x A + fb x B.

Parameters:

  • fa multiplication factor of A.
  • fb multiplication factor of B.
  • B matrix B to sum.

Reimplemented by: DSMat_CPU::Accumulate

NOTE: the pattern of A must contain the pattern of B.

function Transpose

virtual void Transpose(
    DSMat & MatT
) =0

Transpose the matrix.

Parameters:

  • MatT Tranposed Matrix.

Reimplemented by: DSMat_CPU::Transpose

function PartKway

virtual void PartKway(
    const type_MPI_int rank,
    const type_MPI_int size,
    VEC_CPU< iGlo > & vec_part,
    VEC_CPU< iGlo > & vec_iperm
) =0

Redistributes the entries currently stored locally into this process to all the other process according to a partition generated by metis.

Reimplemented by: DSMat_CPU::PartKway

function PartRevAug

virtual void PartRevAug(
    const type_MPI_int rank,
    const type_MPI_int size,
    VEC_CPU< iGlo > & vec_part,
    VEC_CPU< iGlo > & vec_iperm
) =0

Redistributes the entries currently stored locally into this process to all the other process according to a partition for Reverse Augmented preconditioned.

Reimplemented by: DSMat_CPU::PartRevAug

function Redist

virtual void Redist(
    const type_MPI_int rank,
    const type_MPI_int size,
    const VEC_CPU< iGlo > & vec_part,
    const VEC_CPU< iGlo > & vec_iperm,
    DSMat & mat_AP
) =0

Creates through metis a partition of the DSMat instance.

Reimplemented by: DSMat_CPU::Redist

function Redist_Rect

virtual void Redist_Rect(
    const type_MPI_int rank,
    const type_MPI_int size,
    const VEC_CPU< iGlo > & vec_part_row,
    const VEC_CPU< iGlo > & vec_iperm_row,
    const VEC_CPU< iGlo > & vec_part_col,
    const VEC_CPU< iGlo > & vec_iperm_col,
    DSMat & mat_AP
) =0

Creates through metis a partition of the DSMat instance (rectangular DSMat).

Reimplemented by: DSMat_CPU::Redist_Rect

function LocalRCM

virtual void LocalRCM(
    VEC_CPU< iReg > & vec_perm,
    VEC_CPU< iReg > & vec_iperm
) =0

Computes a local permutation (i.e. each subdomain has a local independent ordering) on an input DSMat using the reverse Cuthill-McKee (RCM) algorithm.

Reimplemented by: DSMat_CPU::LocalRCM

function Print_ASCII

virtual void Print_ASCII(
    const string & filename
) const =0

Prints the distributed sparse matrix in ASCII filename (overwrite if it exists). It uses Convert_arrayCSR_To_ScalarLRGCSR and CreateGlobalOffset.

Reimplemented by: DSMat_CPU::Print_ASCII

function Print_BIN

virtual void Print_BIN(
    const string & filename
) const =0

Prints the distributed sparse matrix in BINARY filename (overwrite if it exists). It uses Convert_arrayCSR_To_ScalarLRGCSR and CreateGlobalOffset.

Reimplemented by: DSMat_CPU::Print_BIN

function DumpInfo

void DumpInfo(
    const string & filename
) const

Prints the distributed sparse matrix information in an ASCII filename (overwrite if it exists).

function CreateCompactCSR

virtual void CreateCompactCSR(
    CSRMAT & mat_out,
    iReg & shift_diag
) const =0

Creates a compacted CSR matrix from a stripe of DSMat.

Reimplemented by: DSMat_CPU::CreateCompactCSR

function Load_CompactCSR

virtual void Load_CompactCSR(
    const CSRMAT & mat_in
) =0

This function loads a compacted CSR matrix into a stripe of DSMat.

Reimplemented by: DSMat_CPU::Load_CompactCSR

function SparseToDense

virtual void SparseToDense(
    DDMat & DenseMat
) =0

Compacts the DSMat into a DDMat.

Parameters:

  • DenseMat dense matrix

Reimplemented by: DSMat_CPU::SparseToDense

function RemoveEmptyCSRs

virtual void RemoveEmptyCSRs() =0

Remove empty CSRs. For safety, the output matrix is non-symmetric.

Reimplemented by: DSMat_CPU::RemoveEmptyCSRs

function RowStats

virtual void RowStats(
    const int nb,
    const rExt * UpBounds,
    rExt * Stats
) =0

Function to compute row statistics of the DSMat matrix. The norm of the rows will be divided in the user provided classes and written in the Stats array. The array UpBound defines the upper bound of each rownorm category, i.e. if the row norm is below to UpBound[i], it belongs to the class i.

Reimplemented by: DSMat_CPU::RowStats

function isOnGPU

virtual bool isOnGPU() const =0

Check if the matrix is on GPU.

Reimplements: MatrixProd::isOnGPU

Reimplemented by: DSMat_CPU::isOnGPU

function CreateFromCSRMAT

virtual void CreateFromCSRMAT(
    const CSRMAT & csr_A,
    VEC_CPU< iReg > & vec_hos_pt_dom,
    VEC_CPU< type_MPI_int > & footprint
) =0

Create A block of CSR from a CSR.

Reimplemented by: DSMat_CPU::CreateFromCSRMAT

function SymPatt

virtual void SymPatt() =0

Symmetrizes the Matrix pattern adding null coefficients.

Reimplemented by: DSMat_CPU::SymPatt

function DxM

virtual void DxM(
    DDMat & D
) =0

Diagonal matrix by Matrix product.

Reimplemented by: DSMat_CPU::DxM

function MxD_Beta

virtual void MxD_Beta(
    DDMat & D_Beta,
    DDMat & D_Theta
) =0

Compute tilde As_FF from As_FF for the EXTI MxM computation.

Reimplemented by: DSMat_CPU::MxD_Beta

function get_ptr_comm_index_L_RcvLst_data

inline const iExt * get_ptr_comm_index_L_RcvLst_data() const

Get pointer to comm_index_L_RcvLst.

function get_ptr_comm_index_L_SndLst_data

inline const iExt * get_ptr_comm_index_L_SndLst_data() const

Get pointer to comm_index_L_SndLst.

function get_ptr_comm_index_R_RcvLst_data

inline const iExt * get_ptr_comm_index_R_RcvLst_data() const

Get pointer to comm_index_R_RcvLst.

function get_ptr_comm_index_R_SndLst_data

inline const iExt * get_ptr_comm_index_R_SndLst_data() const

Get pointer to comm_index_R_SndLst.

function get_ptr_WL_snd_data

inline rExt * get_ptr_WL_snd_data()

Get pointer to WL_snd.

function get_ptr_WR_snd_data

inline rExt * get_ptr_WR_snd_data()

Get pointer to WR_snd.

function get_ptr_Recv_req_data

inline MPI_Request * get_ptr_Recv_req_data()

Get pointer to Recv_req.

function get_ptr_Send_req_data

inline MPI_Request * get_ptr_Send_req_data()

Get pointer to Send_req.

function get_ptr_L_jc_RcvLst_data

inline const iReg * get_ptr_L_jc_RcvLst_data() const

Get pointer to L_jc_RcvLst.

function get_ptr_L_jc_SndLst_data

inline const iReg * get_ptr_L_jc_SndLst_data() const

Get pointer to L_jc_SndLst.

function get_L_jc_SndLst_size

inline iReg get_L_jc_SndLst_size() const

Get size of L_jc_SndLst.

function get_ptr_R_jc_RcvLst_data

inline const iReg * get_ptr_R_jc_RcvLst_data() const

Get pointer to R_jc_RcvLst.

function get_ptr_R_jc_SndLst_data

inline const iReg * get_ptr_R_jc_SndLst_data() const

Get pointer to R_jc_SndLst.

function get_R_jc_SndLst_size

inline iReg get_R_jc_SndLst_size() const

Get size of R_jc_SndLst.

function get_ptr_in_list_com_scr_data

inline type_MPI_int * get_ptr_in_list_com_scr_data()

Get global incoming comunication list.

function get_ptr_out_list_com_scr_data

inline type_MPI_int * get_ptr_out_list_com_scr_data()

Get global outgoing comunication list.

Protected Functions Documentation

function Check_inner

virtual bool Check_inner() const

Internal check.

Reimplements: MatrixProd::Check_inner

function collect_jc_NoSort

void collect_jc_NoSort(
    VEC_CPU< iExt > & comm_index_L_Lst,
    VEC_CPU< iReg > & L_jc_Lst,
    VEC_CPU< iExt > & comm_index_R_Lst,
    VEC_CPU< iReg > & R_jc_Lst,
    VEC_CPU< iReg > & comm_ncols,
    iExt & nterms_AexD,
    iExt & nterms_Adiag,
    VEC_CPU< CSRMAT_CPU > & CSR
)

Evaluates and Store L/R_jc_Snd/RcvLst using external scratches.

The member this->csr is empty, the entries are given as external variable. Morover, the column indeces of the entries are not sorted.

function CompletePreliminaryComm_MxM

void CompletePreliminaryComm_MxM(
    VEC_CPU< type_MPI_int > & Rcv_nb,
    VEC_CPU< MPI_Request > & vec_snd_nb_req,
    VEC_CPU< MPI_Request > & vec_rcv_nb_req,
    VEC_CPU< iReg > & Snd_ids_nc,
    VEC_CPU< VEC_CPU< iReg >> & Rcv_ids_nc,
    VEC_CPU< MPI_Request > & vec_snd_ids_nc_req,
    VEC_CPU< MPI_Request > & vec_rcv_ids_nc_req,
    const VEC_CPU< iReg > & Snd_nrows,
    VEC_CPU< iReg > & Rcv_nrows,
    VEC_CPU< MPI_Request > & vec_snd_nrows_req,
    VEC_CPU< MPI_Request > & vec_rcv_nrows_req,
    VEC_CPU< VEC_CPU< iReg >> & Rcv_lst_rows,
    VEC_CPU< MPI_Request > & vec_snd_lst_rows_req,
    VEC_CPU< MPI_Request > & vec_rcv_lst_rows_req,
    VEC_CPU< VEC_CPU< iReg >> & vec_loc_offset,
    type_MPI_int & nb_B_tot,
    type_MPI_int tag_ids_nc,
    type_MPI_int tag_Lst_rows
)

Complete preliminary communications for MxM.

function restore_jc

void restore_jc(
    const iReg nrows,
    const iExt nterm,
    iExt *__restrict__ iat,
    iReg *__restrict__ ja,
    iReg *__restrict__ jc_RcvLst
)

Restore column index.

function copy_DSMat

void copy_DSMat(
    DSMat const & other
)

Copy DSMat members.

function clean_DSMat

void clean_DSMat()

Clean DSMat internal structures.

function Prepare_MxV_DSMat

void Prepare_MxV_DSMat(
    const iReg nRHS
)

Prepares the DSMat data structure necessary for MxV.

It prepares only the DSMat data structure, so it is a protected function that has to be called by derived objects as DSMat_CPU and DSMat_GPU

function Prepare_MxV_DSMat_new

void Prepare_MxV_DSMat_new()

function UndoPrepare_MxV_DSMat

void UndoPrepare_MxV_DSMat()

Undoes Prepare of the DSMat data structure necessary for MxV.

It undoes prepare of only the DSMat data structure, so it is a protected function that has to be called by derived objects as DSMat_CPU and DSMat_GPU

function UndoPrepare_MxV_DSMat_new

void UndoPrepare_MxV_DSMat_new()

function Convert_arrayCSR_To_ScalarLRGCSR

CSRMAT_CPU Convert_arrayCSR_To_ScalarLRGCSR(
    iReg * new_order =nullptr
) const

Creates a CSRMAT_CPU starting from the array of local csr matrices. Useful in printing (used by Print_ASCII/BIN).

Return: CSRMAT_CPU

Public Attributes Documentation

variable sym_flag

bool sym_flag = false;

flag for symmetric matrix.

variable nrows

iReg nrows = 0;

number of rows (matrix size).

variable MatGraph

CommGraph * MatGraph = nullptr;

Incoming (for MxV and MxM) Communication graph.

variable OutMatGraph

CommGraph * OutMatGraph = nullptr;

Outgoing (for MxV and MxM) Communication graph If the matrix is symmetric OutMatGraph just points to the same MatGraph data.

variable ptDom

VEC_CPU< iReg > * ptDom = nullptr;

vector of pointers to the compacted column indices of each incoming block. That is, ptDom[ib+1] - ptDom[ib] gives the number of columns of the incoming block ib (ib block on this row of blocks).

variable OutptDom

VEC_CPU< iReg > * OutptDom = nullptr;

transposed local compact vector to the unknowns

vector of pointers to the compacted row indices of each outgoing block. That is, OutptDom[ib+1] - OutptDom[ib] gives the number of rows of the outgoing block ib (ib block on the column of blocks including this rank). If the matrix is symmetric OutptDom just points to the same ptDom data

variable csr

VEC_CPU< CSRMAT_CPU > csr;

vector of CSR matrices stored on the host.

The block C (diagonal) must be allocated also if it is null because matC must point to something

variable matR

CSRMAT_CPU * matR = nullptr;

array to the Right CSR: each of this will be a reference to the previous vector of CSR (no memory associated)

variable matL

CSRMAT_CPU * matL = nullptr;

array to the left CSR: each of this will be a reference to a CSR mat (no memory associated)

variable matC

CSRMAT_CPU * matC = nullptr;

pointer to the diagonal entry of the vector csr (no memory associated)

variable in_list_com_scr

VEC_CPU< type_MPI_int > in_list_com_scr;

global incoming comunication list

variable out_list_com_scr

VEC_CPU< type_MPI_int > out_list_com_scr;

global outgoing comunication list

variable Send_req

VEC_CPU< MPI_Request > Send_req;

request handle for unknowns send

variable Recv_req

VEC_CPU< MPI_Request > Recv_req;

request handle for unknowns received

Protected Attributes Documentation

variable DUMP_STRIPE

bool DUMP_STRIPE = false;

Debug flag for DSMat printing in case of ‘deep’ debug in EMIN.

variable maxsize_comm

iReg maxsize_comm = 0;

maximum number of unknowns among all the local CSR matrix

variable nrows_i

iReg nrows_i = 0;

number of internal rows (internal variables).

variable L_jc_SndLst

VEC_CPU< iReg > L_jc_SndLst;

list of column indices for Snd of left blocks (local to global)

variable comm_index_L_SndLst

VEC_CPU< iExt > comm_index_L_SndLst;

list of indices to access the L_jc_SndLst

variable R_jc_SndLst

VEC_CPU< iReg > R_jc_SndLst;

list of column indices for Snd of right blocks (local to global)

variable comm_index_R_SndLst

VEC_CPU< iExt > comm_index_R_SndLst;

list of indices to access the R_jc_SndLst

variable L_jc_RcvLst

VEC_CPU< iReg > L_jc_RcvLst;

list of column indices for recv of left blocks (local to global)

variable comm_index_L_RcvLst

VEC_CPU< iExt > comm_index_L_RcvLst;

list of indices to access the L_jc_RcvLst

variable R_jc_RcvLst

VEC_CPU< iReg > R_jc_RcvLst;

list of column indices for recv of right blocks (local to global)

variable comm_index_R_RcvLst

VEC_CPU< iExt > comm_index_R_RcvLst;

list of indices to access the R_jc_RcvLst

variable WL_snd

VEC_CPU< rExt > WL_snd;

work array to send unknowns to left

variable WR_snd

VEC_CPU< rExt > WR_snd;

work array to send unknowns to right

variable Recv_flag

VEC_CPU< bool > Recv_flag;

logical vector to check weather or not the message has been sent

Friends

friend DSCoef_CPU

friend class DSCoef_CPU;

friend cptAugMat

friend void cptAugMat(
    DSMat & Bt,

    DSMat const & A,

    VEC_CPU< rExt > & D
);

Updated on 19 November 2024 at 10:20:48 CET