This project is read-only.

reusing data in GPU?

Aug 18, 2013 at 5:30 AM
I have some data like this:
int[] dev_lstAct = gpu.CopyToDevice<int>(listAct.ToArray<int>());

and I will call gpu.Launch in a loop, which will use dev_lstAct.

However, I found that for the first iteration of the loop, it works well, but the second iteration will fail.
an exception saying System.Int32[] is not on the GPU or not supported is thrown.

if i include int[] dev_lstAct = gpu.CopyToDevice<int>(listAct.ToArray<int>()); in the loop, it is OK.

so i think it is because dev_lstAct can't be kept after calling the kernel?

dev_lstAct will not change, it just provides data to the threads to use.

so how can i keep it available between iterations of the loop? i think copying it for every iteration makes the performance down.
Aug 18, 2013 at 5:37 AM
well, i found that i call gpu.FreeAll() in the loop.....

i move it out of the loop, it works well now :D
Aug 19, 2013 at 12:50 PM
Best to show the minimum amount of your source code in your posts that can properly illustrate your issue.
Use an overload of CopyToDevice that uses memory preallocated outside of loop.