Functions list
Details
SpMM
sparse matrix dense matrix multiplication
\[out = S \cdot D^T\]In the above equation, S is a sparse matrix while D is a dense matrix. The outcome is an (m,k) shaped matrix. We provide SpMM in CSR format with two calculation methods, with and without value respectively.
With Value
void spmm_cuda(
int m, //m for S's rows
int k, //k for D's rows
int *rowptr, //row pointer in CSR format
int *colind, //col indices of graph
float *values, //weights of graph
float *dense, //dense matrix
float *out);
Without Value
void spmm_cuda_no_edge_value(
int m,
int k,
int *rowptr,
int *colind,
float *dense,
float *out);
SDDMM
Sampled dense dense matrix multiplication
\[out = (D_1 \cdot D_2)\odot S\]In the above equation, \(\odot\) is a hadamard product. The sparse matrix is performed as a mask for computing dense matrix multiplication.
\[out[i][j]=(\Sigma_{k} D_1[i][k]\cdot D_2[j][k])\cdot S[i][j]\]We provide SDDMM in both coo and csr format. Note that D2 is a transposed matrix.
COO
void sddmm_cuda_coo(
int k, //cols for D1
int nnz, //non zeros number for graph
int *rowind, //row indices of graph
int *colind, //col indices of graph
float *D1, //left hand Dense matrix
float *D2, //right hand Dense matrix
float *out);
CSR
void sddmm_cuda_csr(
int m, //m for S's rows
int k, //k for D1's rows
int nnz, //non zeros number for graph
int *rowptr, //row pointer in CSR format
int *colind, //col indices of graph
float *D1, //left hand Dense matrix
float *D2, //right hand Dense matrix
float *out);
edgesoftmax
This is a edgesoftmax forward computation. Here we further support stacked sparse value with the same pattern by using ‘head’ parameter.
\[softmax_{ij}=\frac{exp(value_{ij})}{\Sigma_{j\in N(i)}exp(value_{ij})}\]\(N(i)\) is the set of nodes that have an edge to i. \(value_{ij}\) means the value of edge point from node i to node j.
void edge_softmax_cuda(
int m, //m for S's rows
int head, //stack parameter
int *rowptr,
float *value,
float *softmax);