cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

alexaverbuch
Journeyman III

Error when using fabs() with double

When running the code below I get this error:

symbol lookup error: /tmp/OCLvOO1aF.so: undefined symbol: __fabs_f64

Does the AMD OpenCL implementation actually overload fabs() to accept double datatypes?

double x = -1; fabs(x);

0 Likes
12 Replies
alexaverbuch
Journeyman III

For the record...

This still happens when I do this:

 

#pragma OPENCL EXTENSION cl_khr_fp64 : enable __kernel void edgeDetectKernel( __global uint4 * input,

0 Likes

When calling the code below, the result is:

"Extensions:        1.0"

Does this mean anything?

clGetDeviceInfo(devices, CL_DEVICE_EXTENSIONS, sizeof(param), param, &ret_size); printf("\tExtensions:\t\t%s\n", param);

0 Likes
MicahVillmow
Staff

double is not supported in our OpenCL. You need to query the device to make sure that double is supported before attempting to compile a kernel with doubles.
0 Likes

Will double precision support be added soon? Considering the Radeon HD 5870 has more than 500 GFlops double precision performance, I'm assuming the GPU implementation will at least have it?

0 Likes
MicahVillmow
Staff

dravisher,
Although the HD5800 does have double operations in hardware, in order to correctly support the double extension, the double math library must also be supported along with high degree of accuracy. Not all of these exist in hardware, so they must be implemented in software. This is the reason that double is not supported and probably will not be done 'soon'.
0 Likes

OK, thanks... so now I've changed my calculations to integers and I get strangeness with the "abs" function.

When using an int as in the code below I get a printout of:

[temp=-12345][abs(temp)=12345]

Nice

When using a long as in the code below I get a printout of:

[temp=-12345][abs(temp)=-1]

Not nice!

As far as I can tell, the documentation states that abs() supports long data types too


Is this a bug? Or am I missing something?

int tempInt = -12345; printf("[temp=%d][abs(temp)=%d]\n",tempInt, abs(tempInt)); long tempLong = -12345; printf("[temp=%d][abs(temp)=%d]\n",tempLong, abs(tempLong));

0 Likes

Which SDK release are you using? Also, could you post your complete kernel code?

 

0 Likes

Beta 2.0... I know, I should switch to 3.0... maybe later this week

Sorry I dont have time to post a kernel now... late for class! 

It was actually just tested by commenting out my entire kernel and inserting the lines I mentioned above.

0 Likes

try '%ld' instead of '%d' to print long variable.

Are you able to use 'printf' inside the kernel without any issues?

0 Likes

'%ld' results in the same output, still incorrect

printf works in the kernel code, I'm very grateful for that!

0 Likes

Originally posted by: alexaverbuch '%ld' results in the same output, still incorrect

I am getting correct results with long datatype, doing printing at host side though. 

 

printf works in the kernel code, I'm very grateful for that!

 

Did it work by default?



0 Likes

To clarify about DPFP support in OpenCL:

It is not currently in the OpenCL beta release. We start introducing various pieces of DPFP support in OpenCL over the next year. Some of the basic arithmetic functions will be introduced first with the math function support likely taking longer. Since full DPFP support is an optional extension in the OpenCL spec, we are concentrating first improving the performance and other aspects of the required spec first.

Michael.

0 Likes