copying data from host to device constant memory

Hello everyone,

I want to copy a small 4 x 4 matrix from host to device. My host array/matrix is defined as follows:

float m[4][4];

Can I do something like as follows:


device constant float d_m[4][4];

and to copy use this in host:

CUDA_SAFE_CALL(cudaMemcpyToSymbol(d_m, m, 16 * sizeof(float));


Is this the correct way of doing this? I am currently using a non-cuda machine to code CUDa software(!) and am unable to test this and would be grateful if someone could correct me if I am wrong!