清除 OpenCL 管道

Clearing OpenCL pipes

我正在使用 OCL 管道跨内核传递数据,但每次传递后都需要清除管道以便新数据可以进入。是否有可能以某种方式清除每个 运行 或每次我使用 'write_pipe' 函数时它会自动清除吗?

我基本上是这样做的,理想情况下我只会使用一根管道:

kernel1{
 //read data from host, then write to pipe
}

do..x times
kernel2{
 //read pipe
 //calculations
 //write pipe
}

kernel3{
 //read pipe
 //write to host
}

A pipe 是一个 FIFO 内存对象,一旦读取就会被清除。

另请注意,给定的内核可以读取或写入管道,但不能同时读取。

您可以阅读有关管道的更多信息 + 示例 here