Skip to main content.
Arizona State University College of Liberal Arts and Sciences
Department of Mathematics and Statistics
Navigation:

Home

Search





Matlab Distributed Computing

The procedure of running your code using MatLab Distributed Computing ToolBox

  1. The architecture of Matlab Distributed Computing Engine/Toolbox

  2. Start MCDE deamons, job managers, and workers. These should be done by the administrator.

  3. Launch your matlab and run your code.

    1. 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).

    2. 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);

    3. Create a job: createJob

      Create job j on the jobmanager.

      j = createJob(jm);

    4. 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]});

    5. 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);

    6. 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]

  4. 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/'});

  5. FAQ
  6. For more detail, please go to MathWorks.

  7. Matlab using TORQUE Scheduler