SpM Handbook 1.2.4
Loading...
Searching...
No Matches
spm_gather.c File Reference
#include "common.h"

Go to the source code of this file.

Functions

static int * spm_gather_init (const spmatrix_t *spm)
 Initialize the gather structures.
 
static int spm_gather_check (const spmatrix_t *spm, const int *allcounts)
 Check if a matrix has been scattered continuously or not.
 
static void spm_gather_csx_update (const spmatrix_t *spm, spm_int_t *colptr, int *recvdispls, int *recvcounts)
 Update a gathered compressed array to shift the indices accordingly to the distribution.
 
static void spm_gather_csx (const spmatrix_t *oldspm, spmatrix_t *newspm, int root, int *allcounts)
 Gather a distributed Sparse Matrix on the root node(s) in CSC/CSR format.
 
static void spm_gather_ijv (const spmatrix_t *oldspm, spmatrix_t *newspm, int root, const int *allcounts)
 Gather a distributed Sparse Matrix on the root node(s) in IJV format.
 
int spmGather (const spmatrix_t *oldspm, int root, spmatrix_t *newspm)
 Gather a distributed Sparse Matrix on a single node.
 
int spmGatherInPlace (spmatrix_t *spm)
 This routine performs a allgather of a distributed spm in place.
 

Detailed Description

SParse Matrix gather routine.

Version
1.2.4
Author
Tony Delarue
Mathieu Faverge
Alycia Lisito
Date
2024-06-27

Definition in file spm_gather.c.

Function Documentation

◆ spm_gather_init()

static int * spm_gather_init ( const spmatrix_t spm)
static

Initialize the gather structures.

Parameters
[in]spmThe spm to gather.
Returns
The array of triplets { n, nnz, nnzexp } for all nodes.

Definition at line 39 of file spm_gather.c.

References spmatrix_s::clustnbr, spmatrix_s::comm, spmatrix_s::n, spmatrix_s::nnz, and spmatrix_s::nnzexp.

Referenced by spmGather().

◆ spm_gather_check()

static int spm_gather_check ( const spmatrix_t spm,
const int *  allcounts 
)
static

Check if a matrix has been scattered continuously or not.

Parameters
[in]spmThe spm to gather.
[in]allcountsThe array of triplets { n, nnz, nnzexp } for all nodes.
Return values
0if the matrix is not scattered continuously
!0if the matrix is scattered continuously

Definition at line 73 of file spm_gather.c.

References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::comm, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, and SpmIJV.

Referenced by spmGather().

◆ spm_gather_csx_update()

static void spm_gather_csx_update ( const spmatrix_t spm,
spm_int_t colptr,
int *  recvdispls,
int *  recvcounts 
)
static

Update a gathered compressed array to shift the indices accordingly to the distribution.

Parameters
[in]spmThe original scattered spm
[in]colptrThe pointer to the gathered compressed array (spm->colptr, or spm->rowptr) of the new gathered spm.
[in]recvdisplsThe array of reception displacements for the n values.
[in]recvcountsThe array of reception count in terms of nnz.

Definition at line 125 of file spm_gather.c.

References spmatrix_s::clustnbr, spmatrix_s::gN, and spmatrix_s::gnnz.

Referenced by spm_gather_csx().

◆ spm_gather_csx()

static void spm_gather_csx ( const spmatrix_t oldspm,
spmatrix_t newspm,
int  root,
int *  allcounts 
)
static

Gather a distributed Sparse Matrix on the root node(s) in CSC/CSR format.

Parameters
[in]oldspmThe distributed sparse matrix to gather.
[in]newspmThe new gathered spm. NULL if not root.
[in]rootThe root node that gather the final sparse matrix. If -1, all nodes gather a copy of the matrix.
[in]allcountsThe array of the triplets {n, nnz, nnzexp}.

Definition at line 179 of file spm_gather.c.

References spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_gather_csx_update(), SPM_MPI_INT, SpmCSC, SpmPattern, and spmatrix_s::values.

Referenced by spmGather().

◆ spm_gather_ijv()

static void spm_gather_ijv ( const spmatrix_t oldspm,
spmatrix_t newspm,
int  root,
const int *  allcounts 
)
static

Gather a distributed Sparse Matrix on the root node(s) in IJV format.

Parameters
[in]oldspmThe distributed sparse matrix to gather.
[in]newspmThe new gathered spm. NULL if not root.
[in]rootThe root node that gather the final sparse matrix. If -1, all nodes gather a copy of the matrix.
[in]allcountsThe array of the triplets {n, nnz, nnzexp}.

Definition at line 325 of file spm_gather.c.

References spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::flttype, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, SPM_MPI_INT, SpmPattern, and spmatrix_s::values.

Referenced by spmGather().