Chapter 7

Run CUDA or PTX code

Abstract

This chapter explains how to create an executable kernel for a CUDA C code or PTX code and run that kernel on a GPU by calling it through MATLAB. Moreover, a brief introduction of CUDA C is presented. 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 CUDA C code.

 compile kernels written in CUDA C.

 use compiled PTX codes to create CUDAKernel objects.

 execute kernels on a GPU by calling them through MATLAB.

 set properties on the CUDAKernel object to control its execution on the GPU.

understand the basic features of a CUDA C code.

compile kernels written in CUDA C. ...

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.