SpM Handbook 1.2.4
|
#include "common.h"
Go to the source code of this file.
Functions | |
SPM distribution subroutines | |
int | spmRedistribute (const spmatrix_t *spm, spm_int_t new_n, const spm_int_t *newl2g, spmatrix_t *newspm) |
Create a copy of a given SPM with a new distribution corresponding to the given loc2glob array. | |
#define | COLTAG 97 |
Internal tag for colptr array communications. | |
#define | ROWTAG 98 |
Internal tag for rowptr array communications. | |
#define | VALTAG 99 |
Internal tag for values array communications. | |
typedef struct spm_req_manager_s | spm_req_manager_t |
Data structure to manage the communication requests. | |
static void | spm_redist_reqmanager_test (spm_req_manager_t *reqmanager) |
Make the communications progress in the request manager structure. | |
static void | spm_redist_reqmanager_wait (spm_req_manager_t *reqmanager) |
Wait for all the communications to be completed. | |
static spm_int_t * | spm_redist_get_newg2l (const spmatrix_t *oldspm, spm_int_t new_n, const spm_int_t *newl2g) |
Get the new glob2loc array. | |
static void | spm_redist_extract_local (const spmatrix_t *oldspm, const spm_int_t *newg2l, int distribution, spm_int_t *sendsizes, spm_int_t *recvsizes, spmatrix_t *newspm) |
Extract the local information and compute the volumes to exchange. | |
static void | spm_redist_post_recv (spmatrix_t *newspm, const spm_int_t *recvsizes, int distribution, spm_req_manager_t *reqmanager) |
Allocate the reqtab array and post all the required receptions for each process. | |
static void | spm_redist_reqmanager_try_sendone (spm_req_manager_t *reqmanager, struct spm_send_data_s *sendproc, int dest, MPI_Comm comm) |
Submit the send request if the buffers are filled. | |
static void | spm_redist_send_loop_csx (const spmatrix_t *oldspm, const spm_int_t *newg2l, struct spm_send_data_s *senddata, spm_req_manager_t *reqmanager) |
Fill all the send arrays from CSC/CSR format to IJV buffers and submit the send. | |
static void | spm_redist_send_loop_ijv (const spmatrix_t *oldspm, const spm_int_t *newg2l, struct spm_send_data_s *senddata, spm_req_manager_t *reqmanager, int distribution) |
Fill all the send arrays from IJV format to IJV buffers and submit the send. | |
static void | spm_redist_send (const spmatrix_t *oldspm, const spm_int_t *newg2l, const spm_int_t *sendsizes, spm_req_manager_t *reqmanager, int distribution) |
Fill all the send arrays and send them. | |
static void | spm_redist_finalize (const spmatrix_t *oldspm, spmatrix_t *newspm, const spm_int_t *newg2l, const spm_int_t *newl2g, spm_int_t new_n) |
Finalize the compuration of the newspm to correspond to oldspm redistributed thanks to newl2g. | |
SPM subroutines to redistribute a given SPM with a new distribution.
Definition in file spm_redistribute.c.
#define COLTAG 97 |
Internal tag for colptr array communications.
Definition at line 33 of file spm_redistribute.c.
#define ROWTAG 98 |
Internal tag for rowptr array communications.
Definition at line 34 of file spm_redistribute.c.
#define VALTAG 99 |
Internal tag for values array communications.
Definition at line 35 of file spm_redistribute.c.
|
static |
Make the communications progress in the request manager structure.
[in,out] | reqmanager | The data structure that holds the requests to test for progress. On exit, the array if compacted in release mode. |
Definition at line 59 of file spm_redistribute.c.
Referenced by spm_redist_reqmanager_try_sendone().
|
static |
Wait for all the communications to be completed.
[in,out] | reqmanager | The data structure that holds the requests to wait for completion. |
Definition at line 101 of file spm_redistribute.c.
Referenced by spm_redist_send().
|
static |
Get the new glob2loc array.
[in] | oldspm | The sparse matrix to redistribute. |
[in] | new_n | The size of newl2g |
[in] | newl2g | The new loc2glob. |
Definition at line 153 of file spm_redistribute.c.
References spmatrix_s::baseval, spmatrix_s::comm, spmatrix_s::glob2loc, spmatrix_s::gN, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::replicated, spm_getandset_glob2loc(), and spmInitDist().
Referenced by spmRedistribute().
|
static |
Extract the local information and compute the volumes to exchange.
This function create a copy of the matrix in which it extracts the local information, while it computes the number of data to exchange with everyone. On exit, the new spm is allocated to its final size in the IJV format to receive information from the other nodes.
[in] | oldspm | The original sparse matrix to redistribute. |
[in] | newg2l | The new spm glob2loc array of size oldspm->gN and 0-based. The array is generated with spm_redist_get_newg2l() and shifted to match the oldspm baseval. |
[in] | distribution | The distribution of thne original matrix as computed by spm_get_distribution(). |
[in,out] | sendsizes | On entry, array of size (2*clustnbr) that must be allocated. On exit, the array stores the couple (nbelts, nbvals) of the number of elements/values to send to each remote process. |
[in,out] | recvsizes | On entry, array of size (2*clustnbr) that must be allocated. On exit, the array stores the couple (nbelts, nbvals) of the number of elements/values to reacv from each remote process. |
[in,out] | newspm | Initialize the redistributed spm. |
Definition at line 212 of file spm_redistribute.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::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::mtxtype, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::nnzexp, spmatrix_s::replicated, spmatrix_s::rowptr, SPM_MPI_INT, spm_size_of(), SpmDistByColumn, SpmIJV, spmInitDist(), and spmatrix_s::values.
Referenced by spmRedistribute().
|
static |
Allocate the reqtab array and post all the required receptions for each process.
[in,out] | newspm | The new spm in which to store the reception. Must be in IJV format. On entry, it is allocated to store all the information that will be received, and on exit, it may be partially updated by the reception asynchronously. |
[in] | recvsizes | Amount of recvs for each process. {ptr_recvs, val_recvs} |
[in] | distribution | The distribution of the original sparse matrix. |
[in,out] | reqmanager | On entry, an allocated request manager structure. On exit, the data structure is initialized and the first requests are associated to the submitted reception. |
Definition at line 416 of file spm_redistribute.c.
References spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::colptr, COLTAG, spmatrix_s::comm, spmatrix_s::flttype, spmatrix_s::rowptr, ROWTAG, SPM_MPI_INT, spm_size_of(), SpmDistByColumn, SpmPattern, VALTAG, and spmatrix_s::values.
Referenced by spmRedistribute().
|
static |
Submit the send request if the buffers are filled.
[in,out] | reqmanager | The data structure that holds the requests to wait for completion. |
[in,out] | sendproc | The data structure that holds the data to send. |
[in] | dest | The destination rank of the communications. |
[in] | comm | The MPI communicator to use for the communication |
Definition at line 535 of file spm_redistribute.c.
References COLTAG, ROWTAG, SPM_MPI_INT, spm_redist_reqmanager_test(), and VALTAG.
Referenced by spm_redist_send_loop_csx(), and spm_redist_send_loop_ijv().
|
static |
Fill all the send arrays from CSC/CSR format to IJV buffers and submit the send.
[in] | oldspm | The original sparse matrix to redistribute. |
[in] | newg2l | The new spm glob2loc array [-baseval]. |
[in,out] | senddata | The allocated data structure to holds the information to send. On exit, the buffers are filled and associated send requests are submitted but may not be completed. |
[in,out] | reqmanager | The data structure that holds the requests to wait for completion. |
Definition at line 598 of file spm_redistribute.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::rowptr, spm_redist_reqmanager_try_sendone(), spm_size_of(), SpmCSC, and spmatrix_s::values.
Referenced by spm_redist_send().
|
static |
Fill all the send arrays from IJV format to IJV buffers and submit the send.
[in] | oldspm | The original sparse matrix to redistribute. |
[in] | newg2l | The new spm glob2loc array [-baseval]. |
[in,out] | senddata | The allocated data structure to holds the information to send. On exit, the buffers are filled and associated send requests are submitted but may not be completed. |
[in,out] | reqmanager | The data structure that holds the requests to wait for completion. |
[in] | distribution | The distribution of the original sparse matrix. |
Definition at line 693 of file spm_redistribute.c.
References spmatrix_s::baseval, spmatrix_s::clustnum, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::nnz, spmatrix_s::rowptr, spm_redist_reqmanager_try_sendone(), spm_size_of(), SpmDistByColumn, and spmatrix_s::values.
Referenced by spm_redist_send().
|
static |
Fill all the send arrays and send them.
[in] | oldspm | The sparse matrix to redistribute. |
[in] | newg2l | The new glob2loc array. |
[in] | sendsizes | The array that store the number of elements to send for each process : {col_sends, row_sends, val_sends} |
[in,out] | reqmanager | The data structure that holds the requests to wait for completion. |
[in] | distribution | The distribution of the original sparse matrix. |
Definition at line 776 of file spm_redistribute.c.
References spmatrix_s::baseval, spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::flttype, spmatrix_s::fmttype, spm_redist_reqmanager_wait(), spm_redist_send_loop_csx(), spm_redist_send_loop_ijv(), spm_size_of(), and SpmIJV.
Referenced by spmRedistribute().
|
static |
Finalize the compuration of the newspm to correspond to oldspm redistributed thanks to newl2g.
[in] | oldspm | The sparse matrix to redistribute. |
[in,out] | newspm | The new spm. |
[in] | newg2l | The new glob2loc array. Will be stored in the newspm. |
[in] | newl2g | The new loc2glob array. Will be copied in the newspm. |
[in] | new_n | Size of the new loc2glob. |
Definition at line 850 of file spm_redistribute.c.
References spmatrix_s::baseval, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::flttype, spmatrix_s::fmttype, spmatrix_s::glob2loc, spmatrix_s::gN, spmatrix_s::gNexp, spmatrix_s::gnnz, spmatrix_s::gnnzexp, spmatrix_s::layout, spmatrix_s::loc2glob, spmatrix_s::mtxtype, spmatrix_s::n, spmConvert(), SpmIJV, spmSort(), and spmUpdateComputedFields().
Referenced by spmRedistribute().