AnsweredAssumed Answered

Best way to pass 3D vector fields to the kernel

Question asked by cipoint on Feb 8, 2013
Latest reply on Feb 12, 2013 by himanshu.gautam

Hello,

 

What's the best / most efficient way to pass three dimensional vector fields to the kernel? My current solution is to pass the data (float or double arrays) as a 1D array in this order:

 

X_000 Y_000 Z_000 X_001 Y_001 Z_001 ... X_010 Y_010 Z_010 X_011 Y_011 Z_011 ...

 

Inside the kernel I have to manipulate the vector field on each side, so I create 3D-data types lie following

 

(float3) V = dataInput[nx + Nx * ny + Nx * Ny * nz]

 

where nx = get_global_id(0), Nx = get_global_size(0) and so on.

 

Is there a better way to do this? Unfortunately I can't use vectorial data types directly in the definition of the kernel arguments because OpenCL internally uses float4 for float3 variables ...

Outcomes