Altera_Forum
Honored Contributor
8 years agoData sharing among various kernels
Hello,
I have tried working with read and write channels to pass data from one kernel to other. I wanted to know, whether a global variable can be shared by various kernels to pass the data. I have written a small program below indicating channel transfer. But is possible to transfer using shared global variables? # pragma OPENCL EXTENSION cl_intel_channels : enable channel float data_ch __attribute__((depth(0))); __kernel void Pipe_in(__global float *restrict x, __global float *restrict check) { // Get index of the work item uint count; for (count = 0; count<10; count++){ write_channel_intel(data_ch, x[count]); check[count] = x[count]; } } __kernel void Pipe_out(__global float *restrict y) { // Get index of the work item uint count; for (count = 0; count<10; count++) y[count] = read_channel_intel(data_ch); }