public class CSRPointer extends Object
Modifier and Type | Field and Description |
---|---|
jcuda.Pointer |
colInd
integer array of nnz values' column indices
|
jcuda.jcusparse.cusparseMatDescr |
descr
descriptor of matrix, only CUSPARSE_MATRIX_TYPE_GENERAL supported
|
static jcuda.jcusparse.cusparseMatDescr |
matrixDescriptor |
long |
nnz
Number of non zeroes
|
jcuda.Pointer |
rowPtr
integer array of start of all rows and end of last row + 1
|
jcuda.Pointer |
val
double array of non zero values
|
Modifier and Type | Method and Description |
---|---|
static CSRPointer |
allocateEmpty(GPUContext gCtx,
long nnz2,
long rows)
Factory method to allocate an empty CSR Sparse matrix on the GPU
|
static CSRPointer |
allocateForDgeam(GPUContext gCtx,
jcuda.jcusparse.cusparseHandle handle,
CSRPointer A,
CSRPointer B,
int m,
int n)
Estimates the number of non zero elements from the results of a sparse cusparseDgeam operation
C = a op(A) + b op(B)
|
static CSRPointer |
allocateForMatrixMultiply(GPUContext gCtx,
jcuda.jcusparse.cusparseHandle handle,
CSRPointer A,
int transA,
CSRPointer B,
int transB,
int m,
int n,
int k)
Estimates the number of non-zero elements from the result of a sparse matrix multiplication C = A * B
and returns the
CSRPointer to C with the appropriate GPU memory. |
CSRPointer |
clone(int rows) |
static void |
copyPtrToHost(CSRPointer src,
int rows,
long nnz,
int[] rowPtr,
int[] colInd)
Static method to copy a CSR sparse matrix from Device to host
|
static void |
copyToDevice(GPUContext gCtx,
CSRPointer dest,
int rows,
long nnz,
int[] rowPtr,
int[] colInd,
double[] values)
Static method to copy a CSR sparse matrix from Host to Device
|
void |
deallocate()
Calls cudaFree lazily on the allocated
Pointer instances |
void |
deallocate(boolean eager)
Calls cudaFree lazily or eagerly on the allocated
Pointer instances |
static long |
estimateSize(long nnz2,
long rows)
Estimate the size of a CSR matrix in GPU memory
Size of pointers is not needed and is not added in
|
static jcuda.jcusparse.cusparseMatDescr |
getDefaultCuSparseMatrixDescriptor() |
boolean |
isUltraSparse(int rows,
int cols)
Check for ultra sparsity
|
jcuda.Pointer |
toColumnMajorDenseMatrix(jcuda.jcusparse.cusparseHandle cusparseHandle,
jcuda.jcublas.cublasHandle cublasHandle,
int rows,
int cols,
String instName)
Copies this CSR matrix on the GPU to a dense column-major matrix
on the GPU.
|
static int |
toIntExact(long l) |
String |
toString() |
public static jcuda.jcusparse.cusparseMatDescr matrixDescriptor
public long nnz
public jcuda.Pointer val
public jcuda.Pointer rowPtr
public jcuda.Pointer colInd
public jcuda.jcusparse.cusparseMatDescr descr
public static int toIntExact(long l)
public static jcuda.jcusparse.cusparseMatDescr getDefaultCuSparseMatrixDescriptor()
public static long estimateSize(long nnz2, long rows)
nnz2
- number of non zeroesrows
- number of rowspublic static void copyToDevice(GPUContext gCtx, CSRPointer dest, int rows, long nnz, int[] rowPtr, int[] colInd, double[] values)
gCtx
- GPUContextdest
- [input] destination location (on GPU)rows
- number of rowsnnz
- number of non-zeroesrowPtr
- integer array of row pointerscolInd
- integer array of column indicesvalues
- double array of non zero valuespublic static void copyPtrToHost(CSRPointer src, int rows, long nnz, int[] rowPtr, int[] colInd)
src
- [input] source location (on GPU)rows
- [input] number of rowsnnz
- [input] number of non-zeroesrowPtr
- [output] pre-allocated integer array of row pointers of size (rows+1)colInd
- [output] pre-allocated integer array of column indices of size nnzpublic static CSRPointer allocateForDgeam(GPUContext gCtx, jcuda.jcusparse.cusparseHandle handle, CSRPointer A, CSRPointer B, int m, int n)
gCtx
- a valid GPUContext
handle
- a valid cusparseHandle
A
- Sparse Matrix A on GPUB
- Sparse Matrix B on GPUm
- Rows in An
- Columns in Bspublic static CSRPointer allocateForMatrixMultiply(GPUContext gCtx, jcuda.jcusparse.cusparseHandle handle, CSRPointer A, int transA, CSRPointer B, int transB, int m, int n, int k)
CSRPointer
to C with the appropriate GPU memory.gCtx
- a valid GPUContext
handle
- a valid cusparseHandle
A
- Sparse Matrix A on GPUtransA
- 'T' if A is to be transposed, 'N' otherwiseB
- Sparse Matrix B on GPUtransB
- 'T' if B is to be transposed, 'N' otherwisem
- Rows in An
- Columns in Bk
- Columns in A / Rows in BCSRPointer
instance that encapsulates the CSR matrix on GPUpublic static CSRPointer allocateEmpty(GPUContext gCtx, long nnz2, long rows)
gCtx
- a valid GPUContext
nnz2
- number of non-zeroesrows
- number of rowsCSRPointer
instance that encapsulates the CSR matrix on GPUpublic CSRPointer clone(int rows)
public boolean isUltraSparse(int rows, int cols)
rows
- number of rowscols
- number of columnspublic jcuda.Pointer toColumnMajorDenseMatrix(jcuda.jcusparse.cusparseHandle cusparseHandle, jcuda.jcublas.cublasHandle cublasHandle, int rows, int cols, String instName)
cusparseHandle
- a valid cusparseHandle
cublasHandle
- a valid cublasHandle
rows
- number of rows in this CSR matrixcols
- number of columns in this CSR matrixinstName
- name of the invoking instruction to recordStatistics
.Pointer
to the allocated dense matrix (in column-major format)public void deallocate()
Pointer
instancespublic void deallocate(boolean eager)
Pointer
instanceseager
- whether to do eager or lazy cudaFreesCopyright © 2018 The Apache Software Foundation. All rights reserved.