Mentions légales du service

Skip to content
Snippets Groups Projects
Commit e37ee8a8 authored by hhadjdji's avatar hhadjdji
Browse files

Add cuMatBSR to_gpu, to_cpu and, info functions to the C interface.

parent 38882cd5
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
}
......@@ -5,6 +5,7 @@
#include "gm_interf.h"
#include "cuMatDs.h"
#include "cuMatArray.h"
#include "cuMatBSR.h"
......
......@@ -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);
......
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment