I have some iterative code that runs on the gpu. It is necessary however to check for convergence and so I need to find the max error between an old and new matrix. The verbatim line of code in my code is this:
Where Psi and Psi0 are gpuArrays. Now then... the documentation states that max and abs should compute on the GPU since they are given gpuArray data as arguments. However, I'm not sure that's the case, I think the CPU is being used for at least part of this.
For example, execute the following code:
On my laptop this takes about 32 seconds to run. You can see that the same basic operation is happening within the loop. I would think that essentially the whole calculation would happen on the GPU, but if you open up task manager I note that Matlab suddenly runs on my CPU @ 25% (I have 4 cores). Why is this?
Note: ver output
MATLAB Version 184.108.40.2064 (R2011b)
MATLAB License Number: [SCd Censor]
Operating System: Microsoft Windows 7 Version 6.1 (Build 7601: Service Pack 1)
Java VM Version: Java 1.6.0_17-b04 with Sun Microsystems Inc. Java HotSpot(TM) 64-Bit Server VM mixed mode
And gpuDevice output:
Name: [1x12 char]
MaxThreadBlockSize: [1x3 double]
MaxGridSize: [1x2 double]
TotalMemory: [1x1 double]
FreeMemory: [1x1 double]
Methods, Events, Superclasses