PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Using atomic memory functions
Goto page Previous  1, 2, 3, 4, 5  Next
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Wed Oct 24, 2012 6:47 am    Post subject: Reply with quote

Hi Brentl,

I can't seem to get it working with real*8.. it works for integers fine though.

I get the following compiler error:

Quote:
Could not resolve generic procedure atomicadd


And that's compiling with version 12.8.

Have you actually tried this and got it to work?

Cheers,
Crip_crop
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Wed Oct 24, 2012 6:48 am    Post subject: Reply with quote

Also could any of you PGI guys please verify what Brentl is saying please?

Cheers,
Crip_crop
Back to top
View user's profile
brentl



Joined: 20 Jul 2004
Posts: 108

PostPosted: Wed Oct 24, 2012 9:01 am    Post subject: Reply with quote

Are you sure you are using 12.8?

brentl> pgf90 -V12.8 atomd1.cuf
brentl> ./a.out
528.0000000000000 528.0000000000000
TEST PASSED

brentl> pgf90 -V12.6 atomd1.cuf
PGF90-S-0155-Could not resolve generic procedure atomicadd (atomd1.cuf: 7)
0 inform, 0 warnings, 1 severes, 0 fatal for testatomicdadd

brentl> cat atomd1.cuf
module atomictests
contains
attributes(global) subroutine testatomicdadd( a )
real*8, device :: a
real*8 r
r = dble(threadIdx%x)
istat = atomicadd(a, r)
return
end subroutine testatomicdadd
end module atomictests

program t
use cudafor
use atomictests
real*8, allocatable, device :: r
real*8 x

allocate(r)
r = 0
n = 32
call testatomicdadd<<<1,n>>> (r)
x = r
print *,x,dble(n*(n+1)/2)
if (x .eq. dble(n*(n+1)/2)) then
print *,"TEST PASSED"
else
print *,"TEST FAILED"
endif
end
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Wed Oct 24, 2012 11:13 am    Post subject: Reply with quote

Hazzaaaaar! It works... all I can think of is that I wasn't correctly linking to the 12.8 version.

Thank you so much brentl, you really have made my week!

Cheers,
Crip_crop
Back to top
View user's profile
crip_crop



Joined: 28 Jul 2010
Posts: 68

PostPosted: Thu Oct 25, 2012 5:23 am    Post subject: Reply with quote

atomicadd is working just fine with double precision variables but I can't seem to get atomicsub to follow suit.

Do you know if this has been extended to handle double precision or not?

I also tried a work around, so instead of:
Code:

 istat=atomicsub(htot(ij,1),temp)


I attempted to make temp negative and use atomicadd
Code:

istat=atomicadd(htot(ij,1),-temp)


but this didn't work and gave an incorrect result.

Any ideas for an alternative work around if atomicsub has in fact not been extended to support double precision would be much appreciated.

Cheers,
Crip_crop
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
Goto page Previous  1, 2, 3, 4, 5  Next
Page 4 of 5

 
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