public static class JCudaObject.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 JCudaObject.CSRPointer |
allocateEmpty(long nnz2,
long rows)
Factory method to allocate an empty CSR Sparse matrix on the GPU
|
static JCudaObject.CSRPointer |
allocateForDgeam(jcuda.jcusparse.cusparseHandle handle,
JCudaObject.CSRPointer A,
JCudaObject.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 JCudaObject.CSRPointer |
allocateForMatrixMultiply(jcuda.jcusparse.cusparseHandle handle,
JCudaObject.CSRPointer A,
int transA,
JCudaObject.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
JCudaObject.CSRPointer to C with the appropriate GPU memory. |
static void |
copyToDevice(JCudaObject.CSRPointer dest,
int rows,
long nnz,
int[] rowPtr,
int[] colInd,
double[] values)
Static method to copy a CSR sparse matrix from Host to Device
|
static void |
copyToHost(JCudaObject.CSRPointer src,
int rows,
long nnz,
int[] rowPtr,
int[] colInd,
double[] values)
Static method to copy a CSR sparse matrix from Device to host
|
void |
deallocate()
Calls cudaFree 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)
Copies this CSR matrix on the GPU to a dense column-major matrix
on the GPU.
|
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 jcuda.jcusparse.cusparseMatDescr getDefaultCuSparseMatrixDescriptor()
public boolean isUltraSparse(int rows, int cols)
rows
- number of rowscols
- number of columnspublic static long estimateSize(long nnz2, long rows)
nnz2
- number of non zeroesrows
- number of rowspublic static JCudaObject.CSRPointer allocateEmpty(long nnz2, long rows) throws DMLRuntimeException
nnz2
- number of non-zeroesrows
- number of rowsJCudaObject.CSRPointer
instance that encapsulates the CSR matrix on GPUDMLRuntimeException
- if DMLRuntimeException occurspublic static void copyToDevice(JCudaObject.CSRPointer dest, int rows, long nnz, int[] rowPtr, int[] colInd, double[] values)
dest
- [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 copyToHost(JCudaObject.CSRPointer src, int rows, long nnz, int[] rowPtr, int[] colInd, double[] values)
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 nnzvalues
- [output] pre-allocated double array of values of size nnzpublic static JCudaObject.CSRPointer allocateForDgeam(jcuda.jcusparse.cusparseHandle handle, JCudaObject.CSRPointer A, JCudaObject.CSRPointer B, int m, int n) throws DMLRuntimeException
handle
- a valid cusparseHandle
A
- Sparse Matrix A on GPUB
- Sparse Matrix B on GPUm
- Rows in An
- Columns in BsDMLRuntimeException
- if DMLRuntimeException occurspublic static JCudaObject.CSRPointer allocateForMatrixMultiply(jcuda.jcusparse.cusparseHandle handle, JCudaObject.CSRPointer A, int transA, JCudaObject.CSRPointer B, int transB, int m, int n, int k) throws DMLRuntimeException
JCudaObject.CSRPointer
to C with the appropriate GPU memory.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 BJCudaObject.CSRPointer
instance that encapsulates the CSR matrix on GPUDMLRuntimeException
- if DMLRuntimeException occurspublic jcuda.Pointer toColumnMajorDenseMatrix(jcuda.jcusparse.cusparseHandle cusparseHandle, jcuda.jcublas.cublasHandle cublasHandle, int rows, int cols) throws DMLRuntimeException
cusparseHandle
- a valid cusparseHandle
cublasHandle
- a valid cublasHandle
rows
- number of rows in this CSR matrixcols
- number of columns in this CSR matrixPointer
to the allocated dense matrix (in column-major format)DMLRuntimeException
- if DMLRuntimeException occurspublic void deallocate()
Pointer
instancesCopyright © 2017 The Apache Software Foundation. All rights reserved.