Undefined reference to `atomicaddd' using emulation mode

Hi there,

ever since I included the atomicadd function in my GPU code I’ve not been able to compile the code to use emulation mode.

I get the following error:

Undefined reference to `atomicaddd’

I’m using the function to accumulate double precision values in to a double precision array. It works perfectly on the GPU but I need to use the emulation mode to debug another part of the code.

Is this a compiler bug?


Hi Crip Crop,

Looks like our compiler team missed adding this one to the emulation library. We’ll get it into 13.0. In the meantime we can send you an object file you can link with. Let me know if you want to wait or if you want me to send you the file.


Please can you send me the object file. Do you need me to send you an email? I don’t want to put my email on this thread.


Hi Crip Crop,

Actually, it looks like we did get this into 12.10. Are you able to update your compiler version? If not, I can send you the object (I can get your email address).

  • Mat

I should be able to get an update from IT services… I’ll let you know if I can’t.

Hi there,

I managed to get the 12.10 update and have installed it. I’m not longer getting the

undefined reference to > atomicadd

error when I compile but the error most certainly hasn’t been fixed. When I try to run my code in emulation mode the result I get is zero. So I presume that although the compiler is recognizing the function it still doesn’t know what to do with it when in emulation mode and so nothing gets added in to my array.

Will this be fixed in the next release?


You’ll have to show me how you use it. It works for me:

brentl@woodchuck:~/simple/cuda/qa> pgf90 -V12.10 -Mcuda=emu atomd2.cuf
brentl@woodchuck:~/simple/cuda/qa> ./a.out
32896.00000000000 32896.00000000000
brentl@woodchuck:~/simple/cuda/qa> cat atomd2.cuf
module atomictests
attributes(global) subroutine testatomicdadd( a )
real8, device :: a
8 r
r = dble((blockIdx%x-1) * blockDim%x + threadIdx%x)
istat = atomicadd(a, r)
end subroutine testatomicdadd
end module atomictests

program t
use cudafor
use atomictests
real8, device :: r
8 x
n = 256
r = 0
call testatomicdadd<<<4,n/4>>> ®
x = r
print ,x,dble(n(n+1)/2)
if (x .eq. dble(n*(n+1)/2)) then
print *,“TEST PASSED”
print *,“TEST FAILED”