File Exchange

image thumbnail

A CUDA accelerated Beam Propagation Method [BPM] Solver using the Parallel Computing Toolbox

version 1.1 (5.89 KB) by

A beam propagation method solver using the CUDA capabilities in the parallel computing toolbox.

12 Downloads

Updated

View License

The parallel computing toolbox version 5.0 for MATLAB 2010b includes an initial capability for NVIDIA CUDA use. This entry provides a simple paraxial beam propagation method [BPM] solver that utilizes the added GPU capability. A script is also provided that runs the BPM with standard MATLAB Fourier transforms and the GPU implemented transforms. For smaller matrices, the standard MATLAB approach appears to be faster, while at larger matrices above 512x512 elements, the CUDA approach is more than twice as fast.

An effort has been made to make the program so that it will run on a computer without the parallel computing toolbox or an NVIDIA GPU. However, a comparison with standard MATLAB is only possible with those two components.

Files:

The script ScrTimeBPM.m
contains an example of how one may run the main function CUDAparaxbpm.m.
The additional files
FunPlotSim.m
FunEfieldinit.m
FunRefractIdx.m
initialize the field, update the refractive index profile, and create plots.

References:
1) www.mathworks.com/discovery/matlab-gpu.html
2) A. Weideman, Linear Dispersive Wave Equations, http://dip.sun.ac.za/~weideman/research/waves.html
3) Okamoto, K. Fundamentals of optical waveguides, Academic Press, 2000.

Comments and Ratings (3)

Thanks for posting this code, very cool algorithm. We've enabled it to run with Jacket and posted the results and modified code here: http://blog.accelereyes.com/blog/2010/11/05/beam_propagation_methods/

Enjoy!

Patrick Kano

Hello David,
Thank you for your comments. My coworkers and I are interested in GPU acceleration. I was intrigued by the inclusion of CUDA capability into the MATLAB 2010b parallel computing toolbox.
The motivation for using MATLAB+CUDA was primarily my own curiosity. The choice of the beam propagation equation was based simply on my past experience with it.

From on the MathWorks website,
www.mathworks.de/help/toolbox/distcomp/rn/bsloyak-1.html
I do not believe that the 2009b version is adequate to run the CUDA additions.

A list of functions, like fft2, that support the GPU capability use can be found here:
www.mathworks.cn/help/toolbox/distcomp/bsic4fr-1.html

Finally, a related example from the company website of fft2 being used is at:
www.mathworks.com/products/parallel-computing/demos.html?file=/products/demos/shipping/distcomp/paralleldemo_gpu_fft2.html

I am glad to hear of our common interest.
Patrick

Hello, Patrick. It is quite a coincidence that I am working in this same subject (kind of). I do not have, however, the latest Parallel Computing Toolbox (PCTB) and I would like to do some questions. Do you choose to use CUDA over standard parallel computing (multicore) by any particular reason? Is the FFT2 parallelized in the new version of PCTB (as far as I know, I'm my version it is only parallelized 1D FFT)? I am using 2009b, by the way. Thanks!

Updates

1.1

We slightly modified the description to explain more about the functions.

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video