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
3bfcccec
Commit
3bfcccec
authored
1 year ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add unit tests Vect<FPP, GPU2>.
parent
7b9ae809
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#847111
passed
1 year ago
Stage: test
Stage: pkg_purepy
Stage: pkg
Stage: code_cov
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/test/src/C++/test_vect_gpu_mod.cpp.in
+70
-6
70 additions, 6 deletions
misc/test/src/C++/test_vect_gpu_mod.cpp.in
with
70 additions
and
6 deletions
misc/test/src/C++/test_vect_gpu_mod.cpp.in
+
70
−
6
View file @
3bfcccec
...
...
@@ -7,12 +7,76 @@
using namespace std;
using namespace Faust;
typedef @TEST_FPP@ FPP;
void test_sum()
{
cout << "test Vect<double, GPU2>::sum" << endl;
Vect<FPP, GPU2> u(10);
u.setValues(2);
auto s = u.sum();
assert(s == 2 * 10);
cout << "OK" << endl;
}
void test_eltwise_mul()
{
cout << "test Vect<double, GPU2>::operator*=" << endl;
Vect<FPP, GPU2> u(10);
Vect<FPP, GPU2> v(10);
u.setValues(2);
v.setValues(3);
u *= v;
assert(u.sum() == 2 * 3 * 10);
cout << "OK" << endl;
}
void test_eltwise_div()
{
cout << "test Vect<double, GPU2>::operator/=" << endl;
Vect<FPP, GPU2> u(10);
Vect<FPP, GPU2> v(10);
u.setValues(6);
v.setValues(3);
u /= v;
assert(u.sum() == 6 / 3 * 10);
cout << "OK" << endl;
}
void test_set_vals()
{
cout << "test Vect<double, GPU2>::setValues(double)" << endl;
Vect<FPP, Cpu> cpu_u(10);
Vect<FPP, GPU2> gpu_u(10);
for(int i=0;i<10;i++)
cpu_u.set_coeff(i, 18);
gpu_u.setValues(18);
auto cpu_u_t = gpu_u.tocpu();
assert(cpu_u.equality(cpu_u_t, 1e-16));
cout << "OK" << endl;
}
void test_mean_relerr()
{
cout << "test Vect<double, GPU2>::mean_relative_error()" << endl;
Vect<FPP, Cpu> cu(12), cv(12);
cu.setRand();
cv.setRand();
Vect<FPP, GPU2> gu(cu);
Vect<FPP, GPU2> gv(cv);
auto cerr = cu.mean_relative_error(cv);
auto gerr = gu.mean_relative_error(gv);
assert(std::abs(gerr - cerr) < 1e-6);
cout << "OK" << endl;
}
int main()
{
Faust::Vect<double, GPU2> v
;
//TODO: test Vect<double, GPU2>::sum
//TODO: test Vect<double, GPU2>::operator*= (elt-wise mul.)
//TODO: test Vect<double, GPU2>::operator/= (
elt
-
wise
div.)
//TODO: test Vect<double, GPU2>::setValues(double)
//TODO: test Vect<double, GPU2>::
mean_relerr
enable_gpu_mod()
;
test_set_vals();
test_sum();
test_
eltwise
_mul();
test_eltwise_div();
test_
mean_relerr
();
}
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