File Exchange Pick of the Week

Our best user submissions

2D波方程

Sean's pick this week is2D波方程byDaniel Armyr.

GPUs

MATLAB'sParallel Computing Toolbox对于许多不同计算,对图万博1manbetx形处理单元(GPU或GPGPU)有直接支持。由于大多数笔记本电脑除了高端游戏外,还没有足够强大的GPU来进行科学计算,因此我通常不会利用这一点。

However, I've been lucky enough over the last month or so to have access to a fancy portable desktop with aTesla K40 GPUin 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代码比较:

只是命令gpuArraygather要在CPU和GPU之间来回移动阵列。有很多直接在GPU上运行的命令,您可以找到它们这里. This list grows bigger with every release of MATLAB. My personal favorite isiradonwhich 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.

ifgpudevicecount== 0 warndlg(sprintf(“您没有支持的GPU!\ ngo与您的万博1manbetxIT部门交谈:)),'No GPU Found')end

注释

您是使用带有MATLAB的GPU还是有兴趣尝试?

尝试一下,让我们知道您的想法这里or leave acommentfor Daniel.




Published with MATLAB® R2015b

|
  • print
  • send email

注释

To leave a comment, please click这里to sign in to your MathWorks Account or create a new one.