We are using atiomicAdd with float which is supported under CUDA 3.2.
On windows specifying architecture sm_20 is good enough. I need to compile same lib for Linux and seemingly no combination of arch and compute flags gives me what I want –namely a successful build .
Errors look like:
CVA_kernel.cu(212): error: no instance of overloaded function "atomicAdd" matches the argument list
argument types are: (float *, float)
When compute sm_11 is specified or:
CVA_kernel.cu(212): error: identifier "atomicAdd" is undefined
When sm_11 is omitted but sm_20 is specified…
Present Makefile looks like:
# Add source files here
EXECUTABLE := libfastIRD.so
# Cuda source files (compiled with cudacc)
CUFILES := dev_host_interface.cu
# C/C++ source files (compiled with gcc / c++)
CCFILES :=
CU_DEPS :=
##################################
# Rules and targets
CUDACCFLAGS := -arch=compute_11 -code=compute_11,sm_11,sm_13,sm_20
CCFLAGS := -fopenmp
CXXFLAGS := -fopenmp
include ../../common/common.mk
NVCCFLAGS += -Xcompiler -fPIC
CFLAGS += -fPIC -fopenmp
CXXFLAGS += -fPIC -O2 -fopenmp
LINK += -shared
Can someone please help me fix this makefile, I’m sure it’s something simple…
Floating point atomic add support is only supported for compute 2.0 or greater. You can’t compile code with floating point atomic operations for compute 1.1 targets.
Quite right, but if I do not specify sm_11 some where in the Makefile it complains that it does not know about atomicAdd.
In those cases I get
CVA_kernel.cu(212): error: identifier "atomicAdd" is undefined
If I specify sm_20 only, which is what I want, I get the above…
To reformulate the question a little…
Which compile flags should I use to compile atomic functions such as atomicAdd for floating point where Fermi is my target architecture using nvcc 3.2???
If you really want to use the SDK built system (and I would urge you not to), then try running make verbose=1 and see what the compilation statements are. It is likely that one or more of the variables defined in your Makefile is either being ignored or overwritten by the contents of common.mk. That file is a horrible mess that really shouldn’t used for anything outside of the SDK, and even then I question the sanity and technical competence of those who wrote it.
Thanks avidday, that’s a good answer. I generally just truat the common.mk file but perhaps I shouldn’t. I will look into it and see what I can find. When I solve this I’ll be sure to post the solution because I can’t beleive I’m the only one to run into this. The machine I’m working with is a more or less clean install on 100% supported software/hardware which is part of the reason it’s driving me mad…