Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 055a6c34 authored by hhakim's avatar hhakim
Browse files

Update to gpu_mod@1.1.2 and update faust_gpu_mod consequently

[skip ci].
parent 3945339d
Branches
Tags
No related merge requests found
Subproject commit 530b868724952d3417ac3aa14aeebc95dcda9bb8 Subproject commit cf5f672d2d9921d077b800458b03618403a7b96c
...@@ -304,7 +304,7 @@ namespace Faust { ...@@ -304,7 +304,7 @@ namespace Faust {
#ifdef USE_GPU_MOD #ifdef USE_GPU_MOD
case 10: case 10:
if(gpu_faust != nullptr) if(gpu_faust != nullptr)
M = gpu_faust->multiply(&A); M = gpu_faust->multiply(&A, is_transposed, is_conjugate);
break; break;
#endif #endif
default: default:
......
...@@ -74,11 +74,22 @@ namespace Faust ...@@ -74,11 +74,22 @@ namespace Faust
{ {
const MatSparse<@FAUST_SCALAR_FOR_GM@, Cpu>* sp_mat; const MatSparse<@FAUST_SCALAR_FOR_GM@, Cpu>* sp_mat;
const MatDense<@FAUST_SCALAR_FOR_GM@, Cpu>* ds_mat; const MatDense<@FAUST_SCALAR_FOR_GM@, Cpu>* ds_mat;
gm_DenseMat_t gpu_prod_mat_dense;
@GM_SCALAR@ one;
set_one<@GM_SCALAR@>(&one);
gm_Op op;
if(transpose && conjugate)
op = OP_CONJTRANSP;
else if(transpose)
op = OP_TRANSP;
else
op = OP_NOTRANSP;
gm_MatArrayFunc_@GM_SCALAR@* marr_funcs = (gm_MatArrayFunc_@GM_SCALAR@*) this->marr_funcs; gm_MatArrayFunc_@GM_SCALAR@* marr_funcs = (gm_MatArrayFunc_@GM_SCALAR@*) this->marr_funcs;
if(sp_mat = dynamic_cast<const MatSparse<@FAUST_SCALAR_FOR_GM@,Cpu>*>(A)) if(sp_mat = dynamic_cast<const MatSparse<@FAUST_SCALAR_FOR_GM@,Cpu>*>(A))
{ {
throw std::runtime_error("FaustGPU::multiply() by MatSparse isn't yet impl.");
// std::cout << "FaustGPU::multiply(MatSparse): " << sp_mat->getNbRow() << " " << sp_mat->getNbCol()<< " " << sp_mat->getNonZeros()<< std::endl; // std::cout << "FaustGPU::multiply(MatSparse): " << sp_mat->getNbRow() << " " << sp_mat->getNbCol()<< " " << sp_mat->getNonZeros()<< std::endl;
marr_funcs->togpu_spm(gpu_mat_arr, sp_mat->getNbRow(), sp_mat->getNbCol(), sp_mat->getNonZeros(), (int32_t *) sp_mat->getOuterIndexPtr(), (int32_t*) sp_mat->getInnerIndexPtr(), (@GM_SCALAR@*) reinterpret_cast<@GM_REINTERPRET_CAST_SCALAR@*>(const_cast<@FAUST_SCALAR_FOR_GM@*>(sp_mat->getValuePtr()))); marr_funcs->togpu_spm(gpu_mat_arr, sp_mat->getNbRow(), sp_mat->getNbCol(), sp_mat->getNonZeros(), (int32_t *) sp_mat->getOuterIndexPtr(), (int32_t*) sp_mat->getInnerIndexPtr(), (@GM_SCALAR@*) reinterpret_cast<@GM_REINTERPRET_CAST_SCALAR@*>(const_cast<@FAUST_SCALAR_FOR_GM@*>(sp_mat->getValuePtr())));
} }
...@@ -86,13 +97,17 @@ namespace Faust ...@@ -86,13 +97,17 @@ namespace Faust
{ {
// std::cout << "FaustGPU::multiply(MatDense): " << ds_mat->getNbRow() << " " << ds_mat->getNbCol()<< " " << ds_mat->getNonZeros()<< std::endl; // std::cout << "FaustGPU::multiply(MatDense): " << ds_mat->getNbRow() << " " << ds_mat->getNbCol()<< " " << ds_mat->getNonZeros()<< std::endl;
marr_funcs->togpu_dsm(gpu_mat_arr, ds_mat->getNbRow(), ds_mat->getNbCol(), (@GM_SCALAR@*) reinterpret_cast<@GM_REINTERPRET_CAST_SCALAR@*>(const_cast<@FAUST_SCALAR_FOR_GM@*>(ds_mat->getData()))); gpu_prod_mat_dense = marr_funcs->chain_matmul_by_cpu_dsm(gpu_mat_arr, one, op, (@GM_SCALAR@*) reinterpret_cast<@GM_REINTERPRET_CAST_SCALAR@*>(const_cast<@FAUST_SCALAR_FOR_GM@*>(ds_mat->getData())), ds_mat->getNbRow(), ds_mat->getNbCol());
} }
auto M = this->get_product(); //TODO: add to GPU mod a chain_matmul overload to directly get cpu mat result from here (I mean an argument to data of pre-allocated DenseMat)
int32_t nrows, ncols;
marr_funcs->erase_at(gpu_mat_arr, size); gm_DenseMatFunc_@GM_SCALAR@* dsm_funcs = (gm_DenseMatFunc_@GM_SCALAR@*) this->dsm_funcs;
return M; dsm_funcs->info(gpu_prod_mat_dense, &nrows, &ncols);
MatDense<@FAUST_SCALAR_FOR_GM@, Cpu> gpu2cpu_mat(nrows, ncols);
dsm_funcs->tocpu(gpu_prod_mat_dense, (@GM_SCALAR@*) reinterpret_cast<@GM_REINTERPRET_CAST_SCALAR@*>(gpu2cpu_mat.getData()));
dsm_funcs->free(gpu_prod_mat_dense);
return gpu2cpu_mat;
} }
template <> template <>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment