void generate(OutputIterator first, OutputIterator last, command_queue &queue) { const size_t size = detail::iterator_range_size(first, last); kernel fill_kernel(m_program, "fill"); fill_kernel.set_arg(0, m_state_buffer); fill_kernel.set_arg(2, first.get_buffer()); size_t offset = 0; size_t &p = m_state_index; for(;;){ size_t count = 0; if(size > n){ count = n; } else { count = size; } fill_kernel.set_arg(1, static_cast<const uint_>(p)); fill_kernel.set_arg(3, static_cast<const uint_>(offset)); queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0); p += count; offset += count; if(offset >= size){ break; } generate_state(queue); p = 0; } }
void fill(OutputIterator first, OutputIterator last, command_queue &queue) { const buffer &buffer = first.get_buffer(); const size_t size = detail::iterator_range_size(first, last); kernel fill_kernel(m_program, "fill"); fill_kernel.set_arg(0, m_state_buffer); fill_kernel.set_arg(1, buffer); size_t p = 0; for(;;){ size_t count = 0; if(size - p >= n) count = n; else count = size - p; fill_kernel.set_arg(2, static_cast<uint_>(p)); queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0); p += n; if(p >= size) break; generate_state(queue); } }
void generate(OutputIterator first, OutputIterator last, command_queue &queue) { size_t size = detail::iterator_range_size(first, last); kernel fill_kernel(m_program, "fill"); fill_kernel.set_arg(1, m_multiplicands); fill_kernel.set_arg(2, first.get_buffer()); size_t offset = 0; for(;;){ size_t count = 0; if(size > threads){ count = threads; } else { count = size; } fill_kernel.set_arg(0, static_cast<const uint_>(m_seed)); fill_kernel.set_arg(3, static_cast<const uint_>(offset)); queue.enqueue_1d_range_kernel(fill_kernel, 0, count, 0); offset += count; if(offset >= size){ break; } update_seed(queue); } }