# Difference between revisions of "Using the MATLAB service"

(Using the MDCS on Euler) |
(Expands MDCS documentation with example usage.) |
||

Line 16: | Line 16: | ||

Still having problems? [[Setting_up_the_MDCS|The full setup instructions are on a separate page.]] | Still having problems? [[Setting_up_the_MDCS|The full setup instructions are on a separate page.]] | ||

+ | |||

+ | == Usage == | ||

+ | |||

+ | Refer to Mathwork's [http://www.mathworks.com/help/distcomp/index.html Parallel Computing Toolbox (PCT)] documentation on how to make use of Euler in your code. | ||

+ | |||

+ | Code that uses <tt>parfor</tt> or other PCT constructs can use the Euler MDCS by referring to the Euler cluster profile. For example, | ||

+ | cluster = parcluster('Euler'); | ||

+ | squares = zeros(10,1); | ||

+ | parpool(cluster,4); | ||

+ | parfor i = 1:10 | ||

+ | squares(i) = i^2; | ||

+ | end | ||

+ | disp(squares) | ||

+ | |||

+ | If you set Euler [http://www.mathworks.com/help/distcomp/clusters-and-cluster-profiles.html#brb8drr-1 to be the default cluster profile], then you need no changes to your code: all of the PCT constructs will use Euler by default. |

## Revision as of 16:07, 11 November 2016

## Introduction

The MATLAB Distributed Computing Server (MDCS) is a service for offloading computationally-intensive calculations from your workstation to the Euler computer cluster as transparently as possible.

The most common use case is offloading a computationally-intensive `parfor` loop, which takes more than several hours to run on a normal workstation.

## Setup

Quick setup:

- Install MATLAB version 8.5 (R2015a) on your workstation.
- (optional but recommended) Open your firewall from 10.205.0.0/19 to ports 27370–27470 on your workstation.
- Unpack the MATLAB interface files for Euler into
`Documents\MATLAB`(Windows) or`~/Documents/MATLAB`(Linux, Mac). - Import the
`Euler_8.5.settings`cluster profile into MATLAB. - Log in to Euler to accept the usage agreement (if you are not already an Euler user)
- Validate the Euler cluster profile.

Still having problems? The full setup instructions are on a separate page.

## Usage

Refer to Mathwork's Parallel Computing Toolbox (PCT) documentation on how to make use of Euler in your code.

Code that uses `parfor` or other PCT constructs can use the Euler MDCS by referring to the Euler cluster profile. For example,

cluster = parcluster('Euler'); squares = zeros(10,1); parpool(cluster,4); parfor i = 1:10 squares(i) = i^2; end disp(squares)

If you set Euler to be the default cluster profile, then you need no changes to your code: all of the PCT constructs will use Euler by default.