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.4.
Show more breadcrumbs
faust group
faust
Commits
ba963ef0
Commit
ba963ef0
authored
2 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add a test of GPU batched SVD.
parent
bcd227fa
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/test/CMakeLists.txt
+1
-1
1 addition, 1 deletion
misc/test/CMakeLists.txt
misc/test/src/C++/faust_test_gpu_svd.cpp.in
+59
-0
59 additions, 0 deletions
misc/test/src/C++/faust_test_gpu_svd.cpp.in
with
60 additions
and
1 deletion
misc/test/CMakeLists.txt
+
1
−
1
View file @
ba963ef0
...
...
@@ -200,7 +200,7 @@ if(MATIO_LIB_FILE AND MATIO_INC_DIR AND BUILD_READ_MAT_FILE AND NOT NOCPPTESTS)
endif
()
if
(
USE_GPU_MOD
)
list
(
APPEND tests faust_gpu_mod hierarchical2020_gpu test_matdense_gpu_mod test_matsparse_gpu_mod test_matbsr_gpu_mod test_transform_gpu_mod test_vect_gpu_mod test_transform_helper_gpu_mod hierarchical2020_gpu2 hierarchical2020Hadamard_gpu2 MEG_factorization test_prox_sp_gpu test_prox_splin_spcol_gpu test_dynprog_mul_gpu
)
list
(
APPEND tests faust_gpu_mod hierarchical2020_gpu test_matdense_gpu_mod test_matsparse_gpu_mod test_matbsr_gpu_mod test_transform_gpu_mod test_vect_gpu_mod test_transform_helper_gpu_mod hierarchical2020_gpu2 hierarchical2020Hadamard_gpu2 MEG_factorization test_prox_sp_gpu test_prox_splin_spcol_gpu test_dynprog_mul_gpu
faust_test_gpu_svd
)
endif
()
foreach
(
TEST_FPP float double complex<float> complex<double>
)
...
...
This diff is collapsed.
Click to expand it.
misc/test/src/C++/faust_test_gpu_svd.cpp.in
0 → 100644
+
59
−
0
View file @
ba963ef0
#include "faust_gpu_mod_utils.h"
#include "faust_MatDense.h"
#include "faust_MatDense_gpu.h"
#include <iostream>
using namespace std;
using namespace Faust;
typedef @TEST_FPP@ FPP;
int main()
{
Faust::enable_gpu_mod();
int m = 16, n = 18; // TODO: option with default values
int nbatches = 32; // TODO: option with default values
const int minmn = (m < n) ? m : n; /* min(m,n) */
MatDense<FPP, Cpu>* As = MatDense<FPP, Cpu>::randMat(m, n * nbatches);
MatDense<FPP, Cpu> Us, Vs, Ss;
MatDense<FPP, GPU2> gpu_As(*As);
MatDense<FPP, GPU2> gpu_Us(m, m * nbatches);
MatDense<FPP, GPU2> gpu_Vs(n, n * nbatches);
MatDense<FPP, GPU2> gpu_Ss(minmn, nbatches);
batched_svd(gpu_As, nbatches, gpu_Us, gpu_Vs, gpu_Ss/*, rank*/);
gpu_Us.tocpu(Us);
gpu_Vs.tocpu(Vs);
gpu_Ss.tocpu(Ss);
for(int i=0;i < nbatches; i++)
{
auto A = As->get_cols(i * n, n);
auto U = Us.get_cols(i * m, m);
auto V = Vs.get_cols(i * n, n);
auto S = Ss.get_cols(i, 1);
MatDense<FPP, Cpu> SD(m, n);
SD.setZeros();
for(int j=0;j<minmn;j++)
SD.getData()[j * m + j] = (*S)(j);
auto E = *A;
auto P = *U;
P.multiplyRight(SD);
V->adjoint();
P.multiplyRight(*V);
E -= P;
auto err = E.norm() / A->norm();
cout << "err:" << err << endl;
assert(err < 1e-7);
delete A;
delete U;
delete V;
delete S;
}
delete As;
}
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