5.0

5.0 | 1 rating Rate this file 82 downloads (last 30 days) File Size: 57.79 KB File ID: #23795

NVIDIA CUDA-based bilinear (2D) interpolation

by Gerald Buchgraber

 

15 Apr 2009 (Updated 30 Jun 2009)

Code covered by BSD License  

Incredible speed boost in comparison to the Matlab implementation. (interp2)

Download Now | Watch this File

File Information
Description

This code was inspired by Alexander Huth's bilinear interpolation approach
( http://www.mathworks.com/matlabcentral/fileexchange/20248 )
also using the GPU's built-in bilinear texture interpolation capability, which is indeed very fast.

The speedup is depending on your CUDA enabled graphics hardware. The more multiprocessors, texture units, ... the better the results will be.

In comparison to Alexander's cudainterp2, I added some performance improvements and the capability to interpolate complex numbers too.

Feel free to write some feedback or a comment.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
2D CUDA-based bilinear interpolation

MATLAB release MATLAB 7.6 (R2008a)
Other requirements CUDA enabled graphics hardware, NVIDIA CUDA Toolkit, NVIDIA CUDA SDK, only tested with Windows (XP,Vista)
Zip File Content  
Other Files
bilininterp/bilininterp.cu,
bilininterp/bilininterp.m,
bilininterp/bilininterp_complex_test.m,
bilininterp/bilininterp_defines.h,
bilininterp/bilininterp_kernel.cu,
bilininterp/bilininterp_speed_test.m,
bilininterp/bilininterp_trajectory_test.m,
bilininterp/bin/nvmex.pl,
bilininterp/build_mex.m,
bilininterp/cudainterp2/cudainterp2.cu,
bilininterp/cudainterp2/cudainterp2.m,
bilininterp/cudainterp2/README,
bilininterp/cudainterp2/testcudainterp2.m,
bilininterp/nvmex.m,
bilininterp/nvmex_helper.m,
bilininterp/nvmexopts_r2008a.bat,
bilininterp/README,
bilininterp/test_bilininterp_vs_cudainterp2.m,
bilininterp/test_results_bilininterp_vs_cudainterp2_GPU_8800_GTX.png,
bilininterp/test_results_bilininterp_vs_cudainterp2_GPU_9600M_GT.png,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (6)
21 Apr 2009 Yi Cao

The code works as described. On my GeForce 8400 GPU, it can achieve over 200 on relative speedup. The nvmex compiler also works smoothly on MATLAB R2009A. Excellent!

12 Jul 2009 Darius

Having trouble getting it running:

"Can't locate File/Temp.pm in @INC (@INC contains: C:/Program Files/MATLAB/R2007a...)"

How does one ensure valid "include" and "library" paths in "build_mex.m" ?

24 Jul 2009 Gerald Buchgraber

Dear Darius,
you can find all build params described in nvmex.m
For adding additional include or library paths just use (similar to gcc) the params: -I<pathname> (for include path), -L<directory> (for lib dir) and -l<name> (for lib file).

Hopefully this helps and you get it running!

25 Sep 2009 Oliver Woodford

Is this supposed to compile on linux, or only on Windows? I can't get it to compile on linux.

28 Sep 2009 Gerald Buchgraber

Well, I haven't tried it yet, but I'm sure it's possible. The included build tools are dedicated to MS Windows. Please leave a notice if you get it running.

29 Sep 2009 Oliver Woodford

I wrote my own compile script for linux. See:
http://www.mathworks.com/matlabcentral/newsreader/view_thread/261866

Please login to add a comment or rating.
Updates
20 Apr 2009

description changed

22 Apr 2009

added another picture showing the test results on a GeForce 8800 GTX. Much better results in comparision to my mobile GeForce ;)

19 May 2009

License changed to BSD

30 Jun 2009

I fixed a typo and added tags.

Tag Activity for this File
Tag Applied By Date/Time
bilinear Gerald Buchgraber 16 Apr 2009 09:56:33
interpolation Gerald Buchgraber 16 Apr 2009 09:56:33
cuda Gerald Buchgraber 16 Apr 2009 09:56:33
image processing Gerald Buchgraber 16 Apr 2009 09:56:33
mex Gerald Buchgraber 16 Apr 2009 09:56:33
interp2 Gerald Buchgraber 30 Jun 2009 11:13:44
gpu Gerald Buchgraber 30 Jun 2009 11:13:45
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com