Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
faust group
faust
Commits
6d5153a0
Commit
6d5153a0
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add a Faust::bsrgemm GPU2 unit test.
parent
c1e9b12e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/test/src/C++/test_matbsr_gpu_mod.cpp.in
+49
-0
49 additions, 0 deletions
misc/test/src/C++/test_matbsr_gpu_mod.cpp.in
with
49 additions
and
0 deletions
misc/test/src/C++/test_matbsr_gpu_mod.cpp.in
+
49
−
0
View file @
6d5153a0
...
@@ -359,9 +359,58 @@ void test_transform_rand_bsr()
...
@@ -359,9 +359,58 @@ void test_transform_rand_bsr()
delete F;
delete F;
}
}
void test_bsrgemm()
{
std::cout << "test_bsrgemm" << std::endl;
char A_ops[3] = {'N', 'T', 'H'};
for(int i=0; i < sizeof(A_ops); i++)
{
auto A_op = A_ops[i];
auto B_op = A_op;
// gen a cpu random dense matrix
MatDense<FPP, Cpu> *cpu_dmat = MatDense<FPP, Cpu>::randMat(10, 15);
//cpu_dmat->multiply(*cpu_dmat, 'T');
//cpu_dmat->setOnes();
// convert it to gpu
MatDense<FPP, GPU2> gpu_dmat(*cpu_dmat);
MatDense<FPP, GPU2> gpu_outmat;
MatDense<FPP, GPU2> cpu_outmat(*cpu_dmat);
// idem for bsr mats
auto cpu_bmat = MatBSR<FPP, Cpu>::randMat(15, 10, 5, 5, 2);
auto cpu_bmat_dmat = cpu_bmat->to_dense();
MatBSR<FPP, GPU2> gpu_bmat(*cpu_bmat);
if(B_op == 'T')
cpu_dmat->transpose();
else if(B_op == 'H')
cpu_dmat->adjoint();
// multiply on cpu
cpu_bmat->multiply(*cpu_dmat, A_op);
// if(A_op == 'T') gpu_bmat.transpose();
std::cout << "brsgemm(bsr, dense, '"<< A_op<<"', '"<< A_op<<"')" << std::endl;
bsrgemm(gpu_bmat, gpu_dmat, gpu_outmat, FPP(1.0), FPP(0), A_op, B_op);
MatDense<FPP, Cpu> diff_mat;
gpu_outmat.tocpu(diff_mat);
diff_mat -= *cpu_dmat;
assert(diff_mat.norm() < 1e-3);
std::cout << "OK" << std::endl;
delete cpu_bmat;
delete cpu_dmat;
}
}
int main()
int main()
{
{
Faust::enable_gpu_mod();
Faust::enable_gpu_mod();
test_bsrgemm();
test_gpu_ctor_and_tocpu();
test_gpu_ctor_and_tocpu();
test_gpu_mul_dense();
test_gpu_mul_dense();
test_gpu_mul_vec();
test_gpu_mul_vec();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment