[compute] 31/46: Add more tests for enqueue_svm_memcpy() method
Ghislain Vaillant
ghisvail-guest at moszumanska.debian.org
Mon Dec 21 18:28:44 UTC 2015
This is an automated email from the git hooks/post-receive script.
ghisvail-guest pushed a commit to branch master
in repository compute.
commit fb03f879421df1e38201f3a42c7b66d745b9c85b
Author: Jakub Szuppe <j.szuppe at gmail.com>
Date: Thu Oct 29 12:44:06 2015 +0100
Add more tests for enqueue_svm_memcpy() method
---
test/test_svm_ptr.cpp | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/test/test_svm_ptr.cpp b/test/test_svm_ptr.cpp
index 1a8ad8f..daea781 100644
--- a/test/test_svm_ptr.cpp
+++ b/test/test_svm_ptr.cpp
@@ -16,6 +16,7 @@
#include <boost/compute/container/vector.hpp>
#include <boost/compute/utility/source.hpp>
+#include "quirks.hpp"
#include "check_macros.hpp"
#include "context_setup.hpp"
@@ -34,6 +35,38 @@ BOOST_AUTO_TEST_CASE(alloc)
compute::svm_free(context, ptr);
}
+BOOST_AUTO_TEST_CASE(svmmemcpy)
+{
+ REQUIRES_OPENCL_VERSION(2, 0);
+
+ if(bug_in_svmmemcpy(device)){
+ std::cerr << "skipping svmmemcpy test case" << std::endl;
+ return;
+ }
+
+ cl_int input[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+ cl_int output[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ compute::svm_ptr<cl_int> ptr = compute::svm_alloc<cl_int>(context, 8);
+ compute::svm_ptr<cl_int> ptr2 = compute::svm_alloc<cl_int>(context, 8);
+
+ // copying from and to host mem
+ queue.enqueue_svm_memcpy(ptr.get(), input, 8 * sizeof(cl_int));
+ queue.enqueue_svm_memcpy(output, ptr.get(), 8 * sizeof(cl_int));
+ queue.finish();
+
+ CHECK_HOST_RANGE_EQUAL(cl_int, 8, output, (1, 2, 3, 4, 5, 6, 7, 8));
+
+ // copying between svm mem
+ queue.enqueue_svm_memcpy(ptr2.get(), ptr.get(), 8 * sizeof(cl_int));
+ queue.enqueue_svm_memcpy(output, ptr2.get(), 8 * sizeof(cl_int));
+ queue.finish();
+
+ CHECK_HOST_RANGE_EQUAL(cl_int, 8, output, (1, 2, 3, 4, 5, 6, 7, 8));
+
+ compute::svm_free(context, ptr);
+ compute::svm_free(context, ptr2);
+}
+
BOOST_AUTO_TEST_CASE(sum_svm_kernel)
{
REQUIRES_OPENCL_VERSION(2, 0);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/compute.git
More information about the debian-science-commits
mailing list