Data beeing automatically rest


I’m a mid level CUDA programmer.
I have a problem I never met before.
I have some data I transfered on my device memory using the
well-known cudaMemcpy() function.
After one operation which use BUT NOT MODIFY the transfered
data , it is automatically reset to zero.
What can be cause of this behavior? And how to fix it?
I would appreciate any help.
Thank you.

Check error codes of all functions first. For example, code of that function, that checks data.

Have you checked the return codes after using the data (but before reading it back)? Perhaps you are accessing out of bounds memory and your read just never happens.

Thank you for your reply.

I defined an error check function I call after

every function call. But nothing wrong is shown.

I also copy back the result on memory to visualize.

Thank you dmyablonski

I check before and after.

to be clear i have to call the same function multiple times.

Only one call clears the arguments.

Even when I change the order it is the same call which


Thank you guys for you help. I would have never solved this problem without your help.

I made a silly mistake in the kernel.

The error was in the initialize part of my program.

while the size of the arrays was lower than the number of threads

I was doing something like this:

of course the size of the array was lower than that!

thank you again.