Hi,
I have recently started doing some project on CUDA.
Your help will be highly appreciated.
I am looking for simpler ways to initialize arrays and define arrays in the device. Most of the examples(matrix, template etc) use runtime APIs like CUDAMALLOC and CUDAMEMCPY. What I want is static initialization to be done by the device.
Example: I define two device variables g_idata, g_odata;
template.cu
device float g_idata[32];
float h_idata[32];
I am using the CudaMEMCPY function to read from the device array to the the host.
// copy host memory to device
//Line 97:
CUDA_SAFE_CALL( cudaMemcpy( g_idata, h_idata, mem_size,
cudaMemcpyHostToDevice) );
But I am getting a runtime error when I execute this code.
Cuda error in file ‘template.cu’ in line 97 : invalid device pointer.
I am assuming that the compiler knows that g_idata is a device pointer.
Can the host directly use this pointer in its function calls to do the memcpy thing ?
Am I missing something else ?
Regds, JarJar