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.
The script ScrTimeBPM.m
contains an example of how one may run the main function CUDAparaxbpm.m.
The additional files
initialize the field, update the refractive index profile, and create plots.
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.
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/
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,
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:
Finally, a related example from the company website of fft2 being used is at:
I am glad to hear of our common interest.
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!
We slightly modified the description to explain more about the functions.
Create scripts with code, output, and formatted text in a single executable document.