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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.