the following code gives me an error sometimes:
rawData = gather(rawData);
gpuSwitcheroo = 1;
gpuSwitcheroo = 0;
The error is: Error using gpuArray/gather The data no longer exists on the device.
I really cant make any sense of this, since the if statement should already check whether or not the variable is on the GPU, right?? How could it possibly not be on the GPU anymore if that statement just resulted in the variable being of type 'gpuArray'??
This only occurs on a system with very limited GPU memory, but I checked and during that specific operation the memory is not exceeded! It is however beforehand, and as a result of that, rawData is automatically gathered, hence the usage of that if-statement. But then how can the statement be true, if rawData has already been gathered??
I'm really confused, hopefully someone knows whats going on.