@@ -54,31 +54,32 @@ int main(int argc, char *argv[])
5454 int wanted = rand_int_max + 1 ;
5555
5656 // device iterator
57- boost::compute::vector<int >::iterator device_it ;
57+ boost::compute::vector<int >::iterator device_result_it ;
5858
5959 perf_timer t;
6060 for (size_t trial = 0 ; trial < PERF_TRIALS; trial++){
6161 t.start ();
62- device_it = boost::compute::find (
63- device_vector.begin (), device_vector.end (), wanted, queue
64- );
62+ device_result_it = boost::compute::find (device_vector.begin (),
63+ device_vector.end (),
64+ wanted,
65+ queue);
6566 queue.finish ();
6667 t.stop ();
6768 }
6869 std::cout << " time: " << t.min_time () / 1e6 << " ms" << std::endl;
6970
7071 // verify if found index is correct by comparing it with std::find() result
71- size_t host_index = std::distance (host_vector.begin (),
72- std::find (host_vector.begin (),
73- host_vector.end (),
74- wanted));
75- size_t device_index = device_it .get_index ();
72+ size_t host_result_index = std::distance (host_vector.begin (),
73+ std::find (host_vector.begin (),
74+ host_vector.end (),
75+ wanted));
76+ size_t device_result_index = device_result_it .get_index ();
7677
77- if (device_index != host_index ){
78+ if (device_result_index != host_result_index ){
7879 std::cout << " ERROR: "
79- << " device_index (" << device_index << " ) "
80+ << " device_result_index (" << device_result_index << " ) "
8081 << " != "
81- << " host_index (" << host_index << " )"
82+ << " host_result_index (" << host_result_index << " )"
8283 << std::endl;
8384 return -1 ;
8485 }
0 commit comments