mirror of
https://github.com/boostorg/compute.git
synced 2026-01-30 19:52:16 +00:00
Global setup for OpenCL context in tests
refs kylelutz/compute#9 device, context, and queue are initialized statically in `context_setup.hpp`. With this change all tests are able to complete when an NVIDIA GPU is in exclusive compute mode. Side effect of the change: Time for all tests to complete reduced from 15.71 to 13.03 sec Tesla C2075.
This commit is contained in:
@@ -16,20 +16,17 @@
|
||||
#include <boost/compute/program.hpp>
|
||||
#include <boost/compute/command_queue.hpp>
|
||||
|
||||
#include "context_setup.hpp"
|
||||
|
||||
namespace bc = boost::compute;
|
||||
|
||||
BOOST_AUTO_TEST_CASE(get_context)
|
||||
{
|
||||
bc::device device = bc::system::default_device();
|
||||
bc::context context(device);
|
||||
bc::command_queue queue(context, device);
|
||||
BOOST_VERIFY(queue.get_context() == context);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(event_profiling)
|
||||
{
|
||||
bc::device device = bc::system::default_device();
|
||||
bc::context context(device);
|
||||
bc::command_queue queue(context, device, bc::command_queue::enable_profiling);
|
||||
|
||||
int data[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
@@ -50,9 +47,6 @@ BOOST_AUTO_TEST_CASE(event_profiling)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(kernel_profiling)
|
||||
{
|
||||
boost::compute::device device = boost::compute::system::default_device();
|
||||
boost::compute::context context(device);
|
||||
|
||||
// create queue with profiling enabled
|
||||
boost::compute::command_queue queue(
|
||||
context, device, boost::compute::command_queue::enable_profiling
|
||||
@@ -116,9 +110,6 @@ BOOST_AUTO_TEST_CASE(kernel_profiling)
|
||||
|
||||
BOOST_AUTO_TEST_CASE(construct_from_cl_command_queue)
|
||||
{
|
||||
boost::compute::device device = boost::compute::system::default_device();
|
||||
boost::compute::context context(device);
|
||||
|
||||
// create cl_command_queue
|
||||
cl_command_queue cl_queue =
|
||||
clCreateCommandQueue(context, device.id(), 0, 0);
|
||||
@@ -138,10 +129,6 @@ BOOST_AUTO_TEST_CASE(construct_from_cl_command_queue)
|
||||
#ifdef CL_VERSION_1_1
|
||||
BOOST_AUTO_TEST_CASE(write_buffer_rect)
|
||||
{
|
||||
boost::compute::device device = boost::compute::system::default_device();
|
||||
boost::compute::context context(device);
|
||||
boost::compute::command_queue queue(context, device);
|
||||
|
||||
int data[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
|
||||
boost::compute::buffer buffer(context, 8 * sizeof(int));
|
||||
|
||||
@@ -171,3 +158,5 @@ BOOST_AUTO_TEST_CASE(write_buffer_rect)
|
||||
BOOST_CHECK_EQUAL(output[3], 7);
|
||||
}
|
||||
#endif // CL_VERSION_1_1
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
Reference in New Issue
Block a user