Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 500667b8 authored by hhakim's avatar hhakim
Browse files

Add test to MatDense<FPP,GPU2>::mutliply.

parent cf8679a7
No related branches found
No related tags found
No related merge requests found
#include "faust_constant.h"
#include "faust_gpu_mod.h"
#include "faust_MatDense_gpu.h"
#include <cstdlib>
using namespace Faust;
int main(int argc, char** argv)
{
faust_unsigned_int nrows = 10, ncols = 10;
faust_unsigned_int nrows2 = 10, ncols2 = 15;
double data[100];
Faust::enable_gpu_mod();
auto cpu_mat1 = Faust::MatDense<double,Cpu>::randMat(nrows,ncols);
MatDense<double,GPU2> gpu_mat1(cpu_mat1->getData(), nrows, ncols);
auto cpu_mat2 = Faust::MatDense<double,Cpu>::randMat(nrows2,ncols2);
MatDense<double,GPU2> gpu_mat2(cpu_mat2->getData(), nrows2, ncols2);
gpu_mat1.multiply(gpu_mat2);
auto cpu_mat1_mat2_test = gpu_mat2.tocpu();
auto cpu_mat1_mat2_ref = *cpu_mat2;
cpu_mat1->multiply(cpu_mat1_mat2_ref, 'N');
auto err_diff = cpu_mat1_mat2_ref;
err_diff -= cpu_mat1_mat2_test;
cout << "err mul." << err_diff.norm()/cpu_mat1_mat2_ref.norm() << endl;
return EXIT_SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment