MATLAB's Parallel Computing Toolbox has direct support for Graphics Processing Units (GPUs or GPGPUs) for many different computations. Since most laptops, with the exception of high-end gaming ones, don't have powerful enough GPUs for scientific computing, I usually don't get to take advantage of this.
However, I've been lucky enough over the last month or so to have access to a fancy portable desktop with a Tesla K40 GPU in it. Daniel's app allows me to make waves and then compute the propagation on the cpu or gpu while measuring the difference in computational speed. (I switch to the GPU at 28s)
What did it take to switch over to the GPU from the CPU? Here's the code comparison:
Just the commands gpuArray and gather to move the arrays back and forth between the CPU and GPU. There are quite a few commands that run directly on the GPU, you can find them here. This list grows bigger with every release of MATLAB. My personal favorite is iradon which was a big bottleneck in my previous life working with CT images.
One thing I'd like to see Daniel do differently would be to check if a GPU is available. If you don't have a supported GPU, the app errors rather than failing gracefully or just disabling the GPU option. There's a convenient function, gpuDeviceCount, that you can use to see how many supported GPUs are on the machine.
if gpuDeviceCount == 0 warndlg(sprintf('You don''t have a supported GPU!\nGo talk to your IT department :)'),'No GPU Found') end
Do you use a GPU with MATLAB or have interest in trying one?
コメントを残すには、ここ をクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。