Parallel MATLAB Instructions for Discover
Index
1. Log Into Discover
Log into Discover using ssh with X11 forwarding with the following command:
$ ssh -X userid@login.nccs.nasa.gov
| Top
of Page |
2. Submit an Interactive PBS Job to Access MATLAB
The following command will submit an interactive job to the correct node that has access to run the MATLAB client with all the correct licenses. Issue the following command:
$ xsub -I -W group_list=computational_project -l select=trial=true -l walltime=01:00:00 -q visual
OUTPUT
Establishing X forwarding and submitting batch job...
The authenticity of host 'discover07 (10.1.50.7)' can't be
established.
RSA key fingerprint is
05:85:dd:d2:f7:b8:b7:38:14:f1:92:7f:24:9d:05:4c.
Are you sure you want to continue connecting (yes/no)? yes
qsub: waiting for job 768102.borgmg to start
qsub: job 768102.borgmg ready
Thu Jul 24 10:33:32 EDT 2008
$
Note that if asked to verify the authenticity of the login host, type .yes.. Once a prompt is returned, verify that you are on the visor09 node by the following:
$ hostname
visor09
$
| Top
of Page |
3. What do I do if I get the following error? "It doesn't look like your $DISPLAY is set appropriately. Please contact User Support for assistance.."
You did not ssh into Discover with the -X option. Log out or exit, and issue the ssh command with the -X option as described above.
| Top
of Page |
4. What do I do if I get the following error? "It doesn't look like your ssh keys are setup properly. Please contact User Support for assistance.."
Users must set up password-less ssh keys in order to use PBS and allow the X11 forwarding to be set up without having to enter a password. If a user receives this error, follow these steps
(Click here for more information):
$ cd .ssh
$ ssh-keygen -t dsa
$ cp id_dsa.pub authorized_keys
Once this is done, re-issue the xsub command from above.
| Top
of Page |
5. Load MATLAB Module
Once the interactive PBS job starts, users will be logged on to one of the visualization nodes. The first step will be to load the MATLAB module using the following command:
$ module load tool/matlab-R2008a
$ which matlab
/discover/vis/mathworks/matlab_R2008a/bin/matlab
$
| Top
of Page |
6. Launch MATLAB
Run the following command to launch a MATLAB session:
$ matlab
| Top
of Page |
7. Import the PBS MATLAB Configuration File
Once the MATLAB window has appeared on the screen, users must import a PBS configuration file by clicking on the following tabs: Parallel -> Managed Configuration. A new window will appear called the Configurations Manager, and click on File -> Import. Under the Import Configuration window, enter the following path and file name:
/discover/vis/mathworks/matlab_R2008a/share/PBS.mat
Then exit the Import Configuration window. This configuration will allow for up to 15 workers across 4 nodes to be used in parallel. Users should only have to do this the first time that parallel MATLAB is invoked.
| Top
of Page |
8. Verify MATLAB is Using the PBS Configuration File
After the configuration file has been entered, verify that the current instance of MATLAB is using the PBS parallel configuration file by clicking on Parallel -> Select Configuration and choosing the PBS configuration.
| Top
of Page |
9. Simple Parallel MATLAB Test
sched = findResource('scheduler','configuration','PBS');
pj = createParallelJob(sched);
createTask(pj, @labindex, 1, {});
set(pj, 'MaximumNumberOfWorkers', 12);
set(pj, 'MinimumNumberOfWorkers', 12);
submit(pj)
waitForState(pj, 'finished', 60)
results = getAllOutputArguments(pj)
| Top
of Page |
10. Task-Parallel Example with Jobs and Tasks
sched = findResource('scheduler','configuration','PBS');
job2 = createJob(sched);
createTask(job2, @sum, 1, {[1 1]});
createTask(job2, @sum, 1, {[2 2]});
createTask(job2, @sum, 1, {[3 3]});
submit(job2)
waitForState(job2, 'finished')
results = getAllOutputArguments(job2)
| Top
of Page |
11. Task-Parallel Example with a MATLAB pool
mpj = createMatlabPoolJob('configuration','PBS');
createTask(mpj, @sum, 1, {[1 1]});
set(mpj, 'MaximumNumberOfWorkers', 3);
set(mpj, 'MinimumNumberOfWorkers', 3);
submit(mpj)
waitForState(mpj, 'finished')
results = getAllOutputArguments(mpj)
| Top
of Page |
12. Data-Parallel Example
sched = findResource('scheduler','configuration','PBS');
pj = createParallelJob(sched);
createTask(pj, @labindex, 1, {});
set(pj, 'MaximumNumberOfWorkers', 12);
set(pj, 'MinimumNumberOfWorkers', 12);
submit(pj)
waitForState(pj, 'finished')
results = getAllOutputArguments(pj)
| Top
of Page |
|