diff --git a/src/gm.cpp.in b/src/gm.cpp.in index ad9396c24afbf8c8a7c0de6663430a68ec206f66..52afb0f128a09f83d36fab8021c7247926bf3cee 100644 --- a/src/gm.cpp.in +++ b/src/gm.cpp.in @@ -725,4 +725,27 @@ extern "C" { static_cast<cuMatArray<@GM_SCALAR@>*>(array)->mul(*value, id); } + + + /** gm_BSRMat_t **/ + __DYNLIB_ATTR__ gm_BSRMat_t gm_BSRMat_togpu_@GM_SCALAR@(int32_t nrows, int32_t ncols, int32_t bnrows, int32_t bncols, const @GM_SCALAR@* bdata, const int32_t* browptr, const int32_t* bcolids, int32_t bnnz) + { + return cuMatBSR<@GM_SCALAR@>::create(nrows, ncols, bnrows, bncols, bdata, browptr, bcolids, bnnz); + } + + __DYNLIB_ATTR__ void gm_BSRMat_tocpu_@GM_SCALAR@(gm_BSRMat_t cu_mat, int32_t *browptr, int32_t *bcolids, @GM_SCALAR@* bdata, int32_t *nrows, int32_t *ncols, int32_t *bnrows, int32_t *bncols, int32_t *bnnz) + { + bsr_tocpu(cu_mat, browptr, bcolids, bdata, nrows, ncols, bnrows, bncols, bnnz); + } + + __DYNLIB_ATTR__ gm_DenseMat_t gm_BSRMat_mul_gpu_dsm_ext_@GM_SCALAR@(gm_BSRMat_t a, gm_DenseMat_t b, gm_DenseMat_t out, gm_Op op_a, gm_Op op_b) + { + return static_cast<cuMatBSR<@GM_SCALAR@>*>(a)->mul(*(static_cast<cuMatDs<@GM_SCALAR@>*>(b)), static_cast<cuMatDs<@GM_SCALAR@>*>(out), op_a, op_b); + } + + __DYNLIB_ATTR__ void gm_BSRMat_info_@GM_SCALAR@(gm_BSRMat_t cu_mat, int32_t *nrows, int32_t *ncols, int32_t *bnrows, int32_t *bncols, int32_t *bnnz) + { + bsr_get_info<@GM_SCALAR@>(cu_mat, nrows, ncols, bnrows, bncols, bnnz); + } + } diff --git a/src/gm.h b/src/gm.h index 87ed02e88a03092e34e101101cece8793f255e7d..614ddb73c2f54df00ef5b0ea760dad14ad1ea8f0 100644 --- a/src/gm.h +++ b/src/gm.h @@ -5,6 +5,7 @@ #include "gm_interf.h" #include "cuMatDs.h" #include "cuMatArray.h" +#include "cuMatBSR.h" diff --git a/src/gm_interf_gen.h.in b/src/gm_interf_gen.h.in index bfdc80eddf0a9c69245f791d85239fd1b06df958..0ddfc8098b401ea77d0375d3d08dd817aefdc0c9 100644 --- a/src/gm_interf_gen.h.in +++ b/src/gm_interf_gen.h.in @@ -10,6 +10,16 @@ typedef uint32_t u_int32_t; #else #define __DYNLIB_ATTR__ #endif +typedef gm_BSRMat_t (*gm_BSRMat_togpu_@GM_SCALAR@_ptr)(int32_t nrows, int32_t ncols, int32_t bnrows, int32_t bncols, const @GM_SCALAR@* bdata, const int32_t* browptr, const int32_t* bcolids, int32_t bnnz); +typedef void (*gm_BSRMat_tocpu_@GM_SCALAR@_ptr)(gm_BSRMat_t cu_mat, int32_t *browptr, int32_t *bcolids, @GM_SCALAR@* bvalues, int32_t *nrows, int32_t *ncols, int32_t* bnrows, int32_t *bncols, int32_t *bnnz); +typedef void (*gm_BSRMat_info_@GM_SCALAR@_ptr)(gm_BSRMat_t, int32_t *nrows, int32_t *ncols, int32_t *bnrows, int32_t *bncols, int32_t *bnnz); + +struct gm_BSRMatFunc_@GM_SCALAR@ +{ + gm_BSRMat_togpu_@GM_SCALAR@_ptr togpu; + gm_BSRMat_tocpu_@GM_SCALAR@_ptr tocpu; + gm_BSRMat_info_@GM_SCALAR@_ptr info; +}; /** SparseMat function pointers *******************************************************************/ typedef gm_SparseMat_t (*gm_SparseMat_togpu_@GM_SCALAR@_ptr)(int32_t nrows, int32_t ncols, int32_t nnz, const int32_t* row_ptr, const int32_t* col_inds, const @GM_SCALAR@* values); diff --git a/src/gm_interf_types.h b/src/gm_interf_types.h index 6be05c3382ae7e47031c2612e6c6822073ef38bd..561ce661e3c32871c720a148a21ec8235bb3be4e 100644 --- a/src/gm_interf_types.h +++ b/src/gm_interf_types.h @@ -3,5 +3,6 @@ typedef void* gm_SparseMat_t; typedef void* gm_DenseMat_t; typedef void* gm_MatArray_t; +typedef void* gm_BSRMat_t; #include "gm_Op.h" #endif