在 Azure VM 上创建 MATLAB 分布式计算服务器群集Create MATLAB Distributed Computing Server clusters on Azure VMs

使用 Microsoft Azure 虚拟机可以创建一个或多个 MATLAB 分布式计算服务器群集,以运行计算密集型并行 MATLAB 工作负荷。Use Azure virtual machines to create one or more MATLAB Distributed Computing Server clusters to run your compute-intensive parallel MATLAB workloads. 在 VM 上安装 MATLAB 分布式计算服务器软件以用作基本映像,并使用 Azure 快速入门模板或 Azure PowerShell 脚本(可在 GitHub 上获取)来部署和管理群集。Install your MATLAB Distributed Computing Server software on a VM to use as a base image and use an Azure quickstart template or Azure PowerShell script (available on GitHub) to deploy and manage the cluster. 部署之后,可连接到群集来运行工作负荷。After deployment, connect to the cluster to run your workloads.

重要

自从本文编写完成以来,现已正式支持在 Azure 中使用 MATLAB 应用程序。Since this article was written, there is now formal support for using MATLAB applications in Azure. 建议使用这些较新功能,而不是本文中引用的模板和脚本。It is recommended that these more recent capabilities are used instead of the template and scripts referenced in this article. Azure 市场中搜索“matlab”;有关在 Azure 上运行 MATLAB 应用程序的更多信息可从 MathWorks 获得。Search the Azure Marketplace for "matlab"; further information about running MATLAB applications on Azure is available from MathWorks.

关于 MATLAB 和 MATLAB 分布式计算服务器About MATLAB and MATLAB Distributed Computing Server

MATLAB 平台已经过优化,可用于解决工程和科研问题。The MATLAB platform is optimized for solving engineering and scientific problems. 需要进行大规模仿真和数据处理任务的 MATLAB 用户可以借助 MathWorks 并行计算产品,利用计算群集与网格服务来加快其计算密集型工作负荷的运行速度。MATLAB users with large-scale simulations and data processing tasks can use MathWorks parallel computing products to speed up their compute-intensive workloads by taking advantage of compute clusters and grid services. 并行计算工具箱 可让 MATLAB 用户并行处理应用程序,并利用多核处理器、GPU 和计算群集。Parallel Computing Toolbox lets MATLAB users parallelize applications and take advantage of multi-core processors, GPUs, and compute clusters. MATLAB 分布式计算服务器 可让 MATLAB 用户利用计算群集中的多台计算机。MATLAB Distributed Computing Server enables MATLAB users to utilize many computers in a compute cluster.

通过使用 Azure 虚拟机,可以创建 MATLAB 分布式计算服务器群集,这些群集都可使用相同的机制以本地群集的形式提交并行工作,如交互式作业、批处理作业、独立的任务和通信任务。By using Azure virtual machines, you can create MATLAB Distributed Computing Server clusters that have all the same mechanisms available to submit parallel work as on-premises clusters, such as interactive jobs, batch jobs, independent tasks, and communicating tasks. 相比于预配和使用传统的本地硬件,将 Azure 与 MATLAB 平台结合使用可带来诸多好处:有多种不同的虚拟机大小可选、可按需创建群集以便只为使用的计算资源付费,并且能够大规模测试模型。Using Azure in conjunction with the MATLAB platform has many benefits compared to provisioning and using traditional on-premises hardware: a range of virtual machine sizes, creation of clusters on-demand so you pay only for the compute resources you use, and the ability to test models at scale.

先决条件Prerequisites

  • 客户端计算机 - 在部署后,需要使用一台基于 Windows 的客户端计算机来与 Azure 和 MATLAB 分布式计算服务器群集通信。Client computer - You'll need a Windows-based client computer to communicate with Azure and the MATLAB Distributed Computing Server cluster after deployment.
  • Azure PowerShell - 请参阅 How to install and configure Azure PowerShell(如何安装和配置 Azure PowerShell),在客户端计算机上安装该软件。Azure PowerShell - See How to install and configure Azure PowerShell to install it on your client computer.
  • Azure 订阅 - 如果没有订阅,只需要花费几分钟就能创建一个试用帐户Azure subscription - If you don't have a subscription, you can create a trial account in just a couple of minutes. 对于较大的群集,请考虑标准预付费套餐订阅或其他购买选项。For larger clusters, consider a Standard Pay-in-Advance Offer subscription or other purchase options.
  • vCPU 配额 - 可能需要增大 vCPU 配额才能部署大型群集或多个 MATLAB 分布式计算服务器群集。vCPUs quota - You might need to increase the vCPU quota to deploy a large cluster or more than one MATLAB Distributed Computing Server cluster. 若要增加配额,可免费 建立联机客户支持请求To increase a quota, open an online customer support request at no charge.
  • MATLAB、并行计算工具箱和 MATLAB 分布式计算服务器许可证 - 脚本假设所有许可证都使用 MathWorks Hosted License ManagerMATLAB, Parallel Computing Toolbox, and MATLAB Distributed Computing Server licenses - The scripts assume that the MathWorks Hosted License Manager is used for all licenses.
  • MATLAB 分布式计算服务器软件 - 会安装在用作群集 VM 基本 VM 映像的 VM 上。MATLAB Distributed Computing Server software - Will be installed on a VM that will be used as the base VM image for the cluster VMs.

大致步骤High level steps

若要对 MATLAB 分布式计算服务器群集使用 Azure 虚拟机,必须执行以下概要步骤。To use Azure virtual machines for your MATLAB Distributed Computing Server clusters, the following high-level steps are required. GitHub上的快速入门模板和脚本随附的文档中提供了详细说明。Detailed instructions are in the documentation accompanying the quickstart template and scripts on GitHub.

  1. 创建基本 VM 映像Create a base VM image

    • 在此 VM 上下载并安装 MATLAB 分布式计算服务器软件。Download and install MATLAB Distributed Computing Server software onto this VM.

      备注

      此过程可能需要几个小时,但使用的每个 MATLAB 版本只需执行此操作一次。This process can take a couple of hours, but you only have to do it once for each version of MATLAB you use.

  2. 创建一个或多个群集Create one or more clusters

    • 使用提供的 PowerShell 脚本或使用快速入门模板,通过基本 VM 映像创建群集。Use the supplied PowerShell script or use the quickstart template to create a cluster from the base VM image.
    • 使用提供的 PowerShell 脚本管理群集,此脚本可让你列出、暂停、恢复和删除群集。Manage the clusters using the supplied PowerShell script which allows you to list, pause, resume, and delete clusters.

群集配置Cluster configurations

目前,群集创建脚本和模板可让你创建单个 MATLAB 分布式计算服务器拓扑。Currently, the cluster creation script and template enable you to create a single MATLAB Distributed Computing Server topology. 如果需要,可以另外创建一个或多个群集,每个群集可以包含不同数量的辅助角色 VM、使用不同的 VM 大小,等等。If you want, create one or more additional clusters, with each cluster having a different number of worker VMs, using different VM sizes, and so on.

Azure 中的 MATLAB 客户端和群集MATLAB client and cluster in Azure

MATLAB 客户端节点、MATLAB 作业计划程序节点和 MATLAB 分布式计算服务器“辅助角色”节点全都配置为虚拟网络中的 Azure VM,如下图所示。The MATLAB client node, MATLAB Job Scheduler node, and MATLAB Distributed Computing Server "worker" nodes are all configured as Azure VMs in a virtual network, as shown in the following figure.

  • 若要使用群集,请通过远程桌面连接到客户端节点。To use the cluster, connect by Remote Desktop to the client node. 客户端节点运行 MATLAB 客户端。The client node runs the MATLAB client.
  • 客户端节点具有可供所有辅助角色访问的文件共享。The client node has a file share that can be accessed by all workers.
  • MathWorks Hosted License Manager 用于检查所有 MATLAB 软件的许可证。MathWorks Hosted License Manager is used for the license checks for all MATLAB software.
  • 默认情况下,会在辅助角色 VM 上为每个 vCPU 创建一个 MATLAB 分布式计算服务器辅助角色,但可以指定任意数目。By default, one MATLAB Distributed Computing Server worker per vCPU is created on the worker VMs, but you can specify any number.

使用基于 Azure 的群集Use an Azure-based Cluster

与其他类型的 MATLAB 分布式计算服务器群集一样,需要在 MATLAB 客户端(位于客户端 VM 上)中使用群集配置文件管理器来创建 MATLAB 作业计划程序群集配置文件。As with other types of MATLAB Distributed Computing Server clusters, you need to use the Cluster Profile Manager in the MATLAB client (on the client VM) to create a MATLAB Job Scheduler cluster profile.

群集配置文件管理器

后续步骤Next steps

  • 有关在 Azure 中部署和管理 MATLAB 分布式计算服务器群集的详细说明,请参阅包含模板和脚本的 GitHub 存储库。For detailed instructions to deploy and manage MATLAB Distributed Computing Server clusters in Azure, see the GitHub repository containing the templates and scripts.
  • 有关 MATLAB 和 MATLAB 分布式计算服务器的详细文档,请转到 MathWorks 站点Go to the MathWorks site for detailed documentation for MATLAB and MATLAB Distributed Computing Server.