Hello
I have a problem defining complex numbers in my kernel.
See my attached code.
I get the following error when compiling the kernel:
/tmp/OCL3OF8Ri.cl(13): error: this declaration has no storage class or type
specifier
complex float data[40];
^
/tmp/OCL3OF8Ri.cl(13): error: expected a ";"
complex float data[40];
^
I might have misunderstood the type declaration stated in the OpenCL api reference guide. Could anyone lead me to the right track?
typedef struct gf { complex float data[40]; } gaborFeature; __kernel void fub(__global int bar) { }
Complex is not supported currently.
Oh.. Any eta when it will be supported?
Working on a project, which rely heavily on complex variables.
I actually thought amd stream supports OpenCL 1.0. But it is still a beta?
Complex is not part of the core OpenCL 1.0.
Thx for your help omkaranathan.
Well do you know a place where I can see all the things AMD stream differentiate from:
http://www.khronos.org/opencl/sdk/1.0/docs/man/xhtml/
Well thanks for you explanation.
That explains the reserved part of the API. Actually I though it was just "reserved" data types, which you were not allowed to reimplement.
Hi,
I have a same problem as someone posted long ago. Is complex data type supported now with OpenCL 1.1?
Thanks.
Richeek
well, for now you will have to define your own complex type (maybe a float2) and overload the operators like *, /, fabs and all others you will need.
Originally posted by: laobrasuca well, for now you will have to define your own complex type (maybe a float2) and overload the operators like *, /, fabs and all others you will need.
Are you sure operator overloading is supported? I tried to overload * but it did not work for me, so I did something like this:
typedef struct my_comp
{
float2 data;
} comp;
comp mul(comp num1, comp num2)
{
comp temp;
temp.data.x = num1.data.x*num2.data.x - num1.data.y*num2.data.y;
temp.data.y = num1.data.x*num2.data.y + num1.data.y*num2.data.x;
return temp;
}
I tried to overload like this:
comp operator*(comp num1, comp num2)
{
comp temp;
temp.data.x = num1.data.x*num2.data.x - num1.data.y*num2.data.y;
temp.data.y = num1.data.x*num2.data.y + num1.data.y*num2.data.x;
return temp;
}
Please let me know if this is not the right way?
regards,
Richeek
OpenCL C is, like the name suggests, like C, it is not C++. Overloading is not supported in C at all, let alone operator overloading.
I mean, in the next opencl c++ support release xD