Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 3f1dcf52 authored by hhakim's avatar hhakim
Browse files

Add GPU2 MatButterfly getNbRow/Col/getType and unit tests.

parent e7821d10
No related branches found
No related tags found
No related merge requests found
......@@ -38,6 +38,22 @@ void test_get_nbytes(MatButterfly<FPP, GPU2> &gpu_bm, MatButterfly<FPP, Cpu> &cp
cout << "OK" << endl;
}
void test_get_nbrowcol(MatButterfly<FPP, GPU2> &gpu_bm, MatButterfly<FPP, Cpu> &cpu_bm)
{
cout << "Test MatButterfly<FPP, GPU2>::getNbRow/Col()" << endl;
assert(gpu_bm.getNbRow() == cpu_bm.getNbRow());
assert(gpu_bm.getNbCol() == cpu_bm.getNbCol());
cout << "OK" << endl;
}
void test_get_type(MatButterfly<FPP, GPU2> &gpu_bm, MatButterfly<FPP, Cpu> &cpu_bm)
{
cout << "Test MatButterfly<FPP, GPU2>::getType()" << endl;
assert(gpu_bm.getType() == cpu_bm.getType());
assert(gpu_bm.getType() == Butterfly);
cout << "OK" << endl;
}
int main(int argc, char** argv)
{
Faust::enable_gpu_mod();
......@@ -55,6 +71,8 @@ int main(int argc, char** argv)
MatButterfly<FPP, GPU2> gpu_bm(spButterflyMat, /* level */ 0);
test_mul_matdense(gpu_bm, cpu_bm);
test_get_nbytes(gpu_bm, cpu_bm);
test_get_nbrowcol(gpu_bm, cpu_bm);
test_get_type(gpu_bm, cpu_bm);
return 0;
}
......@@ -23,27 +23,27 @@ namespace Faust
MatButterfly(const MatSparse<FPP, Cpu> &factor, int level);
void setZeros();
size_t getNBytes() const;
/*MatType getType() const;
int32_t getNbRow() const;
int32_t getNbCol() const;
MatGeneric<FPP,GPU2>* clone(const int32_t dev_id=-1, const void* stream=nullptr) const;
MatGeneric<FPP,GPU2>* Clone(const bool isOptimize=false) const;
void* get_gpu_mat_ptr() const;
faust_unsigned_int getNonZeros() const;
void transpose();
void conjugate();
void adjoint();
//! \brief Returns a sub-group of rows of this matrix as the same type of matrix
MatGeneric<FPP,GPU2>* get_rows(faust_unsigned_int row_id_start, faust_unsigned_int num_rows) const;
//! \brief Returns a sub-group of rows of this matrix as the same type of matrix
MatGeneric<FPP,GPU2>* get_rows(faust_unsigned_int* row_ids, faust_unsigned_int num_rows) const;
//! \brief Returns a sub-group of columns of this matrix as the same type of matrix
Faust::MatGeneric<FPP,GPU2>* get_cols(faust_unsigned_int col_id_start, faust_unsigned_int num_cols) const;
//! \brief Returns a sub-group of columns of this matrix as the same type of matrix
Faust::MatGeneric<FPP,GPU2>* get_cols(faust_unsigned_int* col_ids, faust_unsigned_int num_cols) const;
void Display() const;
Real<FPP> norm() const;*/
MatType getType() const {return Butterfly;} //TODO: move def in hpp
int32_t getNbRow() const {return d1.size();} //TODO: move def in hpp
int32_t getNbCol() const {return d1.size();} //TODO: move def in hpp
/*MatGeneric<FPP,GPU2>* clone(const int32_t dev_id=-1, const void* stream=nullptr) const;
MatGeneric<FPP,GPU2>* Clone(const bool isOptimize=false) const;
void* get_gpu_mat_ptr() const;
faust_unsigned_int getNonZeros() const;
void transpose();
void conjugate();
void adjoint();
//! \brief Returns a sub-group of rows of this matrix as the same type of matrix
MatGeneric<FPP,GPU2>* get_rows(faust_unsigned_int row_id_start, faust_unsigned_int num_rows) const;
//! \brief Returns a sub-group of rows of this matrix as the same type of matrix
MatGeneric<FPP,GPU2>* get_rows(faust_unsigned_int* row_ids, faust_unsigned_int num_rows) const;
//! \brief Returns a sub-group of columns of this matrix as the same type of matrix
Faust::MatGeneric<FPP,GPU2>* get_cols(faust_unsigned_int col_id_start, faust_unsigned_int num_cols) const;
//! \brief Returns a sub-group of columns of this matrix as the same type of matrix
Faust::MatGeneric<FPP,GPU2>* get_cols(faust_unsigned_int* col_ids, faust_unsigned_int num_cols) const;
void Display() const;
Real<FPP> norm() const;*/
void multiply(MatDense<FPP, GPU2> &other, const char op_this);
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment