Chapter 8

MATLAB MEX functions containing CUDA code

Abstract

This chapter explains how to create a MATLAB MEX file that contains CUDA code and run it on a GPU by calling it through MATLAB. Furthermore, two classic examples, vector addition and matrix multiplication, are presented. After reading this chapter, you should be able to:

 understand the basic features of a MEX file.

 compile MEX files that contain CUDA code.

 execute MEX files that contain CUDA code by calling them through MATLAB.

 understand the difference of a MEX file that contains CUDA code and a CUDAKernel object.

 use host-side libraries in your MEX files.

understand the basic features of a MEX file.

compile MEX files that contain CUDA code.

execute MEX files that contain ...

Get GPU Programming in MATLAB now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.