PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

12.6 release
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
mkcolg



Joined: 30 Jun 2004
Posts: 6134
Location: The Portland Group Inc.

PostPosted: Fri Jul 27, 2012 9:22 am    Post subject: Reply with quote

Hi Jan,

Looks like we did get the "degree" intrinsics (asin, tan, etc) into 12.6, but only for reals and double precision. I put in a feature request (TPR#18845) to have complex version added.

- Mat
Back to top
View user's profile
Michael Wolfe



Joined: 19 Jan 2010
Posts: 42

PostPosted: Thu Aug 02, 2012 3:59 pm    Post subject: Reply with quote

Hmmm... acos, asin, atan, atan2, cosh, sinh, tan, tanh are only defined for real arguments, not for complex.

We have not implemented the degree versions of complex versions of cos, sin, etc., on the host or on the accelerator. We are looking into this.
Back to top
View user's profile
jand



Joined: 17 Aug 2008
Posts: 57

PostPosted: Sat Aug 04, 2012 7:23 am    Post subject: Reply with quote

Hi Michael,

For example, the tan of complex values is defined as here:
http://planetmath.org/encyclopedia/9074.html

I currently compute it in a device subroutine like this:
Code:

z  = -cis_dev*(EXP( z3 ) -EXP(-z3))/(EXP(z3)+EXP(-z3))

where
Code:
cis_dev=CMPLX(0.,1.)


I have noticed that pgfortran on cpu does not have all intrinsics implemented for complex values. I am pretty sure that the intel fortran compiler has at least tan.

For acos and asin, see here:
http://planetmath.org/encyclopedia/GoniometricFormula.html

I currently compute acos in a device function like this:
Code:

zrp1 = REAL(z,SP)+1._SP
zrm1 = zrp1-2._SP
zi = AIMAG(z)
zizi = zi*zi
a1 = 0.5_SP*SQRT(zrp1*zrp1 + zizi)
a2 = 0.5_SP*SQRT(zrm1*zrm1 + zizi)
a = a1+a2
b = a1- a2
IF(zi >= 0._SP)THEN
   z = ACOS(b) - cis_dev*LOG(a + SQRT(a*a - 1._SP))
ELSE
   z = ACOS(b) + cis_dev*LOG(a + SQRT(a*a - 1._SP))
ENDIF


I am sure that my implementations are not very efficient, so it would be great to see these supported on GPUs.

Thanks, Jan
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group