Configuring the MATLAB Parallel Computing Toolbox at OSC

The following contains instructions on how to configure the MATLAB Parallel Computing Toolbox for use at OSC. These instructions assume that you have the MATLAB Parallel Computing Toolbox installed on your desktop computer. For a tutorial on using the MATLAB Parallel Computing Toolbox at OSC, click here.

  1. Download the necessary configuration files from here. Save these files in a directory such as C:\Documents and Settings\<your_local_username>. This directory will be referred to in the proceeding instructions as <OSC_CONFIG_DIR>.
  2. Start MATLAB on your desktop. Within MATLAB, use the cd command to move to the directory in which the configuration files are stored, i.e. cd(‘<OSC_CONFIG_DIR>’).
  3. Unzip the configuration files using the command unzip osctools.zip.
  4. Use the cd command to change to the relative directory osctools\common, e.g. cd ‘osctools\common’.
  5. Run the command oscsetup. A prompt like the one below will appear. Enter your OSC username and click “OK.”

    Enter

  6. Text similar to the following will appear: “In order to complete the setup process, we need to connect to glenn.osc.edu. You will be prompted for your OSC password in order to connect. Press return to continue.” Press enter. You may warned about an RSA fingerprint, as shown below.

    RSA

    Click “yes.” A prompt for your password similar to the one shown below will then appear.

    Password

    Enter your OSC password and click “OK.”

  7. Test the connection by executing an ssh command with your username and the hostname glenn.osc.edu, e.g. conn = ssh(‘humphrey’,’glenn.osc.edu’). You may again be warned about an RSA fingerprint. Click “yes.” You may also be prompted for your password again. Enter your OSC password and click “OK.”
  8. To test the configuration, run the command job = pctdemo. This runs the function pctdemo found the directory <OSC_CONFIG_DIR>\osctools\demo, which requests that a 1x1 matrix of random values, a 2x2 matrix of random values, and a 3x3 matrix of values be generated in parallel. Once the function is executed, MATLAB should output something similar to

    Job

    followed by additional information.

  9. Check the status of your job by using the command get(job,’State’). The result should be queued, running, or finished. Continue running this command periodically until the result is finished.
  10. Get the results of the job using the command outputs = getAllOutputArguments(job). In this case, the result should be a 3-by-1 cell array. Each result can be obtained using the commands outputs{1}, outputs{2}, and outputs{3}.
  11. The MATLAB Parallel Computing toolbox creates a lot of extra files in order to run a job. Once you have the outputs from your job, you can clean up the job files on your local machine using the command destroy(job).
  12. Once you are finished using the Parallel Computing Toolbox, you can close the ssh connection using the command disconnect(conn).
  13. The command destroy(job) will also get rid of files on Glenn. However, you may occasionally forget to issue this command after a job is finished. You can simply delete files from finished jobs on your local machine. To delete the job files on the remote machine, log into the cluster using a file transfer utility such as the Filezilla client (http://filezilla-project.org). To use Filezilla on Glenn, run it and under the “File” menu, select “Site Manager.” In the site manager window, as shown below, press the “New Site” button, and label the new site, e.g. Glenn. Under “Site details,” use glenn.osc.edu for “Host,” select “SFTP using SSH2” for “Servertype,” select “Normal” for “Logontype,” type your OSC username for “User,” and select “Don’t save password” for better security. Once you have done this, press the “Connect” button to connect to Glenn. You will be prompted to enter your OSC password. You may also be prompted to accept a host key; press “Yes.”

    Enter

  14. Once connected, files on the remote system will be displayed on the right-hand side under “Remote Site,” as shown below. Scroll to the “matlab” directory, double-click it, then double-click the jobs directory. This directory contains subdirectories such as “Job1,” “Job2,” “Job3,” etc. Once you are done running your jobs, you can delete these directories to clear up disk space.

    Files

Troubleshooting

Problem: After connecting to glenn.osc.edu, I try to run the command job = pctdemo, but   MATLAB says:

??? Job submission did not occur because user supplied

SubmitFcn (oscSimpleJobSubmitFcn) failed with the following error:

Error using ==> oscSimpleJobSubmitFcn>iCopyFilesToCluster at 119

Please connect to remote host before submitting a job

Solution: The problem usually occurs if you disconnect then reconnect. Restarting   MATLAB and connecting to glenn.osc.edu again should correct the problem.