Hello
When I run a simple code in emudebug mode I get the correct answer.
But when I run debug mode it gives wrong answer.
The simple code that I wrote is:-
#include<stdio.h>
int* arr_d;
global void ker(int* arr_d)
{
int threadIdx1=blockDim.x*blockIdx.x+threadIdx.x;
if(threadIdx1<2)
{arr[0]=333;}
}
int main()
{
cudaMalloc((void**)&arr_d,12);
int* arr_h=(int*)malloc(12);
arr_h[0]=12;arr_h[1]=13;arr_h[2]=14;
cudaMemcpy(arr_d,arr_h,12,cudaMemcpyHostToDevice);
ker<<<1,2>>>(arr);
cudaThreadSynchronize();
cudaMemcpy(arr_h,arr_d,12,cudaMemcpyDeviceToHost);
printf(“%d”,arr_h[0]);
system(“pause”);
return 0;
}
Clearly this code should print 333.But it prints 12 in debug mode,and 333 in emudebug mode.
Please clarify this situation.
Thanks in advance.