[arrayfire] 27/75: Adding tests for to check for resetting in JIT
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Feb 29 08:01:11 UTC 2016
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch dfsg-clean
in repository arrayfire.
commit 3faa83dc14c657e5ebd6de4d60d5d8a67a8fa138
Author: Pavan Yalamanchili <pavan at arrayfire.com>
Date: Fri Feb 12 18:42:06 2016 -0500
Adding tests for to check for resetting in JIT
---
test/jit.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/test/jit.cpp b/test/jit.cpp
index 3c2308d..a20b0f4 100644
--- a/test/jit.cpp
+++ b/test/jit.cpp
@@ -65,3 +65,53 @@ TEST(JIT, CPP_JIT_HASH)
delete[] hF2;
}
}
+
+TEST(JIT, CPP_JIT_Reset_Binary)
+{
+ using af::array;
+
+ af::array a = af::constant(2, 5,5);
+ af::array b = af::constant(1, 5,5);
+ af::array c = a + b;
+ af::array d = a - b;
+ af::array e = c * d;
+ e.eval();
+ af::array f = c - d;
+ f.eval();
+ af::array g = d - c;
+ g.eval();
+
+ std::vector<float> hf(f.elements());
+ std::vector<float> hg(g.elements());
+ f.host(&hf[0]);
+ g.host(&hg[0]);
+
+ for (int i = 0; i < (int)f.elements(); i++) {
+ ASSERT_EQ(hf[i], -hg[i]);
+ }
+}
+
+TEST(JIT, CPP_JIT_Reset_Unary)
+{
+ using af::array;
+
+ af::array a = af::constant(2, 5,5);
+ af::array b = af::constant(1, 5,5);
+ af::array c = af::sin(a);
+ af::array d = af::cos(b);
+ af::array e = c * d;
+ e.eval();
+ af::array f = c - d;
+ f.eval();
+ af::array g = d - c;
+ g.eval();
+
+ std::vector<float> hf(f.elements());
+ std::vector<float> hg(g.elements());
+ f.host(&hf[0]);
+ g.host(&hg[0]);
+
+ for (int i = 0; i < (int)f.elements(); i++) {
+ ASSERT_EQ(hf[i], -hg[i]);
+ }
+}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/arrayfire.git
More information about the debian-science-commits
mailing list