Problem using cudamemcpytosymbol

Hi guys

Im having a trouble in my app

I have declared this 2 vars

__constant__ unsigned short dev_array_dst[4032];
__constant__ unsigned int dev_fail[400];

now, when i have the host vars, and make the copy to the device vars, only is copying the value of a single array.

Im using this code

HANDLE_ERROR( cudaMemcpyToSymbol (dev_fail, host_fail, 400 * sizeof(unsigned int)) );	

HANDLE_ERROR( cudaMemcpyToSymbol (dev_array_dst, host_orig_dst, 4032 * sizeof(unsigned short)) );

but in the kernel, Im only getting the values of the array dev_fail, the another is empty.

can someone explain me why im having this problem or tell me how can I solve this?
thank you very much.

Are the 2 vars declared in the same .cu file where the kernel is defined?
How are you reading constant memory in the kernel?
Have you tested to switch the two cudaMemcpyToSymbol calls? Just to know if the empty vector is the first or dev_array_dst is always empty and the other is filled.

Hi jgonzac

Thanks for your answer.

Yes, both vars are declared into the same file

Im reading the vars as is done normally, dev_array_dst[tid]

Yes, I have done this, but the empty array is always the same, dev_array_dst.

Thanks

I don’t know what may be happening… :S
Is there any other global memory allocation, memcopy which can be interfering or overwriting some host/device memory? I guess you are tested that host_orig_dst has been filled correctly before calling MemCopyToSymbol… So, I’m afraid I can’t help you. Maybe you can post some more code to allow as to try to figure out the problem.

Hi jgonzac

I have checked the code and the arrays are being filled according as expected.
I don’t know I can be happening.

I’ll try to solve this problem in another way

Thanks again for your help.
Best regards

Could you please post a “minimum-sized” code reproducing your problem?