why can't I use __sin() in the kernel,but sin() is OK

hello,I’m a new user of CUDA.

my kernel is

[codebox]global void test(float *a)

{

*a=__sin(*a);

}[/codebox]

and call this kernel from host,but when I compile, it come up with the error: “calling a host function from a device/global function is only allowed in device emulation mode”,and when I replace the __sin() with sin(), it is ok!

Why? thank you!

hello,I’m a new user of CUDA.

my kernel is

[codebox]global void test(float *a)

{

*a=__sin(*a);

}[/codebox]

and call this kernel from host,but when I compile, it come up with the error: “calling a host function from a device/global function is only allowed in device emulation mode”,and when I replace the __sin() with sin(), it is ok!

Why? thank you!

What you’re looking for is the 32 bit __sinf()!!

What you’re looking for is the 32 bit __sinf()!!

You are right!Thank you very much!

You are right!Thank you very much!

thou shall not sin(), for it is __sinf() you seek. And the cuda programming guide said: behold __sinf(), for it is faster. And there was much rejoicing :)

( sorry for inappropriate references)

thou shall not sin(), for it is __sinf() you seek. And the cuda programming guide said: behold __sinf(), for it is faster. And there was much rejoicing :)

( sorry for inappropriate references)

thank you!

thank you!

Good one… :-)

Good one… :-)