Mentions légales du service

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

Add cuMatBSR::get_bnrows, get_bncols and get_bnnz and the C lib interface for them.

parent b5966c74
Branches
Tags
No related merge requests found
......@@ -26,6 +26,9 @@ struct cuMatBSR : cuMat<T>
void mul(const T& scalar);
Real<T> norm_frob() const;
size_t get_nbytes() const;
size_t get_bnrows() const;
size_t get_bncols() const;
size_t get_bnnz() const;
void destroy();
static void init_desc(cusparseMatDescr_t& desc);
void set_zeros();
......
......@@ -13,6 +13,27 @@ size_t cuMatBSR<T>::get_nbytes() const
return bnrows*bncols*bnnz*sizeof(T) /* data byte size */ + sizeof(int32_t) * (bnnz + nblocks_per_row_dim+1) /* indices byte size */;
}
template<typename T>
size_t cuMatBSR<T>::get_bnrows() const
{
return bnrows;
}
template<typename T>
size_t cuMatBSR<T>::get_bncols() const
{
return bncols;
}
template<typename T>
size_t cuMatBSR<T>::get_bnnz() const
{
return bnnz;
}
template<typename T>
void cuMatBSR<T>::transpose()
{
......
......@@ -808,6 +808,21 @@ extern "C"
return static_cast<cuMatBSR<@GM_SCALAR@>*>(cu_mat)->get_nbytes();
}
__DYNLIB_ATTR__ int32_t gm_BSRMat_get_bnrows_@GM_SCALAR@(gm_BSRMat_t cu_mat)
{
return static_cast<cuMatBSR<@GM_SCALAR@>*>(cu_mat)->get_bnrows();
}
__DYNLIB_ATTR__ int32_t gm_BSRMat_get_bncols_@GM_SCALAR@(gm_BSRMat_t cu_mat)
{
return static_cast<cuMatBSR<@GM_SCALAR@>*>(cu_mat)->get_bncols();
}
__DYNLIB_ATTR__ int32_t gm_BSRMat_get_bnnz_@GM_SCALAR@(gm_BSRMat_t cu_mat)
{
return static_cast<cuMatBSR<@GM_SCALAR@>*>(cu_mat)->get_bnnz();
}
__DYNLIB_ATTR__ int32_t gm_BSRMat_get_dev_@GM_SCALAR@(gm_BSRMat_t a)
{
return static_cast<cuMatBSR<@GM_SCALAR@>*>(a)->dev_id;
......
......@@ -22,6 +22,9 @@ typedef void (*gm_BSRMat_conjugate_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef @GM_SCALAR_REAL@ (*gm_BSRMat_norm_frob_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef size_t (*gm_BSRMat_get_nnz_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef size_t (*gm_BSRMat_get_nbytes_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef size_t (*gm_BSRMat_get_bnrows_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef size_t (*gm_BSRMat_get_bncols_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef size_t (*gm_BSRMat_get_bnnz_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef int32_t (*gm_BSRMat_get_dev_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef void (*gm_BSRMat_set_zeros_@GM_SCALAR@_ptr)(gm_BSRMat_t);
typedef gm_BSRMat_t (*gm_BSRMat_clone_@GM_SCALAR@_ptr)(gm_BSRMat_t, const int32_t dev_id, const void* stream);
......@@ -39,6 +42,9 @@ struct gm_BSRMatFunc_@GM_SCALAR@
gm_BSRMat_conjugate_@GM_SCALAR@_ptr conjugate;
gm_BSRMat_norm_frob_@GM_SCALAR@_ptr norm_frob;
gm_BSRMat_get_nnz_@GM_SCALAR@_ptr get_nnz;
gm_BSRMat_get_bnrows_@GM_SCALAR@_ptr get_bnrows;
gm_BSRMat_get_bncols_@GM_SCALAR@_ptr get_bncols;
gm_BSRMat_get_bnnz_@GM_SCALAR@_ptr get_bnnz;
gm_BSRMat_get_nbytes_@GM_SCALAR@_ptr get_nbytes;
gm_BSRMat_get_dev_@GM_SCALAR@_ptr get_dev;
gm_BSRMat_set_zeros_@GM_SCALAR@_ptr set_zeros;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment