PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Course

How to manage Register Memory in Fortran?

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
AxelDente



Joined: 10 Dec 2009
Posts: 2

PostPosted: Fri Dec 11, 2009 7:27 pm    Post subject: How to manage Register Memory in Fortran? Reply with quote

I need to manage the register memory in fortran. I donīt know how to do it.

Iīm have started to program with cuda and I will use this memory in order to set local variables for each thread. I know that using C it is posible, but i do not know how to do it in Fortran.

Here I will show why I need the register variable. If there is another way to do it I will appreciate.
-----------------------------
attributes(global) subroutine trotter(N,p,a)

integer :: i,tx,idev
integer, value :: N
complex(8),device :: p(N),a(N,3)

complex(8) :: aux1,aux2 !--> I need this variable to be at each thread

tx=threadidx%x
idev=(blockidx%x-1)*512*10

do i=1,9,2 !-> I'm Trying to make this do statement in each thread

aux1=p(idev+i)
aux2=p(idev+i+1)

p(idev+i) =a(idev+i,1)*aux1+a(idev+i,2)*aux2
p(idev+i+1)=a(idev+i,1)*aux2+a(idev+i,2)*aux1

end do
!!!! I cut the rest of the program but this donīt change anything.

end subroutine

Iīm newbie in programing, by this reason perhaps the program is not efficient at all and I don't know if it is working properly.

Thanks Very much.
Back to top
View user's profile
cgorac



Joined: 30 Nov 2009
Posts: 5

PostPosted: Sat Dec 12, 2009 1:03 am    Post subject: Reply with quote

I don't fully understand what your code is trying to do, so I cannot comment much on it. But as far as registers usage concerned: CUDA compilers will usually try to put each of your kernel local variables into registers. You should always check the number of registers used after your code is compiled, as you'd have to adjust the block size to this number - if too many registers used, then you'd have to decrease the number of threads in block, as otherwise your kernel won't get launched. But in that case, and in general, you should try to utilize shared memory too - it is as fast as registers, it makes it possible to decrease the registers usage by your kernel, and sometimes it makes it easier to coalesce global memory accesses than what is the case when you read data from global memory directly into registers.
Back to top
View user's profile
AxelDente



Joined: 10 Dec 2009
Posts: 2

PostPosted: Mon Dec 14, 2009 6:28 am    Post subject: Reply with quote

thanks very much for your responce. It was helpfull now I have to try.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
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