Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 31c5ebbd authored by hhakim's avatar hhakim
Browse files

Fix GPU2 missing multiply signature (issue #189).

parent 8d5269a8
Branches
Tags
No related merge requests found
......@@ -45,7 +45,8 @@ namespace Faust
TransformHelper<FPP,GPU2>* multiply(const TransformHelper<FPP,GPU2>*);
Vect<FPP,GPU2> multiply(const Faust::Vect<FPP,GPU2>& a, const bool transpose=false, const bool conjugate=false);
Vect<FPP,Cpu> multiply(const Vect<FPP,Cpu> &x, const bool transpose=false, const bool conjugate=false);
void multiply(const FPP* x, FPP* y, const bool transpose=false, const bool conjugate=false);
void multiply(const FPP* cpu_x, FPP* cpu_y, const bool transpose=false, const bool conjugate=false);
void multiply(const FPP* cpu_x, int x_ncols, FPP* cpu_y, const bool transpose=false, const bool conjugate=false);
Real<FPP> normFro() const;
Real<FPP> normL1() const;
Real<FPP> normInf() const;
......
......@@ -339,6 +339,24 @@ namespace Faust
v.tocpu(cpu_out_buf);
}
template<typename FPP>
void TransformHelper<FPP,GPU2>::multiply(const FPP* cpu_x_buf, int x_ncols, FPP* cpu_out_buf, const bool transpose /* deft to false */, const bool conjugate/*=false*/)
{
this->is_transposed ^= transpose;
this->is_conjugate ^= conjugate;
int32_t x_nrows;
if(this->is_transposed)
x_nrows = this->getNbRow();
else
x_nrows = this->getNbCol();
MatDense<FPP,GPU2> gpu_x(x_nrows, x_ncols, cpu_x_buf);
MatDense<FPP,GPU2> gpu_M = this->multiply(gpu_x, transpose, conjugate); //TODO: handle transpose and conjugate
// TODO: fix this function, it works until here then it segfaults or gives a cuda error with tocpu (even if I use a cpu matdense set locally)
this->is_transposed ^= transpose;
this->is_conjugate ^= conjugate;
gpu_M.tocpu(cpu_out_buf);
}
template<typename FPP>
TransformHelper<FPP,GPU2>* TransformHelper<FPP,GPU2>::multiply(const FPP& a)
{
......
......@@ -177,6 +177,7 @@ void FaustCoreCpp<FPP,DEV>::multiply(FPP* value_y,int nbrow_y,int nbcol_y, const
{
// assuming that x and y are pointers to memory allocated to the proper
// sizes
// Y = this->transform->multiply(value_x);
this->transform->multiply(value_x, value_y);
}
else
......@@ -185,13 +186,12 @@ void FaustCoreCpp<FPP,DEV>::multiply(FPP* value_y,int nbrow_y,int nbcol_y, const
Faust::Vect<FPP,Cpu> Y;
Y = this->transform->multiply(X);
Y = this->transform->multiply(value_x);
memcpy(value_y,Y.getData(),sizeof(FPP)*nbrow_y);
}
}
else
{
if(this->transform->get_mul_order_opt_mode() == Faust::DEFAULT)
if(this->transform->get_mul_order_opt_mode() == Faust::DEFAULT && DEV == Cpu /*tmp fix to GPU2 that fails in multiply below */)
{
//assuming that value_x and value_y are allocated properly (to the good
//sizes) in numpy world
......@@ -208,6 +208,7 @@ void FaustCoreCpp<FPP,DEV>::multiply(FPP* value_y,int nbrow_y,int nbcol_y, const
}
}
}
template<typename FPP, FDevice DEV>
FaustCoreCpp<FPP,DEV>* FaustCoreCpp<FPP,DEV>::polyNext() const
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment