Main Content

Run MATLAB using GPUs in the Cloud

If you do not have a GPU available, you can speed up your MATLAB® code with one or more high-performance NVIDIA® GPUs in the cloud. Working in the cloud requires some initial setup, but using cloud resources can significantly accelerate your code without requiring you to buy and set up your own local GPUs.

MathWorks® provides several ways of accessing MATLAB in public clouds, such as Amazon® Web Services (AWS®) and Microsoft® Azure®, that you can configure according to your needs. You can access a single machine in the cloud or, if you have MATLAB Parallel Server™, you can scale up to a cluster.

MathWorks Cloud Center

From Cloud Center, you can create and manage cloud resources using your AWS account, including accessing a single machine with MATLAB installed and a MATLAB Parallel Server cluster that you can access from any MATLAB session.

To get started with Cloud Center, see:

Note

When you create your cloud resource, choose a machine with GPUs, such as the P3, P4, P5, or G5 instances. Instances P3, P4, and P5 have GPUs with high performance for general computation. G5 instances have GPUs with high single-precision performance for deep learning, image processing, computer vision, and automated driving simulations.

MATLAB shown running on monitor and laptop screen

Microsoft Azure Marketplace

You can deploy MATLAB and MATLAB Parallel Server in the cloud using software plans developed by MathWorks for the Microsoft Azure Marketplace.

To get started with Microsoft Azure Marketplace, see:

Note

  • When selecting a virtual machine size, choose a machine with NVIDIA GPUs, such as the NCv3-series, the NC T4_v3-series, and the ND A100 v4-series virtual machines. These virtual machines are designed for compute-intensive workloads.

Reference Architectures

MathWorks provides customizable reference architecture templates for AWS and Azure in GitHub®. Reference architecture templates grant you full control over your cloud resources, including region and network settings that match your existing cloud infrastructure.

To get started with reference architectures, see:

Containers

You can also use containers to create software environments on desktop, server, or cloud environments. Containers are isolated units of software that contain everything required to run a specific application and are consistent, portable, and lightweight.

To get started with containers, see:

Note

By default, a container does not have access to the hardware resources of its host. To grant the container access to the NVIDIA GPUs of the host system:

  • Run the container on a host system with the appropriate NVIDIA GPU drivers installed.

  • Make the GPUs of the host visible to the container by using the --gpus flag when you execute the docker run command. Set this flag to all to grant the container access to all the GPUs of the host machine.

For more information, see Use GPUs in Containers.

Related Topics