本文整理汇总了C++中cl::CommandQueue::enqueueBarrier方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandQueue::enqueueBarrier方法的具体用法?C++ CommandQueue::enqueueBarrier怎么用?C++ CommandQueue::enqueueBarrier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cl::CommandQueue
的用法示例。
在下文中一共展示了CommandQueue::enqueueBarrier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: watershed
//.........这里部分代码省略.........
increment_kernel.setArg(2, height);
#ifdef OPENCL_PROFILE
{
VECTOR_CLASS<cl::Event> events_vector(1);
status = queue.enqueueNDRangeKernel(increment_kernel, cl::NullRange,
global, local, __null,
&events_vector[0]);
cl::WaitForEvents(events_vector);
cl::Event& event = events_vector[0];
cl_ulong start = event.getProfilingInfo<CL_PROFILING_COMMAND_START>();
cl_ulong end = event.getProfilingInfo<CL_PROFILING_COMMAND_END>();
cl_ulong total_time = end - start;
watershed_increment_kernel_time = total_time;
}
#else
status = queue.enqueueNDRangeKernel(increment_kernel, cl::NullRange,
global, local);
#endif
// queue.enqueueBarrier();
/* PREPARING MINIMA KERNEL */
int counter_tmp = 0;
cl::Buffer counter(context, CL_MEM_READ_WRITE, sizeof(int));
queue.enqueueWriteBuffer(counter, CL_TRUE, 0, sizeof(int), &counter_tmp);
queue.enqueueBarrier();
minima_kernel.setArg(0, counter);
minima_kernel.setArg(1, labeled);
minima_kernel.setArg(2, cl_neighbourhood_x);
minima_kernel.setArg(3, cl_neighbourhood_y);
minima_kernel.setArg(4, local_mem);
minima_kernel.setArg(5, width);
minima_kernel.setArg(6, height);
int old_val = -1;
int new_val = -2;
int c = 0;
while(old_val != new_val)
{
old_val = new_val;
#ifdef OPENCL_PROFILE
{
VECTOR_CLASS<cl::Event> events_vector(1);
status = queue.enqueueNDRangeKernel(minima_kernel, cl::NullRange,
global, local, __null,
&events_vector[0]);
cl::WaitForEvents(events_vector);
cl::Event& event = events_vector[0];
cl_ulong start = event.getProfilingInfo<CL_PROFILING_COMMAND_START>();
cl_ulong end = event.getProfilingInfo<CL_PROFILING_COMMAND_END>();
cl_ulong total_time = end - start;
watershed_minima_kernel_time += total_time;