PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

complex sine?
Goto page Previous  1, 2, 3  Next
 
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 Mar 09, 2012 12:30 pm    Post subject: Reply with quote

Hi Jan,
Quote:
Can you point me to some examples for calling functions from a kernel?

The "sgemm.cuf" example that comes with the compilers uses a basic "device" subrouitne which might help. It's located in "$PGI/<os>/<pgi_release>/etc/samples" (i.e. /opt/pgi/linux86-64/12.3/etc/samples/sgemm.cuf on 64-bit Linux).

- Mat
Back to top
View user's profile
jand



Joined: 17 Aug 2008
Posts: 57

PostPosted: Fri Mar 09, 2012 3:00 pm    Post subject: Reply with quote

Thanks theMatt and Mat. The examples were helpful, I have it working now.

-Jan
Back to top
View user's profile
jand



Joined: 17 Aug 2008
Posts: 57

PostPosted: Sun Mar 11, 2012 9:09 am    Post subject: complex intrinsics Reply with quote

Hi Mat,

I have implemented my own trigonometric functions for complex numbers now. However, please still let me know what plans are to implement them as intrinsics. I am interested, since I am not very good at writing ultra efficient code. The kind of computations I am doing have hundreds of thousands of calls to TAN, ATAN, SIN, ASIN, COS, ACOS, all for complex numbers. If would be great to have efficient intrinsics available for these in future releases.

Cheers, Jan
Back to top
View user's profile
jand



Joined: 17 Aug 2008
Posts: 57

PostPosted: Wed Jun 06, 2012 9:17 am    Post subject: complex intrinsics Reply with quote

Hi,

I was wondering if there were any updates on complex number support for intrinsic functions.

Thanks, Jan
Back to top
View user's profile
TheMatt



Joined: 06 Jul 2009
Posts: 317
Location: Greenbelt, MD

PostPosted: Wed Jun 06, 2012 11:49 am    Post subject: Re: complex intrinsics Reply with quote

jand wrote:
Hi,

I was wondering if there were any updates on complex number support for intrinsic functions.

Thanks, Jan


This isn't official, but sin at least seems to work in accelerator pragma space:
Code:
(246) > cat test.F90
program test

implicit none

complex, dimension(10,10) :: theta,sintheta,hostsintheta
integer :: i, j

do i = 1, 10
   do j = 1, 10
      theta(i,j) = cmplx(real(i),real(j))
   end do
end do

hostsintheta = sin(theta)

!$acc region
do i = 1, 10
   do j = 1, 10
      sintheta(i,j) = sin(theta(i,j))
   end do
end do
!$acc end region

write (*,*) 'sin(theta) on accelerator: ', sintheta(1,:)
write (*,*) 'sin(theta) on host       : ', hostsintheta(1,:)

end program test
(247) > pgfortran -ta=nvidia,time -Minfo=all test.F90
test:
     16, Generating copyout(sintheta(:,:))
         Generating copyin(theta(:,:))
         Generating compute capability 1.0 binary
         Generating compute capability 2.0 binary
     17, Loop is parallelizable
     18, Loop is parallelizable
         Accelerator kernel generated
         17, !$acc do parallel, vector(10) ! blockidx%x threadidx%x
         18, !$acc do parallel, vector(10) ! blockidx%y threadidx%y
             CC 1.0 : 15 registers; 40 shared, 160 constant, 56 local memory bytes
             CC 2.0 : 20 registers; 8 shared, 140 constant, 4 local memory bytes
(248) > ./a.out
 sin(theta) on accelerator:   (1.298458,0.6349639)  (3.165779,1.959601) 
 (8.471646,5.412681)  (22.97909,14.74480)  (62.44553,40.09216) 
 (169.7379,108.9861)  (461.3929,296.2565)  (1254.195,805.3091) 
 (3409.255,2189.057)  (9267.316,5950.475)
 sin(theta) on host       :   (1.298458,0.6349639)  (3.165779,1.959601) 
 (8.471645,5.412681)  (22.97909,14.74480)  (62.44552,40.09216) 
 (169.7379,108.9861)  (461.3929,296.2564)  (1254.195,805.3091) 
 (3409.255,2189.057)  (9267.316,5950.475)

Accelerator Kernel Timing data
/home/mathomp4/F90Files/ComplexSin/test.F90
  test
    16: region entered 1 time
        time(us): total=314182 init=313134 region=1048
                  kernels=27 data=145
        w/o init: total=1048 max=1048 min=1048 avg=1048
        18: kernel launched 1 times
            grid: [1]  block: [10x10]
            time(us): total=27 max=27 min=27 avg=27
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, 3  Next
Page 2 of 3

 
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