[arrayfire] 246/284: Fix Tests: ORB, Meanshift, basic_c, solve

Ghislain Vaillant ghisvail-guest at moszumanska.debian.org
Sun Feb 7 18:59:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

ghisvail-guest pushed a commit to branch debian/experimental
in repository arrayfire.

commit 805dc5b60937cc6d3f9ddd912b540bf967f5dfdc
Author: Shehzan Mohammed <shehzan at arrayfire.com>
Date:   Fri Jan 22 22:56:59 2016 -0500

    Fix Tests: ORB, Meanshift, basic_c, solve
    
    * Fix vector in fast_pyramid - use resize instead of reserve
    * Fix meanshift test. Use proper types and arrays
    * Fix memory leak in basic_c
    * Enable solve tests that were disabled for windows opencl
---
 src/backend/cuda/kernel/fast_pyramid.hpp |  6 +++++-
 test/basic_c.c                           |  1 +
 test/meanshift.cpp                       | 15 +++++++++------
 test/solve_dense.cpp                     |  5 +----
 4 files changed, 16 insertions(+), 11 deletions(-)

diff --git a/src/backend/cuda/kernel/fast_pyramid.hpp b/src/backend/cuda/kernel/fast_pyramid.hpp
index 61a9c7a..d2e5903 100644
--- a/src/backend/cuda/kernel/fast_pyramid.hpp
+++ b/src/backend/cuda/kernel/fast_pyramid.hpp
@@ -65,7 +65,11 @@ void fast_pyramid(std::vector<unsigned>& feat_pyr,
     lvl_best[max_levels-1] = max_feat - feat_sum;
 
     // Hold multi-scale image pyramids
-    img_pyr.reserve(max_levels);
+    static const dim4 dims0;
+    static const CParam<T> emptyCParam(NULL, dims0.get(), dims0.get());
+    // Need to do this as CParam does not have a default constructor
+    // And resize needs a default constructor or default value prior to C++11
+    img_pyr.resize(max_levels, emptyCParam);
 
     // Create multi-scale image pyramid
     for (unsigned i = 0; i < max_levels; i++) {
diff --git a/test/basic_c.c b/test/basic_c.c
index f6c7310..0caca29 100644
--- a/test/basic_c.c
+++ b/test/basic_c.c
@@ -13,5 +13,6 @@ int main() {
     af_array out = 0;
     dim_t s[] = {10, 10, 1, 1};
     af_err e = af_randu(&out, 4, s, f32);
+    if(out != 0) af_release_array(out);
     return (AF_SUCCESS != e);
 }
diff --git a/test/meanshift.cpp b/test/meanshift.cpp
index 34b622b..a35ca28 100644
--- a/test/meanshift.cpp
+++ b/test/meanshift.cpp
@@ -65,11 +65,12 @@ void meanshiftTest(string pTestFile)
 
     for (size_t testId=0; testId<testCount; ++testId) {
 
-        af_array inArray     = 0;
-        af_array inArray_f32 = 0;
-        af_array outArray    = 0;
-        af_array goldArray   = 0;
-        dim_t nElems      = 0;
+        af_array inArray        = 0;
+        af_array inArray_f32    = 0;
+        af_array outArray       = 0;
+        af_array goldArray      = 0;
+        af_array goldArray_f32  = 0;
+        dim_t nElems            = 0;
 
         inFiles[testId].insert(0,string(TEST_DIR"/meanshift/"));
         outFiles[testId].insert(0,string(TEST_DIR"/meanshift/"));
@@ -77,7 +78,8 @@ void meanshiftTest(string pTestFile)
         ASSERT_EQ(AF_SUCCESS, af_load_image(&inArray_f32, inFiles[testId].c_str(), isColor));
         ASSERT_EQ(AF_SUCCESS, conv_image<T>(&inArray, inArray_f32));
 
-        ASSERT_EQ(AF_SUCCESS, af_load_image(&goldArray, outFiles[testId].c_str(), isColor));
+        ASSERT_EQ(AF_SUCCESS, af_load_image(&goldArray_f32, outFiles[testId].c_str(), isColor));
+        ASSERT_EQ(AF_SUCCESS, conv_image<T>(&goldArray, goldArray_f32)); // af_load_image always returns float array
         ASSERT_EQ(AF_SUCCESS, af_get_elements(&nElems, goldArray));
 
         ASSERT_EQ(AF_SUCCESS, af_mean_shift(&outArray, inArray, 2.25f, 25.56f, 5, isColor));
@@ -94,6 +96,7 @@ void meanshiftTest(string pTestFile)
         ASSERT_EQ(AF_SUCCESS, af_release_array(inArray_f32));
         ASSERT_EQ(AF_SUCCESS, af_release_array(outArray));
         ASSERT_EQ(AF_SUCCESS, af_release_array(goldArray));
+        ASSERT_EQ(AF_SUCCESS, af_release_array(goldArray_f32));
     }
 }
 
diff --git a/test/solve_dense.cpp b/test/solve_dense.cpp
index 09addc7..183afdb 100644
--- a/test/solve_dense.cpp
+++ b/test/solve_dense.cpp
@@ -186,15 +186,12 @@ SOLVE_TESTS(cdouble, 1E-5)
 #define SOLVE_TESTS(T, eps)                     \
     TEST(SOLVE, T##RectOver)                    \
     {                                           \
-        solveTester<T>(800, 600, 50, eps);      \
+        solveTester<T>(800, 600, 64, eps);      \
     }
 
 SOLVE_TESTS(float, 0.01)
 SOLVE_TESTS(double, 1E-5)
-// Fails on Windows on some devices
-#if !(defined(OS_WIN) && defined(AF_OPENCL))
 SOLVE_TESTS(cfloat, 0.01)
 SOLVE_TESTS(cdouble, 1E-5)
-#endif
 
 #undef SOLVE_TESTS

-- 
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