Accelerating MATLAB with GPU Computing

Book description

Beyond simulation and algorithm development, many developers increasingly use MATLAB even for product deployment in computationally heavy fields. This often demands that MATLAB codes run faster by leveraging the distributed parallelism of Graphics Processing Units (GPUs). While MATLAB successfully provides high-level functions as a simulation tool for rapid prototyping, the underlying details and knowledge needed for utilizing GPUs make MATLAB users hesitate to step into it. Accelerating MATLAB with GPUs offers a primer on bridging this gap.

Starting with the basics, setting up MATLAB for CUDA (in Windows, Linux and Mac OS X) and profiling, it then guides users through advanced topics such as CUDA libraries. The authors share their experience developing algorithms using MATLAB, C++ and GPUs for huge datasets, modifying MATLAB codes to better utilize the computational power of GPUs, and integrating them into commercial software products.  Throughout the book, they demonstrate many example codes that can be used as templates of C-MEX and CUDA codes for readers’ projects.  Download example codes from the publisher's website: http://booksite.elsevier.com/9780124080805/

  • Shows how to accelerate MATLAB codes through the GPU for parallel processing, with minimal hardware knowledge
  • Explains the related background on hardware, architecture and programming for ease of use
  • Provides simple worked examples of MATLAB and CUDA C codes as well as templates that can be reused in real-world projects

Table of contents

  1. Cover image
  2. Title page
  3. Table of Contents
  4. Copyright
  5. Preface
    1. Target Readers and Contents
    2. Directions of this Book
  6. 1. Accelerating MATLAB without GPU
    1. 1.1 Chapter Objectives
    2. 1.2 Vectorization
    3. 1.3 Preallocation
    4. 1.4 For-Loop
    5. 1.5 Consider a Sparse Matrix Form
    6. 1.6 Miscellaneous Tips
    7. 1.7 Examples
  7. 2. Configurations for MATLAB and CUDA
    1. 2.1 Chapter Objectives
    2. 2.2 MATLAB Configuration for c-mex Programming
    3. 2.3 “Hello, mex!” using C-MEX
    4. 2.4 CUDA Configuration for MATLAB
    5. 2.5 Example: Simple Vector Addition Using CUDA
    6. 2.6 Example with Image Convolution
    7. 2.7 Summary
  8. 3. Optimization Planning through Profiling
    1. 3.1 Chapter Objectives
    2. 3.2 MATLAB Code Profiling to Find Bottlenecks
    3. 3.3 c-mex Code Profiling for CUDA
    4. 3.4 Environment Setting for the c-mex Debugger
  9. 4. CUDA Coding with c-mex
    1. 4.1 Chapter Objectives
    2. 4.2 Memory Layout for c-mex
    3. 4.3 Logical Programming Model
    4. 4.4 Tidbits of GPU
    5. 4.5 Analyzing Our First Naïve Approach
  10. 5. MATLAB and Parallel Computing Toolbox
    1. 5.1 Chapter Objectives
    2. 5.2 GPU Processing for Built-in MATLAB Functions
    3. 5.3 GPU Processing for Non-Built-in MATLAB Functions
    4. 5.4 Parallel Task Processing
    5. 5.5 Parallel Data Processing
    6. 5.6 Direct use of CUDA Files without c-mex
  11. 6. Using CUDA-Accelerated Libraries
    1. 6.1 Chapter Objectives
    2. 6.2 CUBLAS
    3. 6.3 CUFFT
    4. 6.4 Thrust
  12. 7. Example in Computer Graphics
    1. 7.1 Chapter Objectives
    2. 7.2 Marching Cubes
    3. 7.3 Implementation in MATLAB
    4. 7.4 Implementation in c-mex with CUDA
    5. 7.5 Implementation Using c-mex and GPU
    6. 7.6 Conclusion
  13. 8. CUDA Conversion Example: 3D Image Processing
    1. 8.1 Chapter Objectives
    2. 8.2 MATLAB Code for Atlas-Based Segmentation
    3. 8.3 Planning for CUDA Optimization Through Profiling
    4. 8.4 CUDA Conversion 1 - Regularization
    5. 8.5 CUDA Conversion 2 - Image Registration
    6. 8.6 CUDA Conversion Results
    7. 8.7 Conclusion
  14. Appendix 1. Download and Install the CUDA Library
    1. A1.1 CUDA Toolkit Download
    2. A1.2 Installation
    3. A1.3 Verification
  15. Appendix 2. Installing NVIDIA Nsight into Visual Studio
  16. Bibliography
  17. Index

Product information

  • Title: Accelerating MATLAB with GPU Computing
  • Author(s): Jung W. Suh, Youngmin Kim
  • Release date: November 2013
  • Publisher(s): Morgan Kaufmann
  • ISBN: 9780124079168