I have a simple program that works in emulation mode:I am trying to use device function to change some data(*d_data) passed from host side.
float3* d_data=NULL; CUDA_SAFE_CALL( cudaMalloc( (void**) &d_data, size)); kernel<<<gridSize, blockSize>>>(d_data);
It works well. But when I change into GPU mode, the d_data’s value hasn’t been changed after the device function call. Do I need to copy the results from device to host like this: ?
float3* h_odata=NULL; CUDA_SAFE_CALL( cudaMalloc( (void**) &h_odata, size)); CUDA_SAFE_CALL( cudaMemcpy( h_odata, d_data, size, cudaMemcpyDeviceToHost) );
But this doesn’t work neither. :mad: Please help, thanks!