Matlab Distributed Computing
The procedure of running your code using MatLab Distributed Computing ToolBox
The architecture of Matlab Distributed Computing Engine/Toolbox

Start MCDE deamons, job managers, and workers. These should be done by the administrator.
Launch your matlab and run your code.
- Lauch the Matlab with Distributed Computing Toolbox:
You must use the Matlab with Distributed Computing Toolbox. If not, you can connect to the cluster server (opteron) and launch Matlab remotely. BUT remember, because some commands provided by the toolbox need to be run with Java Virtual Machine (JVM), YOU CAN NOT LAUNCH MATLAB WITH -nojvm FLAG (but you can use -nodesktop flag).
- Find a job manager: findResource
There should be existing at least one job manger in your local network, use findResource to locate a job manager and create the job manager object jm, which represents the
job manager in the cluster whose name is MyJobManager.
jm = findResource('jobmanager','name','MyJobManager');
Or you can find all the existing jobmanagers on the server and then choose one.
all_job_managers = findResource('jobmanager');
jm = all_job_managers(1);
- Create a job: createJob
Create job j on the jobmanager.
j = createJob(jm);
- Create tasks: createTask
Create three tasks on the job j. Each task evaluates the sum of the array that is passed as an input argument.
createTask(j, @sum, 1, {[1 1]});
createTask(j, @sum, 1, {[2 2]});
createTask(j, @sum, 1, {[3 3]});
- Submit the job to the queue: submit
The job manager moves the job into the queue to be executed when workers are available.
submit(j);
- Retrieve results: waitForState getAllOutputArguments
Wait for the job to complete, then get the results from all the job's tasks.
waitForState(j,'finished');
results = getAllOutputArguments(j)
results =
[2]
[4]
[6]
If you need to share data with the nodes (the data is in your local computer), please set it up in your job object. set
- You want to share the whole directory of /home/sting/MatLabToolBox/Sting/program/ to all compute nodes.
set(job,'FileDependencies',{'/home/sting/MatLabToolBox/Sting/program/'});
-
FAQ
For more detail, please go to MathWorks.
Matlab using TORQUE Scheduler
|