2.5

2.5 | 2 ratings Rate this file 47 downloads (last 30 days) File Size: 52.38 KB File ID: #22657

CUDA in a MATLAB MEX-file

by Eric Johnson

 

11 Jan 2009

Code covered by BSD License  

Integrating NVIDIA CUDA code with MATLAB using a C MEX-file

Download Now | Watch this File

File Information
Description

This is a MEX-function that demonstrates how to compute the hypotenuse and angle of a triangle, using:
- MATLAB M-code
- A C-language MEX-function, running on the CPU
- A C-language MEX-function, running on an NVIDIA CUDA-capable GPU

The build procedure is more complicated than a regular MATLAB MEX-file. I have been building this in Microsoft Visual C++.

1. Follow the instructions in the MATLAB documentation that describe how to build a MEX-file outside of MATLAB:
[http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f24338.html]

2. Set a custom build rule for the "cudaHypot.cu" file in the source code. See the example projects provided with NVIDIA's CUDA SDK for sample build commands.

I apologize for not providing more detailed build instructions right now. I will try to update these, time permitting.

MATLAB release MATLAB 7.6 (R2008a)
Other requirements NVIDIA CUDA-capable graphics card (GPU). For supported cards, see: http://www.nvidia.com/object/cuda_learn_products.html
Zip File Content  
Other Files cudaHypot.mexw32,
example.m,
license.txt,
src/common.h,
src/cudaHypot.cu,
src/module.def
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (2)
26 Feb 2009 Andre  
12 Nov 2009 Tony P. Sunny  
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
cuda Eric Johnson 12 Jan 2009 16:34:38
mex Eric Johnson 12 Jan 2009 16:34:39
gpu Eric Johnson 12 Jan 2009 16:34:39
nvidia Eric Johnson 12 Jan 2009 16:34:39
video card Eric Johnson 12 Jan 2009 16:34:39
graphics card Eric Johnson 12 Jan 2009 16:34:39
accelerator Eric Johnson 12 Jan 2009 16:34:39
 

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