Computer programming Newsletters

GPU Programming in MATLAB
March 10, 2016 – 11:58 pm
Figure 1

gpu_fig1_w.jpgBy Jill Reese, MathWorks and Sarah Zaranek, MathWorks

Multicore machines and hyper-threading technology have enabled scientists, engineers, and financial analysts to speed up computationally intensive applications in a variety of disciplines. Today, another type of hardware promises even higher computational performance: the graphics processing unit (GPU).

Originally used to accelerate graphics rendering, GPUs are increasingly applied to scientific calculations. Unlike a traditional CPU, which includes no more than a handful of cores, a GPU has a massively parallel array of integer and floating-point processors, as well as dedicated, high-speed memory. A typical GPU comprises hundreds of these smaller processors (Figure 1).

Figure 1. Comparison of the number of cores on a CPU system and a GPU.

The greatly increased throughput made possible by a GPU, however, comes at a cost. First, memory access becomes a much more likely bottleneck for your calculations. Data must be sent from the CPU to the GPU before calculation and then retrieved from it afterwards. Because a GPU is attached to the host CPU via the PCI Express bus, the memory access is slower than with a traditional CPU.1 This means that your overall computational speedup is limited by the amount of data transfer that occurs in your algorithm. Second, programming for GPUs in C or Fortran requires a different mental model and a skill set that can be difficult and time-consuming to acquire. Additionally, you must spend time fine-tuning your code for your specific GPU to optimize your applications for peak performance.

This article demonstrates features in Parallel Computing Toolbox™ that enable you to run your MATLAB® code on a GPU by making a few simple changes to your code. We illustrate this approach by solving a second-order wave equation using spectral methods.

Why Parallelize a Wave Equation Solver?

Wave equations are used in a wide range of engineering disciplines, including seismology, fluid dynamics, acoustics, and electromagnetics, to describe sound, light, and fluid waves.

gpu_fig2_w.jpg gpu_fig4_w.jpg
Source: www.mathworks.com
You might also like
తెలుగు Telugu Computer OS I News Live Part 2
తెలుగు Telugu Computer OS I News Live Part 2
తెలుగు Telugu Computer OS I News Live Part 3
తెలుగు Telugu Computer OS I News Live Part 3
Popular Q&A
avatar
What is the best OS for computers?

The best OS for a computer is based on opinion. However, most people will say the newest OS is the best OS. The only OS that I think has ever been a disappointment is Windows Vista.

Related Posts