Hi all,

I consider myself a newbie of GPU programming so…

I developed a CUDA code for audio convolution.

It’s quite straightforward because basically you need to do an fft of the inputs, then perform pointwise multiplication and then ifft.

Now what I need is a “porting” to OpenCL.

I’m mostly done except for the pointwise multiplication. I have to write the kernel by myself and i’m trying to “emulate” the CUDA implementation but…

It’s kinda complicate to because writing kernels in OpenCL is far more complex than with CUDA.

Can someone gives me some advices?

Here is the original code.

```
////////////////////////////////////////////////////////////////////////////////
// Complex operations
////////////////////////////////////////////////////////////////////////////////
// Complex multiplication
static __device__ __host__ inline cufftComplex ComplexMul(cufftComplex a, cufftComplex b)
{
cufftComplex c;
c.x = a.x * b.x - a.y * b.y;
c.y = a.x * b.y + a.y * b.x;
return c;
}
// Complex pointwise multiplication
// Based on ComplexPointwiseMulAndScale but without scaling... It creates more problems than it solves...
static __global__ void ComplexPointwiseMul(cufftComplex* a, const cufftComplex* b, int size)
{
const int numThreads = blockDim.x * gridDim.x;
const int threadID = blockIdx.x * blockDim.x + threadIdx.x;
for (int i = threadID; i < size; i += numThreads)
a[i] =ComplexMul(a[i], b[i]);
}
```

Bests.