Forum Discussion
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 ...
Altera_Forum
Honored Contributor
8 years agoShould the global buffer be defined as the argument in one of the kernel? Because when I define __global float share[10] in Pipe_in kernel (below program), i end up with errors.
# 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 __global float share[10]; uint count; for (count = 0; count<10; count++){ write_channel_intel(data_ch, x[count]); share[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] = share[count]; }