4

CUDA Coding with c-mex

When we know the tools we use, we can better utilize them and maximize their usage. When programming c-mex, we must have a firm understanding of how data is passed between MATLAB and c-mex functions. Without knowing exactly how this occurs, we most likely will spend our valuable time in vain. Likewise, in CUDA, if we are better equipped with the knowledge of GPU, we then can stretch out its capabilities to their maximum. In this chapter, we examine memory layouts in c-mex; some basics of GPU hardware; and thread grouping for CUDA.

Keywords

CUDA; GPU; streaming multiprocessor; streaming processor; warp; grid; thread; block; row-major order; column-major order

4.1 Chapter Objectives

When we know the tools we use, we ...

Get Accelerating MATLAB with GPU Computing 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.