petsc-3.7.1 2016-05-15
Report Typos and Errors

MatCreateSeqAIJCUSPARSE

Creates a sparse matrix in AIJ (compressed row) format (the default parallel PETSc format). This matrix will ultimately pushed down to NVidia GPUs and use the CUSPARSE library for calculations. For good matrix assembly performance the user should preallocate the matrix storage by setting the parameter nz (or the array nnz). By setting these parameters accurately, performance during matrix assembly can be increased by more than a factor of 50.

Synopsis

#include "petscmat.h" 
PetscErrorCode  MatCreateSeqAIJCUSPARSE(MPI_Comm comm,PetscInt m,PetscInt n,PetscInt nz,const PetscInt nnz[],Mat *A)
Collective on MPI_Comm Many br

Input Parameters

comm - MPI communicator, set to PETSC_COMM_SELF Many br
m - number of rows Many br
n - number of columns Many br
nz - number of nonzeros per row (same for all rows) Many br
nnz - array containing the number of nonzeros in the various rows Many br(possibly different for each row) or NULL Many br

Output Parameter

A -the matrix Many br

It is recommended that one use the MatCreate(), MatSetType() and/or MatSetFromOptions(), Many brMatXXXXSetPreallocation() paradgm instead of this routine directly. Many br[MatXXXXSetPreallocation() is, for example, MatSeqAIJSetPreallocation] Many br

Notes

If nnz is given then nz is ignored Many br

The AIJ format (also called the Yale sparse matrix format or Many brcompressed row storage), is fully compatible with standard Fortran 77 Many brstorage. That is, the stored row and column indices can begin at Many breither one (as in Fortran) or zero. See the users' manual for details. Many br

Specify the preallocated storage with either nz or nnz (not both). Many brSet nz=PETSC_DEFAULT and nnz=NULL for PETSc to control dynamic memory Many brallocation. For large problems you MUST preallocate memory or you Many brwill get TERRIBLE performance, see the users' manual chapter on matrices. Many br

By default, this format uses inodes (identical nodes) when possible, to Many brimprove numerical efficiency of matrix-vector products and solves. We Many brsearch for consecutive rows with the same nonzero structure, thereby Many brreusing matrix information to achieve increased efficiency. Many br

Many br

See Also

MatCreate(), MatCreateAIJ(), MatSetValues(), MatSeqAIJSetColumnIndices(), MatCreateSeqAIJWithArrays(), MatCreateAIJ(), MATSEQAIJCUSPARSE, MATAIJCUSPARSE

Level:intermediate
Location:
src/mat/impls/aij/seq/seqcusparse/aijcusparse.cu
Index of all Mat routines
Table of Contents for all manual pages
Index of all manual pages