Prerequisites:

A. Your system must be configured to use the EASE Kerberos system in order to login to eddie without password. Instructions on how to do so can be found in Using Kerberos in Linux.

B. You must set up a shared directory between eddie and your client side. (i.e. mount a NFS disk from eddie export nodes)

C. You need install Matlab Distributed Computing Toolbox together with your Matlab. Seperate license file for Toolbox is required on your machine.

D. Your Matlab Toolbox need be configured with several functions and scripts provided by ECDF-Systems-Team.

Programming and submitting jobs in client The following shows two example sessions of one distributed job and one parallel job

Example1 Distributed Job

% Create a scheduler object

>> sched = findResource('scheduler', 'type', 'generic');


% Set scheduler parameters, user should change the Data Location

>> set(sched, 'DataLocation', '/exports/work/is_iti_ug/ywan/matlab-test')
>> set(sched, 'HasSharedFilesystem',true)
>> set(sched, 'ClusterMatlabRoot', '/usr/local/Cluster-Apps/matlab-mdce')
>> set(sched, 'SubmitFcn',@sgeSubmitFcn)


% Create a job

>> j = createJob(sched);


% Create tasks for this job

>> createTask(j, @sum, 1, {[1 1]});
>> createTask(j, @sum, 1, {[2 2]});
>> createTask(j, @sum, 1, {[3 3]});
>> createTask(j, @sum, 1, {[4 4]});


% Submit the job to job queue

>> submit(j)

scriptName =

/exports/work/is_iti_ug/ywan/sgeWrapper.sh

Submitting task 1
ssh eddie.ecdf.ed.ac.uk ". /exports/work/is_iti_ug/ywan/my_matlab_env.sh; qsub -cwd -N Job2.1 -j yes -o "/exports/work/is_iti_ug/ywan/matlab-test/Job2_Task1.out" "/exports/work/is_iti_ug/ywan/sgeWrapper.sh""
Job output will be written to: /exports/work/is_iti_ug/ywan/matlab-test/Job2_Task1.out
QSUB output: Your job 3722203 ("Job2.1") has been submitted

Submitting task 2
ssh eddie.ecdf.ed.ac.uk ". /exports/work/is_iti_ug/ywan/my_matlab_env.sh; qsub -cwd -N Job2.2 -j yes -o "/exports/work/is_iti_ug/ywan/matlab-test/Job2_Task2.out" "/exports/work/is_iti_ug/ywan/sgeWrapper.sh""
Job output will be written to: /exports/work/is_iti_ug/ywan/matlab-test/Job2_Task2.out
QSUB output: Your job 3722204 ("Job2.2") has been submitted

Submitting task 3
ssh eddie.ecdf.ed.ac.uk ". /exports/work/is_iti_ug/ywan/my_matlab_env.sh; qsub -cwd -N Job2.3 -j yes -o "/exports/work/is_iti_ug/ywan/matlab-test/Job2_Task3.out" "/exports/work/is_iti_ug/ywan/sgeWrapper.sh""
Job output will be written to: /exports/work/is_iti_ug/ywan/matlab-test/Job2_Task3.out
QSUB output: Your job 3722205 ("Job2.3") has been submitted

Submitting task 4
ssh eddie.ecdf.ed.ac.uk ". /exports/work/is_iti_ug/ywan/my_matlab_env.sh; qsub -cwd -N Job2.4 -j yes -o "/exports/work/is_iti_ug/ywan/matlab-test/Job2_Task4.out" "/exports/work/is_iti_ug/ywan/sgeWrapper.sh""
Job output will be written to: /exports/work/is_iti_ug/ywan/matlab-test/Job2_Task4.out
QSUB output: Your job 3722206 ("Job2.4") has been submitted


% If you need to wait for the job to complete before you continue, do the following step

>> waitForState(j)


% Retrieve the job's results

>> results = getAllOutputArguments(j)

results = 

    [2]
    [4]
    [6]
    [8]


% Destroy the finished job

>> destroy(j)
>> 

Example2 Parallel Job

% Create a scheduler object

>> sched = findResource('scheduler', 'type', 'generic');


% Set scheduler parameters, users should change the Data Location

>> set(sched, 'DataLocation', '/exports/work/is_iti_ug/ywan/matlab-test')
>> set(sched, 'HasSharedFilesystem',true)
>> set(sched, 'ClusterMatlabRoot', '/usr/local/Cluster-Apps/matlab-mdce')
>> set(sched, 'ParallelSubmitFcn',@sgeParallelSubmitFcn)


% Create a parallel job

>> pjob = createParallelJob(sched);


% set File Dependency (for custom operation) and the number of workers

>> set(pjob, 'FileDependencies', {'colsum.m'})
>> set(pjob, 'MaximumNumberOfWorkers', 4)
>> set(pjob, 'MinimumNumberOfWorkers', 4)


% Create task of the job

>> t = createTask(pjob, @colsum, 1, {});


% Submit job

>> submit(pjob)

scriptName =

/exports/work/is_iti_ug/ywan/sgeParallelWrapper.sh

ssh eddie.ecdf.ed.ac.uk ". /exports/work/is_iti_ug/ywan/my_matlab_env.sh; qsub -cwd -N Job3 -j yes -o "/exports/work/is_iti_ug/ywan/matlab-test/Job3.mpiexec.out" -pe matlab 4 "/exports/work/is_iti_ug/ywan/sgeParallelWrapper.sh""
Job output will be written to: /exports/work/is_iti_ug/ywan/matlab-test/Job3.mpiexec.out
QSUB output: Your job 3791340 ("Job3") has been submitted


% If you need to wait for the job to complete before you continue, do the following step

>> waitForState(pjob)


% Retrieve the job's results

>> results = getAllOutputArguments(pjob)

results = 

    [136]
    [136]
    [136]
    [136]


% Destroy the finished job

>> destroy(pjob)
>> 

Lauch jobs from remote client (last edited 2007-08-27 17:14:54 by Yuan WAN)