I try to implement a Cuda atomicAddDouble function on a Tesla C2050. But, I get that problem:
Description Resource Path Location Type
identifier "__double_as_longlong" is undefined MatchedFilter.cu /MatchedFilter/Source line 254 C/C++ Problem
identifier "__longlong_as_double" is undefined MatchedFilter.cu /MatchedFilter/Source line 252 C/C++ Problem
identifier "atomicCAS" is undefined MatchedFilter.cu /MatchedFilter/Source line 253 C/C++ Problem
make: *** [Source/cu_MatchedFilter.o] Error 2 MatchedFilter line 0 C/C++ Problem
These function flagged are not supported for sm_10. If you leave off “-gencode arch=compute_10,code=compute_10” these errors should go away. Did you mean sm_13 by any chance (that’s the minimum compute capability that includes double-precision support) ?
Your function won’t work. You have a race in the initialization of old. You first evaluate old=*address, but the value may have changed before you get into your loop.
Good spotting. It’s not a race condition though, the problem rather is that
double old = *address, assumed;
while looking like self-explanatory code will actually set [font=“Courier New”]old[/font] to the uninitialized value of the variable [font=“Courier New”]assumed[/font].
Triple-spotting: Forget about my double-spotting, the code is actually going to work. Somehow for a moment I parsed the expression with the relative precedence of “=” and “,” inverted.