| View previous topic :: View next topic |
| Author |
Message |
Tuan
Joined: 11 Jun 2009 Posts: 226
|
Posted: Thu Feb 04, 2010 9:21 am Post subject: atomic min/max for real data |
|
|
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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Thu Feb 04, 2010 10:07 am Post subject: |
|
|
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 |
|
 |
Tuan
Joined: 11 Jun 2009 Posts: 226
|
Posted: Thu Feb 04, 2010 10:08 am Post subject: |
|
|
| 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 |
|
 |
mkcolg
Joined: 30 Jun 2004 Posts: 4996 Location: The Portland Group Inc.
|
Posted: Thu Feb 04, 2010 10:18 am Post subject: |
|
|
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 |
|
 |
Tuan
Joined: 11 Jun 2009 Posts: 226
|
Posted: Wed Feb 10, 2010 3:10 pm Post subject: |
|
|
| 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 |
|
 |
|