![]() |
MAGMA
1.5.0
Matrix Algebra for GPU and Multicore Architectures
|
Functions | |
magma_int_t | magma_zjacobisetup_matrix (magma_z_sparse_matrix A, magma_z_vector b, magma_z_sparse_matrix *M, magma_z_vector *d) |
Prepares the Matrix M for the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k. More... | |
magma_int_t | magma_zjacobisetup_diagscal (magma_z_sparse_matrix A, magma_z_vector *d) |
It returns a vector d containing the inverse diagonal elements. More... | |
magma_int_t | magma_zjacobisetup_vector (magma_z_vector b, magma_z_vector d, magma_z_vector *c) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k. More... | |
magma_int_t | magma_zjacobisetup (magma_z_sparse_matrix A, magma_z_vector b, magma_z_sparse_matrix *M, magma_z_vector *c) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k. More... | |
magma_int_t | magma_zjacobiiter (magma_z_sparse_matrix M, magma_z_vector c, magma_z_vector *x, magma_z_solver_par *solver_par) |
Iterates the solution approximation according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k. More... | |
magma_int_t | magma_zfrobenius (magma_z_sparse_matrix A, magma_z_sparse_matrix B, real_Double_t *res) |
Computes the Frobenius norm of the difference between the CSR matrices A and B. More... | |
magma_int_t | magma_zinitguess (magma_z_sparse_matrix A, magma_z_sparse_matrix *L, magma_z_sparse_matrix *U) |
Computes an initial guess for the iterative ILU/IC. More... | |
magma_int_t | magma_z_mpkinfo_one (magma_z_sparse_matrix A, magma_int_t offset, magma_int_t blocksize, magma_int_t s, magma_index_t **num_add_rows, magma_index_t **add_rows, magma_int_t *num_add_vecs, magma_index_t **add_vecs) |
Provides for a matrix A, a blocksize, an offset, and a number of matrix powers s, the number of additional rows that are needed by this processor for the matrix power kernel. More... | |
magma_int_t | magma_z_mpkback (magma_z_sparse_matrix A, magma_int_t num_procs, magma_int_t *offset, magma_int_t *blocksize, magma_int_t s, magma_int_t *num_addvecs, magma_index_t **add_vecs, magma_int_t *num_vecs_back, magma_index_t **vecs_back) |
Extension of magma_z_mpkinfo. More... | |
magma_int_t | magma_zmhom_fd (magma_z_sparse_matrix A, magma_int_t n, magma_int_t b, magma_index_t *p) |
– MAGMA (version 1.5.0-beta3) – Univ. More... | |
magma_int_t | magma_zmreorder (magma_z_sparse_matrix A, magma_int_t n, magma_int_t b, magma_z_sparse_matrix *B) |
– MAGMA (version 1.5.0-beta3) – Univ. More... | |
magma_int_t | magma_sparse_matrix_dlag2s (magma_d_sparse_matrix A, magma_s_sparse_matrix *B) |
convertes magma_d_sparse_matrix from Z to C More... | |
magma_int_t | magma_z_spmv (magmaDoubleComplex alpha, magma_z_sparse_matrix A, magma_z_vector x, magmaDoubleComplex beta, magma_z_vector y) |
For a given input matrix A and vectors x, y and scalars alpha, beta the wrapper determines the suitable SpMV computing y = alpha * A * x + beta * y. More... | |
int | magma_z_mpk_uncompress_gpu (magma_int_t num_add_rows, magma_index_t *add_rows, magmaDoubleComplex *x, magmaDoubleComplex *y) |
Unpacks a compressed vector x and a key add_rows on the GPU. More... | |
int | magma_z_mpk_uncompspmv (magma_int_t offset, magma_int_t blocksize, magma_int_t num_add_rows, magma_index_t *add_rows, magmaDoubleComplex *x, magmaDoubleComplex *y) |
Distributes a compressed vector x after the SpMV using offset, blocksize and key. More... | |
magma_int_t | magma_sparse_matrix_zlag2c (magma_z_sparse_matrix A, magma_c_sparse_matrix *B) |
convertes magma_z_sparse_matrix from Z to C More... | |
void | magma_zcompactActive (magma_int_t m, magma_int_t n, magmaDoubleComplex *dA, magma_int_t ldda, magma_index_t *active) |
ZCOMPACTACTIVE takes a set of n vectors of size m (in dA) and an array of 1s and 0sindicating which vectors to compact (for 1s) and which to disregard (for 0s). More... | |
magma_int_t | magma_zgeelltmv (magma_trans_t transA, magma_int_t m, magma_int_t n, magma_int_t nnz_per_row, magmaDoubleComplex alpha, magmaDoubleComplex *d_val, magma_index_t *d_colind, magmaDoubleComplex *d_x, magmaDoubleComplex beta, magmaDoubleComplex *d_y) |
This routine computes y = alpha * A^t * x + beta * y on the GPU. More... | |
magma_int_t | magma_zjacobi_diagscal (int num_rows, magmaDoubleComplex *b, magmaDoubleComplex *d, magmaDoubleComplex *c) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k. More... | |
magma_int_t | magma_zgemvmdot (int n, int k, magmaDoubleComplex *v, magmaDoubleComplex *r, magmaDoubleComplex *d1, magmaDoubleComplex *d2, magmaDoubleComplex *skp) |
This is an extension of the merged dot product above by chunking the set of vectors v_i such that the data always fits into cache. More... | |
magma_int_t magma_sparse_matrix_dlag2s | ( | magma_d_sparse_matrix | A, |
magma_s_sparse_matrix * | B | ||
) |
convertes magma_d_sparse_matrix from Z to C
A | magma_d_sparse_matrix input matrix descriptor |
B | magma_s_sparse_matrix* output matrix descriptor |
magma_int_t magma_sparse_matrix_zlag2c | ( | magma_z_sparse_matrix | A, |
magma_c_sparse_matrix * | B | ||
) |
convertes magma_z_sparse_matrix from Z to C
A | magma_z_sparse_matrix input matrix descriptor |
B | magma_c_sparse_matrix* output matrix descriptor |
int magma_z_mpk_uncompress_gpu | ( | magma_int_t | num_add_rows, |
magma_index_t * | add_rows, | ||
magmaDoubleComplex * | x, | ||
magmaDoubleComplex * | y | ||
) |
Unpacks a compressed vector x and a key add_rows on the GPU.
num_add_rowsmagma_int_t | number of elements to unpack |
add_rows | magma_index_t* indices of elements to unpack |
x | magmaDoubleComplex* compressed input vector |
y | magmaDoubleComplex* uncompressed output vector |
int magma_z_mpk_uncompspmv | ( | magma_int_t | offset, |
magma_int_t | blocksize, | ||
magma_int_t | num_add_rows, | ||
magma_index_t * | add_rows, | ||
magmaDoubleComplex * | x, | ||
magmaDoubleComplex * | y | ||
) |
Distributes a compressed vector x after the SpMV using offset, blocksize and key.
offset | magma_int_t offset from 0 |
blocksize | magma_int_t number of elements handled by GPU |
num_add_rowsmagma_int_t | number of elements to pack |
add_rows | magma_index_t* indices of elements to pack |
x | magmaDoubleComplex* compressed input vector |
y | magmaDoubleComplex* uncompressed output vector |
magma_int_t magma_z_mpkback | ( | magma_z_sparse_matrix | A, |
magma_int_t | num_procs, | ||
magma_int_t * | offset, | ||
magma_int_t * | blocksize, | ||
magma_int_t | s, | ||
magma_int_t * | num_addvecs, | ||
magma_index_t ** | add_vecs, | ||
magma_int_t * | num_vecs_back, | ||
magma_index_t ** | vecs_back | ||
) |
Extension of magma_z_mpkinfo.
The idea is to have an array containing for all GPU sets which data is needed. Furthermore, it provides for a matrix A, a number of processors num_procs, and a distribution *offset, *blocksize and s the number of rows added to the different matrices.
num_add_vecs = [ GPU0 from Host, GPU1 from GPU0, GPU2 from GPU0 . GPU0 from GPU1, GPU1 from Host, GPU2 from GPU0 . ... ]
add_vecs has the same structure, but instead of the number, the component indices are provided.
magma_sparse_matrix A input matrix A
num_procs | magma_int_t number of processors |
offset | magma_int_t* array containing the offsets |
blocksize | magma_int_t* array containing the chunk sizes |
s | magma_int_t matrix powers |
num_addvecs | magma_int_t* output array: number of additional rows |
num_addvecs | magma_int_t* output array: number of additional rows |
num_addvec | smagma_int_t* number of additional vector entries |
add_vecs | magma_int_t* array for additional vector entries |
magma_int_t magma_z_mpkinfo_one | ( | magma_z_sparse_matrix | A, |
magma_int_t | offset, | ||
magma_int_t | blocksize, | ||
magma_int_t | s, | ||
magma_index_t ** | num_add_rows, | ||
magma_index_t ** | add_rows, | ||
magma_int_t * | num_add_vecs, | ||
magma_index_t ** | add_vecs | ||
) |
Provides for a matrix A, a blocksize, an offset, and a number of matrix powers s, the number of additional rows that are needed by this processor for the matrix power kernel.
magma_sparse_matrix A input matrix A
offset | magma_int_t first row to compute |
blocksize | magma_int_t number of rows to compute |
s | magma_int_t matrix powers |
num_add_rowsmagma_int_t** | number of additional rows for each s |
add_rows | magma_int_t* array for additional rows ordered according to s |
num_add_vecsmagma_int_t* | number of additional vector entries |
add_vecs | magma_int_t* array for additional vector entries |
magma_int_t magma_z_spmv | ( | magmaDoubleComplex | alpha, |
magma_z_sparse_matrix | A, | ||
magma_z_vector | x, | ||
magmaDoubleComplex | beta, | ||
magma_z_vector | y | ||
) |
For a given input matrix A and vectors x, y and scalars alpha, beta the wrapper determines the suitable SpMV computing y = alpha * A * x + beta * y.
alpha | magmaDoubleComplex scalar alpha |
A | magma_z_sparse_matrix sparse matrix A |
x | magma_z_vector input vector x |
beta | magmaDoubleComplex scalar beta |
y | magma_z_vector output vector y |
void magma_zcompactActive | ( | magma_int_t | m, |
magma_int_t | n, | ||
magmaDoubleComplex * | dA, | ||
magma_int_t | ldda, | ||
magma_index_t * | active | ||
) |
ZCOMPACTACTIVE takes a set of n vectors of size m (in dA) and an array of 1s and 0sindicating which vectors to compact (for 1s) and which to disregard (for 0s).
[in] | m | INTEGER The number of rows of the matrix dA. M >= 0. |
[in] | n | INTEGER The number of columns of the matrix dA. N >= 0. |
[in,out] | dA | COMPLEX DOUBLE PRECISION array, dimension (LDDA,N) The m by n matrix dA. |
[in] | ldda | INTEGER The leading dimension of the array dA. LDDA >= max(1,M). |
[in] | active | INTEGER array, dimension N A mask of 1s and 0s showing if a vector remains or has been removed |
magma_int_t magma_zfrobenius | ( | magma_z_sparse_matrix | A, |
magma_z_sparse_matrix | B, | ||
real_Double_t * | res | ||
) |
Computes the Frobenius norm of the difference between the CSR matrices A and B.
They need to share the same sparsity pattern!
A | magma_z_sparse_matrix sparse matrix in CSR |
B | magma_z_sparse_matrix sparse matrix in CSR |
res | real_Double_t* residual |
magma_int_t magma_zgeelltmv | ( | magma_trans_t | transA, |
magma_int_t | m, | ||
magma_int_t | n, | ||
magma_int_t | nnz_per_row, | ||
magmaDoubleComplex | alpha, | ||
magmaDoubleComplex * | d_val, | ||
magma_index_t * | d_colind, | ||
magmaDoubleComplex * | d_x, | ||
magmaDoubleComplex | beta, | ||
magmaDoubleComplex * | d_y | ||
) |
This routine computes y = alpha * A^t * x + beta * y on the GPU.
Input format is ELL.
transA | magma_trans_t transposition parameter for A |
m | magma_int_t number of rows in A |
n | magma_int_t number of columns in A |
nnz_per_row | magma_int_t number of elements in the longest row |
alpha | magmaDoubleComplex scalar multiplier |
d_val | magmaDoubleComplex* array containing values of A in ELL |
d_colind | magma_int_t* columnindices of A in ELL |
d_x | magmaDoubleComplex* input vector x |
beta | magmaDoubleComplex scalar multiplier |
d_y | magmaDoubleComplex* input/output vector y |
magma_int_t magma_zgemvmdot | ( | int | n, |
int | k, | ||
magmaDoubleComplex * | v, | ||
magmaDoubleComplex * | r, | ||
magmaDoubleComplex * | d1, | ||
magmaDoubleComplex * | d2, | ||
magmaDoubleComplex * | skp | ||
) |
This is an extension of the merged dot product above by chunking the set of vectors v_i such that the data always fits into cache.
It is equivalent to a matrix vecor product Vr where V contains few rows and many columns. The computation is the same:
skp = ( <v_0,r>, <v_1,r>, .. )
Returns the vector skp.
n | int length of v_i and r |
k | int vectors v_i |
v | magmaDoubleComplex* v = (v_0 .. v_i.. v_k) |
r | magmaDoubleComplex* r |
d1 | magmaDoubleComplex* workspace |
d2 | magmaDoubleComplex* workspace |
skp | magmaDoubleComplex* vector[k] of scalar products (<v_i,r>...) |
magma_int_t magma_zinitguess | ( | magma_z_sparse_matrix | A, |
magma_z_sparse_matrix * | L, | ||
magma_z_sparse_matrix * | U | ||
) |
Computes an initial guess for the iterative ILU/IC.
A | magma_z_sparse_matrix sparse matrix in CSR |
B | magma_z_sparse_matrix* sparse matrix in CSR |
magma_int_t magma_zjacobi_diagscal | ( | int | num_rows, |
magmaDoubleComplex * | b, | ||
magmaDoubleComplex * | d, | ||
magmaDoubleComplex * | c | ||
) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k.
Returns the vector c. It calls a GPU kernel
num_rows | magma_int_t number of rows |
b | magma_z_vector RHS b |
d | magma_z_vector vector with diagonal entries |
c | magma_z_vector* c = D^(-1) * b |
magma_int_t magma_zjacobiiter | ( | magma_z_sparse_matrix | M, |
magma_z_vector | c, | ||
magma_z_vector * | x, | ||
magma_z_solver_par * | solver_par | ||
) |
Iterates the solution approximation according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k.
m | magma_z_sparse_matrix input matrix M = D^(-1) * (L+U) |
c | magma_z_vector c = D^(-1) * b |
x | magma_z_vector* iteration vector x |
solver_par | magma_z_solver_par* solver parameters |
magma_int_t magma_zjacobisetup | ( | magma_z_sparse_matrix | A, |
magma_z_vector | b, | ||
magma_z_sparse_matrix * | M, | ||
magma_z_vector * | c | ||
) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k.
A | magma_z_sparse_matrix input matrix A |
b | magma_z_vector RHS b |
m | magma_z_sparse_matrix* M = D^(-1) * (L+U) |
c | magma_z_vector* c = D^(-1) * b |
magma_int_t magma_zjacobisetup_diagscal | ( | magma_z_sparse_matrix | A, |
magma_z_vector * | d | ||
) |
It returns a vector d containing the inverse diagonal elements.
A | magma_z_sparse_matrix input matrix A |
d | magma_z_vector* vector with diagonal elements |
magma_int_t magma_zjacobisetup_matrix | ( | magma_z_sparse_matrix | A, |
magma_z_vector | b, | ||
magma_z_sparse_matrix * | M, | ||
magma_z_vector * | d | ||
) |
Prepares the Matrix M for the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k.
It returns the preconditioner Matrix M and a vector d containing the diagonal elements.
A | magma_z_sparse_matrix input matrix A |
b | magma_z_vector RHS b |
m | magma_z_sparse_matrix* M = D^(-1) * (L+U) |
d | magma_z_vector* vector with diagonal elements |
magma_int_t magma_zjacobisetup_vector | ( | magma_z_vector | b, |
magma_z_vector | d, | ||
magma_z_vector * | c | ||
) |
Prepares the Jacobi Iteration according to x^(k+1) = D^(-1) * b - D^(-1) * (L+U) * x^k x^(k+1) = c - M * x^k.
Returns the vector c
b | magma_z_vector RHS b |
d | magma_z_vector vector with diagonal entries |
c | magma_z_vector* c = D^(-1) * b |
magma_int_t magma_zmhom_fd | ( | magma_z_sparse_matrix | A, |
magma_int_t | n, | ||
magma_int_t | b, | ||
magma_index_t * | p | ||
) |
– MAGMA (version 1.5.0-beta3) – Univ.
of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver November 2011
Takes a matrix and a blocksize b to generate a homomorphism that orders the matrix entries according to the subdomains of size b x b. Returns p on the device
example:
/ a 0 0 b 0 \ | 0 c 0 d 0 |
A= | 0 e f g 0 | b = 2 | h 0 0 0 0 | \ i j 0 0 0 /
will generate the projection:
0 2 1 3 4 7 8 9 10 11
according to
a c b d e h f g i j
A | magma_z_sparse_matrix input/output matrix |
b | magma_int_t blocksize |
p | magma_index_t* homomorphism vector containing the indices |
magma_int_t magma_zmreorder | ( | magma_z_sparse_matrix | A, |
magma_int_t | n, | ||
magma_int_t | b, | ||
magma_z_sparse_matrix * | B | ||
) |
– MAGMA (version 1.5.0-beta3) – Univ.
of Tennessee, Knoxville Univ. of California, Berkeley Univ. of Colorado, Denver November 2011
Takes a matrix and a reordering scheme such that the output mat
example:
/ a 0 0 b 0 \ | 0 c 0 d 0 |
A= | 0 e f g 0 | b = 2 | h 0 0 0 0 | \ i j 0 0 0 /
will generate the projection:
0 2 1 3 4 7 8 9 10 11
according to
a c b d e h f g i j
A | magma_z_sparse_matrix input/output matrix |
n | magma_int_t nodes in one dimension |
b | magma_int_t blocksize |
B | magma_z_sparse_matrix* new matrix filled with new indices |