SpM Handbook 1.2.4
|
#include "common.h"
#include <cblas.h>
#include <lapacke.h>
Go to the source code of this file.
Functions | |
spm_int_t | spm_create_loc2glob_continuous (const spmatrix_t *spm, spm_int_t **l2g_ptr) |
Generate a continuous loc2glob array on each node. | |
spm_int_t * | spm_get_glob2loc (const spmatrix_t *spm) |
Computes the glob2loc array if needed, and returns it. | |
spm_int_t * | spm_getandset_glob2loc (spmatrix_t *spm) |
Computes the glob2loc array if needed, and returns it. | |
int | spm_get_distribution (const spmatrix_t *spm) |
Search the distribution pattern used in the spm structure. | |
spm_int_t * | spm_get_value_idx_by_col (const spmatrix_t *spm) |
Create an array that represents the shift for each sub-element of the original multidof value array. | |
spm_int_t * | spm_get_value_idx_by_elt (const spmatrix_t *spm) |
Create an array that represents the shift for each sub-element of the original multidof value array. | |
int | spmBlasGetNumThreads (void) |
Return the current number of threads used for blas calls. | |
int | spmBlasSetNumThreads (int nt) |
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) and return the previous number of blas threads. | |
int | spmBlasSetNumThreadsOne (void) |
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) to 1 and return the previous number of blas threads. | |
SPM basic subroutines | |
void | spmInitDist (spmatrix_t *spm, SPM_Comm comm) |
Init the spm structure with a specific communicator. | |
void | spmInit (spmatrix_t *spm) |
Init the spm structure. | |
void | spmAlloc (spmatrix_t *spm) |
Allocate the arrays of an spm structure. | |
void | spmExit (spmatrix_t *spm) |
Cleanup the spm structure but do not free the spm pointer. | |
void | spmBase (spmatrix_t *spm, int baseval) |
Rebase the arrays of the spm to the given value. | |
spm_int_t | spmFindBase (const spmatrix_t *spm) |
Search the base used in the spm structure. | |
int | spmConvert (int ofmttype, spmatrix_t *spm) |
Convert the storage format of the spm. | |
void | spmCopy (const spmatrix_t *spm, spmatrix_t *newspm) |
Create a copy of the spm. | |
SPM debug subroutines | |
void | spm2Dense (const spmatrix_t *spm, void *A) |
Convert the spm matrix into a dense matrix for test purpose. | |
void | spmPrintInfo (const spmatrix_t *spm, FILE *stream) |
Print basic informations about the spm matrix into a given stream. | |
void | spmPrint (const spmatrix_t *spm, FILE *stream) |
Print an spm matrix into into a given file. | |
void | spmExpand (const spmatrix_t *spm_in, spmatrix_t *spm_out) |
Expand a multi-dof spm matrix into an spm with constant dof set to 1. | |
SPM BLAS subroutines | |
double | spmNorm (spm_normtype_t ntype, const spmatrix_t *spm) |
Compute the norm of the spm. | |
double | spmNormVec (spm_normtype_t ntype, const spmatrix_t *spm, const void *x, spm_int_t inc) |
Compute the norm of the spm. | |
double | spmNormMat (spm_normtype_t ntype, const spmatrix_t *spm, spm_int_t n, const void *A, spm_int_t lda) |
Compute the norm of the spm. | |
int | spmMatVec (spm_trans_t trans, double alpha, const spmatrix_t *spm, const void *x, double beta, void *y) |
Compute a matrix-vector product. | |
int | spmMatMat (spm_trans_t trans, spm_int_t n, double alpha, const spmatrix_t *A, const void *B, spm_int_t ldb, double beta, void *C, spm_int_t ldc) |
Compute a matrix-matrix product. | |
void | spmScal (double alpha, spmatrix_t *spm) |
Scale the spm. | |
void | spmScalMatrix (double alpha, spmatrix_t *spm) |
Scale the spm. | |
void | spmScalVec (double alpha, const spmatrix_t *spm, void *x, spm_int_t incx) |
Scale a vector associated to a sparse matrix. Deprecated function replaced by spmScalVec() or spmScalMat(). | |
void | spmScalMat (double alpha, const spmatrix_t *spm, spm_int_t n, void *A, spm_int_t lda) |
Scale a matrix associated to a sparse matrix. | |
void | spmScalVector (spm_coeftype_t flt, double alpha, spm_int_t n, void *x, spm_int_t incx) |
Scale a vector according to the spm type. | |
SPM subroutines to check format | |
int | spmSort (spmatrix_t *spm) |
Sort the subarray of edges of each vertex. | |
spm_int_t | spmMergeDuplicate (spmatrix_t *spm) |
Merge multiple entries in a spm by summing their values together. | |
int | spmCheckAndCorrect (const spmatrix_t *spm_in, spmatrix_t *spm_out) |
Check the correctness of a spm. | |
SPM subroutines to check factorization/solve | |
int | spmCheckAxb (double eps, spm_int_t nrhs, const spmatrix_t *spm, void *x0, spm_int_t ldx0, void *b, spm_int_t ldb, const void *x, spm_int_t ldx) |
Check the backward error, and the forward error if x0 is provided. | |
int | spmGenMat (spm_rhstype_t type, spm_int_t nrhs, const spmatrix_t *spm, void *alpha, unsigned long long int seed, void *A, spm_int_t lda) |
Generate a set of vectors associated to a given matrix. | |
int | spmGenVec (spm_rhstype_t type, const spmatrix_t *spm, void *alpha, unsigned long long int seed, void *x, spm_int_t incx) |
Generate a vector associated to a given matrix. | |
SParse Matrix package main routines.
Definition in file spm.c.
spm_int_t spm_create_loc2glob_continuous | ( | const spmatrix_t * | spm, |
spm_int_t ** | l2g_ptr | ||
) |
Generate a continuous loc2glob array on each node.
[in] | spm | The allocated spm with the correct gN field. |
[out] | l2g_ptr | Pointer to the loc2glob array that will be allocated and initialized. |
The | number of unknowns of the local spm. |
Definition at line 1841 of file spm.c.
References spmatrix_s::baseval, spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::gN, and spm_imin().
Referenced by spm_scatter_init(), and spmGather().
spm_int_t * spm_get_glob2loc | ( | const spmatrix_t * | spm | ) |
Computes the glob2loc array if needed, and returns it.
[in,out] | spm | The sparse matrix for which the glob2loc array must be computed. |
The | pointer to the glob2loc array of the spm. |
Definition at line 1885 of file spm.c.
References spmatrix_s::baseval, spmatrix_s::clustnbr, spmatrix_s::clustnum, spmatrix_s::comm, spmatrix_s::glob2loc, spmatrix_s::gN, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::replicated, and SPM_MPI_INT.
Referenced by spm_get_distribution(), and spm_getandset_glob2loc().
spm_int_t * spm_getandset_glob2loc | ( | spmatrix_t * | spm | ) |
Computes the glob2loc array if needed, and returns it.
[in,out] | spm | The sparse matrix for which the glob2loc array must be computed. |
The | pointer to the glob2loc array of the spm. |
Definition at line 2007 of file spm.c.
References spmatrix_s::glob2loc, spmatrix_s::gN, spmatrix_s::replicated, spm_get_glob2loc(), and spmUpdateComputedFields().
Referenced by c_spmSort(), d_spmSort(), p_spmSort(), s_spmSort(), spm_redist_get_newg2l(), spm_scatter_csx_get_locals(), spm_scatter_ijv_get_locals(), spm_symm_check_local_pattern(), and z_spmSort().
int spm_get_distribution | ( | const spmatrix_t * | spm | ) |
Search the distribution pattern used in the spm structure.
[in] | spm | The sparse matrix structure. |
Definition at line 2049 of file spm.c.
References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::comm, spmatrix_s::fmttype, spmatrix_s::glob2loc, spmatrix_s::gN, spmatrix_s::n, spmatrix_s::nnz, spmatrix_s::replicated, spmatrix_s::rowptr, spm_get_glob2loc(), SpmCSC, SpmCSR, SpmDistByColumn, and SpmDistByRow.
Referenced by c_spm_rhs_dist_genRnd_ijv(), c_spm_rhs_genI_ijv(), c_spmSort(), d_spm_rhs_dist_genRnd_ijv(), d_spm_rhs_genI_ijv(), d_spmSort(), p_spmSort(), s_spm_rhs_dist_genRnd_ijv(), s_spm_rhs_genI_ijv(), s_spmSort(), spm_cspmm(), spm_cspmv(), spm_dspmm(), spm_dspmv(), spm_sspmm(), spm_sspmv(), spm_zspmm(), spm_zspmv(), spmRedistribute(), z_spm_rhs_dist_genRnd_ijv(), z_spm_rhs_genI_ijv(), and z_spmSort().
int spmBlasGetNumThreads | ( | void | ) |
Return the current number of threads used for blas calls.
Definition at line 2280 of file spm.c.
Referenced by spmBlasSetNumThreads().
int spmBlasSetNumThreads | ( | int | nt | ) |
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) and return the previous number of blas threads.
[in] | nt | Number of threads. |
Definition at line 2308 of file spm.c.
References spmBlasGetNumThreads().
Referenced by spmBlasSetNumThreadsOne().
int spmBlasSetNumThreadsOne | ( | void | ) |
Set the number of threads for blas calls (BLIS, MKL, OpenBLAS) to 1 and return the previous number of blas threads.
Definition at line 2334 of file spm.c.
References spmBlasSetNumThreads().