Issue with trigonometric functions

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue with trigonometric functions

Abimael

Hi
I am experiencing some issues with sin , cos  functions .. The workaround is use native_sin and native_cos.
But I have issue with acos as well.
And there is no workaround.

There is no error message, but I see that the OPENCL just does not execute the line .
I just realized the issues when I got values that I really do not expect.
Them I started a very boring "debug" steps : write one of the cell in the buffer with a value that I previous know, run the opencl program,
set another buffer cell with a  trigonometric result (ie. acos(alpha)  , check results ..
I realized that acos does not work properly.
I know that the argument should be in radians .

Does anybody have the same or similar issues ?

As I did a lot of changes, I really do not recall if the code had worked previsously.. I guess that it worked , but I am not sure.. So , I decided post a message here to share and hear from others ..
Thank you .. ANy comment and help is welcome .
Regards  
Reply | Threaded
Open this post in threaded view
|

Re: Issue with trigonometric functions

Michael Bien

On 10/12/2011 02:26 AM, Abimael [via jogamp] wrote:

> Hi
> I am experiencing some issues with sin , cos  functions .. The workaround is
> use native_sin and native_cos.
> But I have issue with acos as well.
> And there is no workaround.
>
> There is no error message, but I see that the OPENCL just does not execute
> the line .
> I just realized the issues when I got values that I really do not expect.
> Them I started a very boring "debug" steps : write one of the cell in the
> buffer with a value that I previous know, run the opencl program,
> set another buffer cell with a  trigonometric result (ie. acos(alpha)  ,
> check results ..
> I realized that acos does not work properly.
> I know that the argument should be in radians .
>
> Does anybody have the same or similar issues ?
>
> As I did a lot of changes, I really do not recall if the code had worked
> previsously.. I guess that it worked , but I am not sure.. So , I decided
> post a message here to share and hear from others ..
> Thank you .. ANy comment and help is welcome .
> Regards
>

hi,

i haven't had any issues yet with the basic math functions. BTW most
implementations support the printf extension. I often use it for
debugging (small workgroup sizes, 1 if possible).

If you think this is a bug in the CL impl, try to make a small testcase
and post it to the vendor specific forums or directly to the bug tracker.

regards,
michael


--
http://michael-bien.com/

Reply | Threaded
Open this post in threaded view
|

Re: Issue with trigonometric functions

notzed
In reply to this post by Abimael
The only 'gotchas' i can think of is using double arithmetic without enabling the double extension, and/or some sort of problem with the code that reads/writes the buffers between host/device.

My rule of thumb is: if i think i've found a bug in the opencl implementation, i haven't found all the bugs in my code yet.

If you can't work it out post an example to the appropriate vendor forum.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with trigonometric functions

Abimael
In reply to this post by Michael Bien

Hi
Thank you by your reply..
I did a simple test and looks that acos and asin are fine.
So, my conclusion is that my CL program is not correct , but the "weird thing " is that I do not get any error message..
It seems that the argument for the acos is "wrong" or "not correct " and acos does not return the proper value and , (that's weird) seems that it "does not execute" or does not retrieve the value ..
I really do  not know and still investigating..

Thank you very much again
Reply | Threaded
Open this post in threaded view
|

Re: Issue with trigonometric functions

Abimael

.. sorry , I guess I forgot notzed :
 I think you are right.. Most probably my code has bugs..
I am going to investigate more properly and see if  I detect the error..

about double extension ; I am not using double numbers.. only float..

Anyway, I need to investigate to realize what and where is the issue..
thank you by your comments.
Reply | Threaded
Open this post in threaded view
|

Re: Issue with trigonometric functions

Neil
In reply to this post by Abimael
>I realized that acos does not work properly.
> I know that the argument should be in radians .

Surely the result is in radians?  The argument is a cosine in the range [-1,1]

HTH
Neil