so when you say atomicAdd is undefined, do you mean an intellisense indication of that (red underline in the IDE window, or hovering your mouse over it, or whatever), or do you mean that when you actually go to compile the code, you get an error message during the compilation process that says atomicAdd is undefined?
and so your inclusion of this compile arch target:
gencode=arch=compute_11,code=\"sm_11,compute_11\"
would generate that error.
and the first (actual compile) error you are showing is indeterminate. You will need to enable additional verbosity settings on Visual Studio output so you can see the error that is actually being indicated by nvcc. The only thing that error string says is that nvcc failed “with an error of some kind”.
The intellisense thing is a separate issue. (and not a show-stopper)
i tried to include cuda_helper.h and and helper_functions.h as that is what the sample project uses, I have copied them into the …toolkit\cuda\v6.5 directory, they were able to be found, but it has not resolved my problem.
I have further more started a new project from scratch and tried to get the atomicAdd to work but to no avail, fresh project the same problem exists.
-Could there be something with my install of the SDK? Should I attempt a reinstall? Seems a bit drastic…
Again, thank you so far with your assistance, I hope to hear more suggestions.
I think it’s likely the error has nothing to do with atomic usage. You didn’t answer my question about what type of atomic you are doing (on what data type?) It might be instructive to paste here the actual line of code where you are using the atomicAdd operation as well.
when I google “visual studio verbosity” this is the 3rd hit I get:
You should increase the verbosity settings until you see a compile error immediately preceding the ones you have pasted here, which is the actual error text output from the nvcc command itself, rather than the VS executive reporting “Error 1 error MSB3721…” which is simply stating that a tool it ran previously (nvcc) did not return correctly.
So this is the code to answer your first question.
global void global_compute_hist(int *d_hist, const char *d_in,int sizeD_in, int numRows, int numCols)
{
int myId = threadIdx.x + blockDim.x + blockIdx.x;
if (myId >= sizeD_in)
return;
int bin = -1;
bin = d_in[myId]; //get the value from the input data and add to histogram
atomicAdd(&d_in[bin], 1);
}
Modifying the verbosity and nothing really changes I think. Here is the error code:
atomicAdd() is an overloaded function defined for various data types (see prototypes below), however there is no variant defined to operate on data of type ‘char’. The compiler should generate an error for the source you showed above. You should be able to see it in the build log if you adjust the verbosity level appropriately, as suggested by txbob.
sm_11_atomic_functions.h:static inlinedevice int atomicAdd(int *address, int val)
sm_11_atomic_functions.h:static inlinedevice unsigned int atomicAdd(unsigned int *address, unsigned int val)
sm_12_atomic_functions.h:static inlinedevice unsigned long long int atomicAdd(unsigned long long int *address, unsigned long long int val)
sm_20_atomic_functions.h:static inlinedevice float atomicAdd(float *address, float val)