SpM Handbook 1.2.4
Loading...
Searching...
No Matches
s_spm_genmat.c File Reference
#include "common.h"
#include <cblas.h>
#include <lapacke.h>

Go to the source code of this file.

Functions

static unsigned long long int Rnd64_jump (unsigned long long int n, unsigned long long int seed)
 Random generator from the HPL library.
 
static void s_updateRndVal (float scale, float *val, unsigned long long int *ran)
 Generate a value of the RHS.
 
int s_spmRhsGenRndShm (const spmatrix_t *spm, float scale, spm_int_t n, float *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in shared memory.
 
static int s_spm_rhs_dist_genRnd_csx (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory for CSX format.
 
static int s_spm_rhs_dist_genRnd_ijv (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory for IJV format.
 
int s_spmRhsGenRndDist (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda, int shift, unsigned long long int seed)
 Generate a set of vectors of random values in distributed memory.
 
static int s_spmRhsGenOne (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda)
 Generate a set of vectors of constant values.
 
static int s_spm_rhs_genI_csx (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for CSC format.
 
static int s_spm_rhs_genI_ijv (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for IJV format.
 
static int s_spmRhsGenI (const spmatrix_t *spm, float alpha, spm_int_t n, float *A, spm_int_t lda)
 Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ).
 
int s_spmGenMat (spm_rhstype_t type, int nrhs, const spmatrix_t *spm, void *alphaptr, unsigned long long int seed, void *A, int lda)
 Generate nrhs right hand side vectors associated to a given matrix to test a problem with a solver.
 

Detailed Description

SParse Matrix package matrix generators.

Version
1.2.4
Author
Mathieu Faverge
Tony Delarue
Alycia Lisito
Date
2024-06-25
Generated arithmetic file from /builds/2mk6rsew/0/fpruvost/spm/src/z_spm_genmat.c, normal z -> s, Fri Nov 29 11:34:30 2024

Definition in file s_spm_genmat.c.

Function Documentation

◆ Rnd64_jump()

static unsigned long long int Rnd64_jump ( unsigned long long int  n,
unsigned long long int  seed 
)
static

Random generator from the HPL library.

Parameters
[in]nNumber of elements to jump over in the generator cycle.
[in]seed
Return values
arandom integer value

Definition at line 49 of file s_spm_genmat.c.

Referenced by s_spm_rhs_dist_genRnd_csx(), s_spm_rhs_dist_genRnd_ijv(), and s_spmRhsGenRndShm().

◆ s_spm_rhs_dist_genRnd_csx()

static int s_spm_rhs_dist_genRnd_csx ( const spmatrix_t spm,
float  alpha,
spm_int_t  n,
float *  A,
spm_int_t  lda,
int  shift,
unsigned long long int  seed 
)
static

Generate a set of vectors of random values in distributed memory for CSX format.

Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
[in]shiftThe initial shift in the random sequence.
[in]seedThe seed used for random generation. Must be the same for all tiles initialized with this routine.
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 215 of file s_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::gNexp, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::replicated, Rnd64_jump(), s_updateRndVal(), and SPM_SUCCESS.

Referenced by s_spmRhsGenRndDist().

◆ s_spm_rhs_dist_genRnd_ijv()

static int s_spm_rhs_dist_genRnd_ijv ( const spmatrix_t spm,
float  alpha,
spm_int_t  n,
float *  A,
spm_int_t  lda,
int  shift,
unsigned long long int  seed 
)
static

Generate a set of vectors of random values in distributed memory for IJV format.

Warning
The matrix has to be sorted by column or by row.
Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
[in]shiftThe initial shift in the random sequence.
[in]seedThe seed used for random generation. Must be the same for all tiles initialized with this routine.
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 303 of file s_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::gNexp, spmatrix_s::nnz, Rnd64_jump(), spmatrix_s::rowptr, s_updateRndVal(), SPM_ERR_BADPARAMETER, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, and SpmDistByRow.

Referenced by s_spmRhsGenRndDist().

◆ s_spm_rhs_genI_csx()

static int s_spm_rhs_genI_csx ( const spmatrix_t spm,
float  alpha,
spm_int_t  n,
float *  A,
spm_int_t  lda 
)
static

Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for CSC format.

Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

Definition at line 529 of file s_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::loc2glob, spmatrix_s::n, spmatrix_s::nexp, spmatrix_s::replicated, and SPM_SUCCESS.

Referenced by s_spmRhsGenI().

◆ s_spm_rhs_genI_ijv()

static int s_spm_rhs_genI_ijv ( const spmatrix_t spm,
float  alpha,
spm_int_t  n,
float *  A,
spm_int_t  lda 
)
static

Generate a set of vectors x[i] = alpha * ( i [+ i* I ] ) for IJV format.

Warning
The matrix has to be sorted by column or by row.
Parameters
[in]spmThe sparse matrix associated to the right hand side.
[in]alphaScaling factor for each value of the vector.
[in]nThe number of columns in A. n >= 0.
[in,out]AOn entry, the lda-by-n matrix to be initialized. On exit, the matrix initialized.
[in]ldaThe leading dimension of the matrix A. lda >= max(1,spm->nexp).
Return values
SPM_SUCCESSon success
SPM_ERR_BADPARAMETERif the provided spm is incorrect

If the spm is global, we have to know which vertice is sorted

Definition at line 607 of file s_spm_genmat.c.

References spmatrix_s::baseval, spmatrix_s::colptr, spmatrix_s::dof, spmatrix_s::dofs, spmatrix_s::nexp, spmatrix_s::nnz, spmatrix_s::rowptr, SPM_ERR_BADPARAMETER, spm_get_distribution(), SPM_SUCCESS, SpmDistByColumn, and SpmDistByRow.

Referenced by s_spmRhsGenI().