Hi!
I have some trouble using device pointers from different functions. I have a class and defined a (private) member which I want to use as a device pointer to a table in the class. However it only works if the pointer is only used in one function.
So something like
Class::InitTable()
{
XX = cudaMalloc(size);
setTable<<<...>>>();
}
Class::UseTable
{
DoSomething<<<...>>>(XX);
}
doesn’t work and the table seems just to be filled with random values. While on the other hand
Class::InitAndUseTable()
{
if (!XX) {cudaMalloc(size); setTable<<<...>>>();}
DoSomething<<<...>>>(XX);
}
works perfectly fine.
Is this a known problem with CUDA? What else could be the reason?
Thanks!