PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

atomic min/max for real data
Goto page 1, 2  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Accelerator Programming
View previous topic :: View next topic  
Author Message
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Thu Feb 04, 2010 9:21 am    Post subject: atomic min/max for real data Reply with quote

Currently, atomic min only works for INTEGER data. So, for real data, what is your suggestion, if I want to find the min value from an array with each element is processed by an instance of the kernel.



Tuan
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Feb 04, 2010 10:07 am    Post subject: Reply with quote

Hi Tuan,

Atomic operations need hardware support and Nvidia doesn't support atomicmin operations floats, so were limited as to what we can do here. Do you really need the operation to be atomic or could the elemental min function work?

- Mat
Back to top
View user's profile
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Thu Feb 04, 2010 10:08 am    Post subject: Reply with quote

mkcolg wrote:
Hi Tuan,

Atomic operations need hardware support and Nvidia doesn't support atomicmin operations floats, so were limited as to what we can do here. Do you really need the operation to be atomic or could the elemental min function work?

- Mat


Elemental min function working is good. Do you have any suggestion, Mat?

Tuan
Back to top
View user's profile
mkcolg



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

PostPosted: Thu Feb 04, 2010 10:18 am    Post subject: Reply with quote

If the elemental min function works, then I'd use it. If you must use the atomic min, then you'd need to change your array from REAL to INTEGER*4.

- Mat
Back to top
View user's profile
Tuan



Joined: 11 Jun 2009
Posts: 233

PostPosted: Wed Feb 10, 2010 3:10 pm    Post subject: Reply with quote

mkcolg wrote:
If the elemental min function works, then I'd use it. If you must use the atomic min, then you'd need to change your array from REAL to INTEGER*4.

- Mat

Hi Mat,

The reason is that i want the min to work on GPU. However, I'm not sure if the elemental min guarantee the true minimum value among the threads? Could you please confirm this.

Example: suppose minval was assigned the MAXIMUM value before calling to the subroutine

Code:
attributes(global) subroutine foo(A, N, minval)
 real, dimension(N,N) :: A
 real :: minval

 idx = threadIdx%x;
 if (idx .le. N) then
   min1 = min(A(idx,:))
   minval = min(min1, minval)
 endif

end subroutine

Tuan
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 1, 2  Next
Page 1 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