Setting Up Matlab Parallel Server Configurations in the SSCC

SSCC users with access to our Linstat servers can execute Matlab scripts on multiple servers simultaneously using Slurm.

Start Matlab

You can use Matlab Parallel Server via the Matlab GUI.

  • Log in to Linstat

  • Launch the Matlab GUI from the Linstat command prompt. It is convenient if you run the GUI in “background” mode, so that you continue to have access to the terminal command line.

    linstat> matlab &

Configure a Parallel Server Profile

You need to configure a profile for the Slurm cluster. You can import our default profile, our create your own cluster specification.

Import the SSCC Slurm Profile (“Short 32w”)

You can begin by importing our SSCC Slurm cluster profile, and use that as a basis for creating custom profiles.

First, download SSCC_short_32w.mlsettings to your computer.

In the Matlab GUI

  • On the Home tab, in the Environment section of the toolbar, select Parallel - Create and Manage Clusters …

  • In the window that opens, select Import from the tool bar.

  • In Matlab, import the settings file you downloaded. This defines a parallel pool profile named “Short 32w”. You also have a default cluster profile named “Processes”, which will parallelize loops on Linstat itself by using multiple cores.

The Short 32w parallel pool profile has

  • up to 32 workers (potentially separate servers)
  • defaults to 4 workers
  • using 4 cores per worker, and 4 GB memory per core
  • on the “short” Slurm partition
  • temporary files will appear in your current working directory

Custom Configurations

You can create your own custom configurations to

  • use a different Slurm partition
  • use more cores per worker
  • user more memory per core
  • use more workers, or default to more workers

You could do this by

  • Duplicating and modifying the SSCC Slurm profile (see above to import this). Select the cluster profile, right-click, and pick “Duplicate” to begin this process.
  • from scratch, using Matlab’s documentation

Note the validation step. If your profile requests a lot of resources (workers, cores, memory) and you attempt to validate your profile with the full resource request, validation may take a long time while Matlab waits for Slurm to actually find those resources. Limit the number of workers you request for validation!

Using Matlab Parallel Server in the SSCC

To see this in action download primefactors.m. You can run this from the Matlab GUI, or submit it from the linux command line.

linstat> matlab -nodisplay < primefactors.m > primefactors.log &

This script illustrates how to invoke different Parallel Server profiles.