MATLAB Examples

This file demonstrates how to use the Par class object to time the execution time of each PARFOR loop. Here are the steps.

Looks at how we can benchmark the solving of a linear system on the GPU. The MATLAB® code to solve for x in A*x = b is very simple. Most frequently, we use matrix left division, also known as

Benchmark solving a linear system on a cluster. The MATLAB® code to solve for x in A*x = b is very simple. Most frequently, one uses matrix left division, also known as mldivide or the backslash

In this example, we show how to benchmark an application using independent jobs on the cluster, and we analyze the results in some detail. In particular, we:

Runs a MATLAB® benchmark that has been modified for the Parallel Computing Toolbox™ and executes it on the client machine. Fluctuations of 5 or 10 percent in the measured times of repeated

Looks at why it is so hard to give a concrete answer to the question "How will my (parallel) application perform on my multi-core machine or on my cluster?" The answer most commonly given is "It

Runs a MATLAB® benchmark that has been modified for Parallel Computing Toolbox™. We execute the benchmark on our workers to determine the relative speeds of the machines on our distributed

Plays the card game of blackjack, also known as 21. We simulate a number of players that are independently playing thousands of hands at a time, and display payoff statistics. Simulating the

Uses the Parallel Computing Toolbox™ to play the card game of blackjack, also known as 21. We simulate a number of players that are independently playing thousands of hands at a time, and

Uses Parallel Computing Toolbox™ to play the card game of blackjack, also known as 21. We simulate a number of players that are independently playing thousands of hands at a time, and display

The basics of working with spmd statements, and how they provide an interactive means of performing parallel computations. We do this by performing relatively simple computations to

How arrayfun can be used to run a MATLAB® function natively on the GPU. When the MATLAB function contains many element-wise operations, arrayfun can provide improved performance when

Use pagefun to improve the performance of applying a large number of independent rotations and translations to objects in a 3-D environment. This is typical of a range of problems which

Uses Conway's "Game of Life" to demonstrate how stencil operations can be performed using a GPU.

Uses Parallel Computing Toolbox™ to perform a two-dimensional Fast Fourier Transform (FFT) on a GPU. The two-dimensional Fourier transform is used in optics to calculate far-field

Measure some of the key performance characteristics of a GPU.

Uses Parallel Computing Toolbox™ to perform a Fast Fourier Transform (FFT) on a GPU. A common use of FFTs is to find the frequency components of a signal buried in a noisy time-domain signal.

Switch between the different random number generators that are supported on the GPU and examines the performance of each of them.

How prices for financial options can be calculated on a GPU using Monte-Carlo methods. Three simple types of exotic option are used as examples, but more complex options can be priced in a

Demonstrates how advanced features of the GPU can be accessed using MEX files. It builds on the example Stencil Operations on a GPU. The previous example uses Conway's "Game of Life" to

Find out the number of CUDA devices in your machine, how to choose which device MATLAB® uses, and how to query the properties of the currently selected device.

How a simple, well-known mathematical problem, the Mandelbrot Set, can be expressed in MATLAB® code. Using Parallel Computing Toolbox™ this code is then adapted to make use of GPU hardware

How the Parallel Computing Toolbox™ can be used to perform pairwise sequence alignment (PWSA). PWSA has multiple applications in bioinformatics, such as multiple sequence analysis and

Pairwise sequence alignment (PWSA). PWSA has multiple applications in bioinformatics, such as multiple sequence analysis and phylogenetic tree reconstruction. We look at a PWSA that

Performs a Monte Carlo simulation of a number of stocks in a portfolio. At a given confidence level, we predict the value at risk (VaR) of the portfolio as well as the marginal value at risk

Uses the Parallel Computing Toolbox™ to perform a Monte Carlo simulation of a number of stocks in a portfolio. At a given confidence level, we predict the value at risk (VaR) of the portfolio as

Benchmarks the parfor construct by repeatedly playing the card game of blackjack, also known as 21. We use parfor to play the card game multiple times in parallel, varying the number of

Perform a parameter sweep in parallel and plot progress during parallel computations. You can use a DataQueue to monitor results during computations on a parallel pool. You can use a

Profile the implicit communication that occurs when using an unevenly distributed array.

Profile explicit communication to the nearest neighbor lab. It illustrates the use of labSend, labReceive, and labSendReceive, showing both the slow (incorrect) and the fast (optimal)

Solve an embarrassingly parallel problem with uneven work distribution using for drange. The for drange splits iterations equally. As a result it can do suboptimal load balancing, which is

Uses the Parallel Computing Toolbox™ to perform a Monte Carlo simulation of a radar station that tracks the path of an aircraft. The radar station uses the radar equation to estimate the

Performs a Monte Carlo simulation of a radar station that tracks the path of an aircraft. The radar station uses the radar equation to estimate the aircraft position. We introduce

This example was authored by the MathWorks community.

A MATLAB application from the field of systems biology was chosen for experimental runs. The application was created using SimBiology® which extends MATLAB® with functionality for

In parallel computing, communication between workers extracts a heavy cost and therefore a rule of thumb is to keep processing local. But certain array operations, such as averaging over a

This demo calculates returns the risk-return relationship in the stock portfolio that is optimal in the mean-variance sense. covMat and expRet are the covariance and mean returns of a

In this example we see how to use callback functions in the Parallel Computing Toolbox™ to notify us when a task has completed and to update graphics when task results are available. We also see

Use the parallel profiler. It is intended to be a quick-start guide to using the parallel profiler graphical user interface (GUI) and its basic commands. Links are provided to the other

The Parallel Computing Toolbox™ enables us to execute our MATLAB® programs on a cluster of computers. In this example, we look at how to divide a large collection of MATLAB operations into

In this example, we look at two common cases when we might want to write a wrapper function for the Parallel Computing Toolbox™. Those wrapper functions will be our task functions and will

In this example, we look at the gop function and the functions that build on it: gplus and gcat. These seemingly simple functions turn out to be very powerful tools in parallel programming.

In this example, we look at how we can reduce the run time of our jobs in the Parallel Computing Toolbox™ by minimizing the network traffic. It is likely that the network bandwidth is severely

Change the behavior of the examples in the Parallel Computing Toolbox™. There are at least two versions of each example in the Parallel Computing Toolbox: a sequential version and a

Is derived from Gerard Schuster's MATLAB example and book Seismic Interferometry

These are the files used in the webinar on Feb. 23, 2011. This file provides a brief description of the contents of the demo files and the steps needed to download the public data sources for use

Choose your country to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

You can also select a location from the following list:

See all countries