Topics Map > •Research Computing

CRC Set up MATLAB Parallel Computing Toolbox from a cluster login node on NOTS

The purpose of this HOWTO is to enable a user who has parallel compatible code (e.g. parfor loops, spmd loops, and the like) to submit cluster jobs through the MATLAB client from the login node of one of our clusters.

The purpose of this HOWTO is to enable a user who has parallel compatible code (e.g. parfor loops, spmd loops, and the like) to submit cluster jobs through the MATLAB client from the login node of one of our clusters.

Prerequisites

  • Parallelize your code according to Mathworks' documentation (links at the bottom of this page). An example script is provided later in the HOWTO.
  • Establish password-less ssh access between nodes
  • Create a shared data location for MATLAB jobs. We use ~/MdcsDataLocation but this also could be a directory in $SHARED_SCRATCH. If you choose to change this, you will need to edit the parallel cluster configuration as described later.
  • Load the Matlab environment module 

    $ module load MATLAB/2015a
  • Start matlab 

    $ matlab -nodisplay

    You can run MATLAB graphically if you have an OS or client that can handle tunneled X Window connections, but that is beyond the scope of this document. All commands should work in the command window as well as on the command line interface.

Import a Cluster Configuration

This step only has to be performed once. Once imported, the profile will persist through multiple MATLAB runs. For each cluster the profile includes cluster settings for all available queues. The following commands, run on NOTS, will import the profiles and set Commons as the default:

configCluster
Clearing all ClusterInfo settings.
 
Before submitting a job to NOTS, you must specify the wall time.
 
        >> % E.g. set wall time to 1 hour
        >> ClusterInfo.setWallTime('01:00:00')

Wall time

Specifying job time (wall time) is required before submitting a job via matlab and validating a cluster parallel profile. Here are two examples, please be as accurate as possible to minimize your wait time.

Set walltime for 1 hour
ClusterInfo.setWallTime('01:00:00')
Set wall time for 8 hours. Syntax is HH:MM:SS.
ClusterInfo.setWallTime('8:00:00')

Optimal use of the Cluster Configuration

For performance and file quota reasons, please have your workspace in $SHARED_SCRATCH/your-userid/. In order to do this, you must first create a workspace directory and then modify your cluster configuration to use the new workspace configuration. To change the location for your default profile you can run something like the following in MATLAB:

workdir = [getenv('SHARED_SCRATCH') filesep getenv('USER') filesep 'MdcsDataLocation'];
mkdir(workdir);
 
pc = parcluster;
set(pc, 'JobStorageLocation', workdir);
p.saveProfile;



KeywordsCRC Set up MATLAB Parallel Computing Toolbox from a cluster login node on NOTS   Doc ID108424
OwnerJoseph G.GroupRice U
Created2021-01-19 14:14:44Updated2024-04-22 15:06:32
SitesRice University
Feedback  6   9