SpM Handbook 1.2.4
|
#include "common.h"
Go to the source code of this file.
Functions | |
static void | spm_scatter_getn (const spmatrix_t *spm, spm_int_t *allcounts, int root) |
Gather the n values from all nodes. | |
static void | spm_scatter_csx_get_locals (const spmatrix_t *oldspm, spmatrix_t *newspm, spm_int_t *allcounts, int root) |
Compute the allcounts array with CSC/CSR formats. | |
static void | spm_scatter_ijv_get_locals (const spmatrix_t *oldspm, spmatrix_t *newspm, int distByColumn, spm_int_t *allcounts, int root) |
Compute the allcounts array with IJV format. | |
static void | spm_scatter_init (spmatrix_t *newspm, const spmatrix_t *oldspm, int n, const spm_int_t *loc2glob, int distByColumn, spm_int_t **allcounts, int root, int clustnum, SPM_Comm comm) |
Generic function to initialize a scattered spm on each node. | |
static void | spm_scatter_csx_local_generic (const spmatrix_t *oldspm, spmatrix_t *newspm) |
Local copy of a scattered SPM in CSC or CSR format when everyone holds the original (Generic loc2glob). | |
static void | spm_scatter_csx_local_continuous (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *allcounts) |
Local copy of a scattered SPM in CSC or CSR format when everyone holds the original (Contiuous loc2glob). | |
static void | spm_scatter_csx_send_generic (const spmatrix_t *oldspm, const spmatrix_t *newspm, const spm_int_t *allcounts, int root) |
Send function to scatter an SPM in CSC or CSR format from a single node when the loc2glob array is generic. | |
static MPI_Request * | spm_scatter_csx_send_continuous (const spmatrix_t *oldspm, const spmatrix_t *newspm, const spm_int_t *allcounts, int root) |
Send function to scatter an SPM in CSC or CSR format from a single node when the loc2glob array is split in continuous sets. | |
static void | spm_scatter_csx_send (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *allcounts, int continuous, int root) |
Send wrapper function to scatter an SPM in CSC or CSR format from a single node. | |
static void | spm_scatter_csx_recv (const spmatrix_t *newspm, int continuous, int root) |
Reception of a scattered SPM in the CSC/CSR formats. | |
static void | spm_scatter_csx (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *allcounts, int continuous, int root) |
Scatter the SPM in the CSC/CSR formats. | |
static void | spm_scatter_ijv_local (const spmatrix_t *oldspm, spmatrix_t *newspm, int distByColumn) |
Initialize a local spm in IJV format. | |
static void | spm_scatter_ijv_remote (const spmatrix_t *oldspm, spmatrix_t *newspm, int distByColumn) |
Initialize a temporary remote spm in IJV format to send it. | |
static void | spm_scatter_ijv_send (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *allcounts, int distByColumn, int root) |
Send function to scatter an IJV SPM from a single node. | |
static void | spm_scatter_ijv_recv (const spmatrix_t *newspm, int root) |
Reception of a scattered SPM in the IJV format. | |
static void | spm_scatter_ijv (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *allcounts, int distByColumn, int root) |
Scatter the SPM in the IJV format. | |
SPM distribution subroutines | |
int | spmScatter (spmatrix_t *newspm, int root, const spmatrix_t *oldspm, spm_int_t n, const spm_int_t *loc2glob, int distByColumn, SPM_Comm comm) |
Scatter the SPM thanks to loc2glob. | |
SParse Matrix scatter routine.
Definition in file spm_scatter.c.
|
static |
Gather the n values from all nodes.
[in] | spm | The newspm that will be generated with the n field correctly set. |
[in,out] | allcounts | On entry, the array must be allocated. On exit, stores the {n, nnz, nnzexp} information for all nodes. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 72 of file spm_scatter.c.
References spmatrix_s::clustnbr, spmatrix_s::comm, spmatrix_s::n, and SPM_MPI_INT.
Referenced by spm_scatter_init().
|
static |
Compute the allcounts array with CSC/CSR formats.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in,out] | newspm | The allocated and spmInit() spm in which to store the local information. On entry, n and loc2glob must be specified. On exit, nnz and nnzexp fields are updated. |
[in,out] | allcounts | On entry, the array must be allocated. On exit, stores the {n, nnz, nnzexp} information for all nodes. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 121 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::fmttype, spmatrix_s::gN, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_getandset_glob2loc(), SPM_MPI_INT, and SpmCSC.
Referenced by spm_scatter_init().
|
static |
Compute the allcounts array with IJV format.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in,out] | newspm | The allocated and spmInit() spm in which to store the local information. On entry, n and loc2glob must be specified. On exit, nnz and nnzexp fields are updated. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
[in,out] | allcounts | On entry, the array must be allocated. On exit, stores the {n, nnz, nnzexp} information for all nodes. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 251 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_getandset_glob2loc(), and SPM_MPI_INT.
Referenced by spm_scatter_init().
|
static |
Generic function to initialize a scattered spm on each node.
[in,out] | newspm | On entry, an allocated spm structure. Must be provided by all participants. On exit, contains the local part of the scattered spm. |
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in] | n | The local loc2glob size if provided. Unused if spm->replicated |
[in] | loc2glob | The indices of the local unknowns in the scattered spm. Must be of size n if provided. If NULL, the spm is scattered with equal chunks of unknowns. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
[out] | allcounts | Pointer to an array of triplet {n, nnz, nnzexp} per node allocated by this call. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
[in] | clustnum | Local MPI procnum index in the communicator comm. |
[in] | comm | The MPI communicator on which to distribute the SPM. |
Definition at line 375 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::fmttype, spmatrix_s::gN, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::replicated, spmatrix_s::rowptr, spm_create_loc2glob_continuous(), SPM_MPI_INT, spm_scatter_csx_get_locals(), spm_scatter_getn(), spm_scatter_ijv_get_locals(), spmAlloc(), SpmIJV, spmInit(), and spmatrix_s::values.
Referenced by spmScatter().
|
static |
Local copy of a scattered SPM in CSC or CSR format when everyone holds the original (Generic loc2glob).
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in] | newspm | The new scattered sparse matrix structure to access the clustnbr and communicator. |
Definition at line 490 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_get_value_idx_by_elt(), spm_size_of(), SpmCSC, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_csx(), spm_scatter_csx_send(), and spm_scatter_csx_send_generic().
|
static |
Local copy of a scattered SPM in CSC or CSR format when everyone holds the original (Contiuous loc2glob).
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in] | newspm | The new scattered sparse matrix structure to access the clustnbr and communicator. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
Definition at line 577 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_size_of(), SpmCSC, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_csx(), and spm_scatter_csx_send().
|
static |
Send function to scatter an SPM in CSC or CSR format from a single node when the loc2glob array is generic.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in] | newspm | The new scattered sparse matrix structure to access the clustnbr and communicator. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 644 of file spm_scatter.c.
References spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nexp, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_imax(), SPM_MPI_INT, spm_scatter_csx_local_generic(), spm_size_of(), SpmCSC, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_csx_send().
|
static |
Send function to scatter an SPM in CSC or CSR format from a single node when the loc2glob array is split in continuous sets.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in] | newspm | The new scattered sparse matrix structure to access the clustnbr and communicator. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 777 of file spm_scatter.c.
References spmatrix_s::clustnbr, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::rowptr, SPM_MPI_INT, spm_size_of(), SpmCSC, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_csx_send().
|
static |
Send wrapper function to scatter an SPM in CSC or CSR format from a single node.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in,out] | newspm | The structure to hold the local new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | continuous | Boolean to specify if the distribution is made by regular continuous sets or not. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 869 of file spm_scatter.c.
References spmatrix_s::clustnbr, spmatrix_s::n, spm_scatter_csx_local_continuous(), spm_scatter_csx_local_generic(), spm_scatter_csx_send_continuous(), and spm_scatter_csx_send_generic().
Referenced by spm_scatter_csx().
|
static |
Reception of a scattered SPM in the CSC/CSR formats.
[in,out] | newspm | The structure to hold the new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | continuous | Boolean to specify if the distribution is made by regular continuous sets or not. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 922 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, SPM_MPI_INT, SpmCSC, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_csx().
|
static |
Scatter the SPM in the CSC/CSR formats.
[in] | oldspm | The input sparse matrix to scatter in the CSC or CSR format. |
[in,out] | newspm | The structure to hold the new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | continuous | Boolean to specify if the distribution is made by regular continuous sets or not. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 994 of file spm_scatter.c.
References spmatrix_s::clustnum, spmatrix_s::n, spm_scatter_csx_local_continuous(), spm_scatter_csx_local_generic(), spm_scatter_csx_recv(), and spm_scatter_csx_send().
Referenced by spmScatter().
|
static |
Initialize a local spm in IJV format.
[in] | oldspm | The input sparse matrix to scatter in the IJV format. |
[in,out] | newspm | The structure to hold the local new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
Definition at line 1043 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::glob2loc, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_size_of(), SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_ijv(), and spm_scatter_ijv_send().
|
static |
Initialize a temporary remote spm in IJV format to send it.
[in] | oldspm | The input sparse matrix to scatter in the IJV format. |
[in,out] | newspm | The structure to hold the local new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
Definition at line 1133 of file spm_scatter.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::glob2loc, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_size_of(), SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_ijv_send().
|
static |
Send function to scatter an IJV SPM from a single node.
[in] | oldspm | The input sparse matrix to scatter in the IJV format. |
[in,out] | newspm | The structure to hold the local new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 1230 of file spm_scatter.c.
References spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nexp, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, spm_imax(), SPM_MPI_INT, spm_scatter_ijv_local(), spm_scatter_ijv_remote(), spm_size_of(), SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_ijv().
|
static |
Reception of a scattered SPM in the IJV format.
[in,out] | newspm | The structure to hold the new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | root | The root process sending the information. |
Definition at line 1336 of file spm_scatter.c.
References spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::rowptr, SPM_MPI_INT, SpmPattern, and spmatrix_s::values.
Referenced by spm_scatter_ijv().
|
static |
Scatter the SPM in the IJV format.
[in] | oldspm | The input sparse matrix to scatter in the IJV format. |
[in,out] | newspm | The structure to hold the new scattered sparse matrix. It must have been allocated first, and non array fields must have been initialized, as well as dof and loc2glob. |
[in] | allcounts | Internal array that stores the triplets {n, nnz, nnzexp} for each node. |
[in] | distByColumn | Boolean to decide if the matrix is distributed by rows or columns. If false, distribution by rows. If true, distribution by columns. |
[in] | root | The root process of the scatter operation. -1 if everyone hold a copy of the oldspm. |
Definition at line 1389 of file spm_scatter.c.
References spmatrix_s::clustnum, spm_scatter_ijv_local(), spm_scatter_ijv_recv(), and spm_scatter_ijv_send().
Referenced by spmScatter().