__global__ void cAdd(int *A, int *B, int *C)
{
int x = threadIdx.x + (blockIdx.x << 4);
int y = threadIdx.y + (blockIdx.x << 4);
int ind = x + (y << 8);
int z = atomicExch(&A[ind],4);
}
I have Visual Studio 2005 team edition and 8600GTS installed on my computer.
8600gts should have computional capability 1.1 but when i try to use atomic functionse
(ie atomicExch) compiler reports
1>sample.cu(58): error: identifier “atomicExch” is undefined
yes i did. BUT as i said im using vs2005 with CUDA PROJECT WIZARD and that was the problem. When i go to project properties/CUDA/COMMAND LINE/ and add -arch sm_11
option compiler actualy ignores it when compiling code. I had to go visual sutdio/VC/VCprojectDefaults/cuda.properties to change command line. now it works fine
I’m having the same problem. Where are you changing the code? within VS08 or regedit? I try to look in both but I was unable to find the correct line to change
I was able to add the “-arch sm_11” to the custom build of my .cu file in VS08 (right click on .cu file and then select the custom build property). But when I do that the execution end with a “invalid device function” even if I do not use any atomic function. Without the “-arch sm_11” the program executes correctly, but I cannot use atomic.
I solved my problem and now it compiles correctly. What I had to do is remove the tesla card C870 and leave inside the PC just the 9800gx2. For some reasons even if I was setting the CUDA device to 1 to skip the Tesla card, the compiler was still complaining.
Thank you very much. Would please tell me where is the location of nvopts.sh file. I am new in CUDA programming and couldn’t find out the file. please help again.
Hello,
I couldn’t find nvopts.sh in Matlab_Cuda_1.1 for Windows. My atomic functions in mex files are showing error “undefined” during compilation. Please tell me what can I do now?
I can see that the flag -arch sm_12 is set, so I am unsure as to why this is failing. If anyone has any insight I would very much appreciate it. Thanks for your time.
Ok, I got it to compile and I just wanted to post the solution for any other VS2010 users.
Navigate to:
Project->Properties->Configuration Properties->CUDA C/C+±>Device
Then under “Code Generation”
Change “compute_10,sm_10” to “compute_20,sm_20”.
Thanks for your reply. Is there anyone who have used atomic functions of cuda in matlab mex files in windows??? I badly need it for my research, plz help me.