2323#include " check_macros.hpp"
2424#include " context_setup.hpp"
2525
26+ #include " distributed_check_functions.hpp"
27+ #include " distributed_queue_setup.hpp"
28+
2629namespace bc = boost::compute;
2730
2831BOOST_AUTO_TEST_CASE (empty_vector)
2932{
30- std::vector<bc:: command_queue> queues;
31- queues. push_back (queue);
32- queues. push_back (queue);
33- bc::distributed::command_queue distributed_queue (queues);
33+ // construct distributed:: command_queue
34+ bc::distributed::command_queue distributed_queue =
35+ get_distributed_queue (queue);
36+
3437 bc::distributed::vector<bc::uint_> distributed_vector (distributed_queue);
3538
3639 BOOST_CHECK (distributed_vector.empty ());
@@ -47,10 +50,9 @@ BOOST_AUTO_TEST_CASE(empty_vector)
4750
4851BOOST_AUTO_TEST_CASE (count_ctor)
4952{
50- std::vector<bc::command_queue> queues;
51- queues.push_back (queue);
52- queues.push_back (queue);
53- bc::distributed::command_queue distributed_queue (queues);
53+ // construct distributed::command_queue
54+ bc::distributed::command_queue distributed_queue =
55+ get_distributed_queue (queue);
5456
5557 bc::distributed::vector<bc::uint_> distributed_vector (
5658 64 , distributed_queue
@@ -70,10 +72,9 @@ BOOST_AUTO_TEST_CASE(count_ctor)
7072
7173BOOST_AUTO_TEST_CASE (command_queue_ctor)
7274{
73- std::vector<bc::command_queue> queues;
74- queues.push_back (queue);
75- queues.push_back (queue);
76- bc::distributed::command_queue distributed_queue (queues);
75+ // construct distributed::command_queue
76+ bc::distributed::command_queue distributed_queue =
77+ get_distributed_queue (queue);
7778
7879 bc::uint_ value = 991 ;
7980 bc::distributed::vector<bc::uint_> distributed_vector (
@@ -97,25 +98,14 @@ BOOST_AUTO_TEST_CASE(command_queue_ctor)
9798 BOOST_CHECK_EQUAL (distributed_vector.back (), value);
9899 BOOST_CHECK_EQUAL (distributed_vector.front (), value);
99100
100- for (size_t i = 0 ; i < distributed_vector.parts (); i++)
101- {
102- BOOST_CHECK (
103- bc::equal (
104- distributed_vector.begin (i),
105- distributed_vector.end (i),
106- bc::make_constant_iterator (value),
107- distributed_queue.get (i)
108- )
109- );
110- }
101+ BOOST_CHECK (distributed_equal (distributed_vector, value, distributed_queue));
111102}
112103
113104BOOST_AUTO_TEST_CASE (host_iterator_ctor)
114105{
115- std::vector<bc::command_queue> queues;
116- queues.push_back (queue);
117- queues.push_back (queue);
118- bc::distributed::command_queue distributed_queue (queues);
106+ // construct distributed::command_queue
107+ bc::distributed::command_queue distributed_queue =
108+ get_distributed_queue (queue);
119109
120110 bc::int_ value = -1 ;
121111 std::vector<bc::int_> host_vector (50 , value);
@@ -135,17 +125,7 @@ BOOST_AUTO_TEST_CASE(host_iterator_ctor)
135125 }
136126 BOOST_CHECK_EQUAL (distributed_vector.size (), size_sum);
137127
138- for (size_t i = 0 ; i < distributed_vector.parts (); i++)
139- {
140- BOOST_CHECK (
141- bc::equal (
142- distributed_vector.begin (i),
143- distributed_vector.end (i),
144- bc::make_constant_iterator (value),
145- distributed_queue.get (i)
146- )
147- );
148- }
128+ BOOST_CHECK (distributed_equal (distributed_vector, value, distributed_queue));
149129
150130 // need to finish since back() and front()
151131 // use different (self-made) queues
@@ -159,12 +139,12 @@ BOOST_AUTO_TEST_CASE(host_iterator_ctor)
159139
160140BOOST_AUTO_TEST_CASE (copy_ctor)
161141{
162- std::vector<bc:: command_queue> queues;
163- queues. push_back (queue);
164- queues. push_back (queue);
165- bc:: distributed::command_queue distributed_queue1 (queues);
166- queues. push_back (queue);
167- bc::distributed::command_queue distributed_queue2 (queues );
142+ // construct distributed:: command_queue
143+ bc::distributed::command_queue distributed_queue1 =
144+ get_distributed_queue (queue);
145+ // construct distributed::command_queue
146+ bc::distributed::command_queue distributed_queue2 =
147+ get_distributed_queue (queue, 2 );
168148
169149 bc::int_ value = -1 ;
170150 size_t size = 64 ;
@@ -185,52 +165,25 @@ BOOST_AUTO_TEST_CASE(copy_ctor)
185165 distributed_vector, distributed_queue2
186166 );
187167
188- for (size_t i = 0 ; i < distributed_vector.parts (); i++)
189- {
190- BOOST_CHECK (
191- bc::equal (
192- distributed_vector.begin (i),
193- distributed_vector.end (i),
194- bc::make_constant_iterator (value),
195- distributed_queue1.get (i)
196- )
197- );
198- BOOST_CHECK (
199- bc::equal (
200- distributed_vector_copy1.begin (i),
201- distributed_vector_copy1.end (i),
202- bc::make_constant_iterator (value),
203- distributed_queue1.get (i)
204- )
205- );
206- }
207- for (size_t i = 0 ; i < distributed_vector_copy2.parts (); i++)
208- {
209- BOOST_CHECK (
210- bc::equal (
211- distributed_vector_copy2.begin (i),
212- distributed_vector_copy2.end (i),
213- bc::make_constant_iterator (value),
214- distributed_queue2.get (i)
215- )
216- );
217- BOOST_CHECK (
218- bc::equal (
219- distributed_vector_copy3.begin (i),
220- distributed_vector_copy3.end (i),
221- bc::make_constant_iterator (value),
222- distributed_queue2.get (i)
223- )
224- );
225- }
168+ BOOST_CHECK (
169+ distributed_equal (distributed_vector, value, distributed_queue1)
170+ );
171+ BOOST_CHECK (
172+ distributed_equal (distributed_vector_copy1, value, distributed_queue1)
173+ );
174+ BOOST_CHECK (
175+ distributed_equal (distributed_vector_copy2, value, distributed_queue2)
176+ );
177+ BOOST_CHECK (
178+ distributed_equal (distributed_vector_copy3, value, distributed_queue2)
179+ );
226180}
227181
228182BOOST_AUTO_TEST_CASE (at)
229183{
230- std::vector<bc::command_queue> queues;
231- queues.push_back (queue);
232- queues.push_back (queue);
233- bc::distributed::command_queue distributed_queue (queues);
184+ // construct distributed::command_queue
185+ bc::distributed::command_queue distributed_queue =
186+ get_distributed_queue (queue);
234187
235188 bc::distributed::vector<bc::uint_> distributed_vector (
236189 size_t (64 ), bc::uint_ (64 ), distributed_queue
@@ -263,10 +216,9 @@ BOOST_AUTO_TEST_CASE(at)
263216
264217BOOST_AUTO_TEST_CASE (subscript_operator)
265218{
266- std::vector<bc::command_queue> queues;
267- queues.push_back (queue);
268- queues.push_back (queue);
269- bc::distributed::command_queue distributed_queue (queues);
219+ // construct distributed::command_queue
220+ bc::distributed::command_queue distributed_queue =
221+ get_distributed_queue (queue);
270222
271223 bc::distributed::vector<bc::uint_> distributed_vector (
272224 size_t (64 ), bc::uint_ (64 ), distributed_queue
0 commit comments