MATLAB PARALLEL COMPUTING TOOLBOX - S Guida Utente Pagina 240

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 239
7 Program Independent Jobs
7-32
T = createTask(job1, @rand, 1, {{3,3} {3,3} {3,3} {3,3} {3,3}});
In this case, T is a 5-by-1 matrix of task objects.
4. Submit a Job to the Job Queue
To run your job and have its tasks evaluated, you submit the job to the scheduler’s job
queue.
submit(j)
The scheduler distributes the tasks of j to MATLAB workers for evaluation.
The job runs asynchronously. If you need to wait for it to complete before you continue in
your MATLAB client session, you can use the wait function.
wait(j)
This function pauses MATLAB until the State property of j is 'finished' or
'failed'.
5. Retrieve the Job's Results
The results of each task’s evaluation are stored in that task object’s OutputArguments
property as a cell array. Use fetchOutputs to retrieve the results from all the tasks in
the job.
results = fetchOutputs(j);
Display the results from each task.
results{1:5}
0.9501 0.4860 0.4565
0.2311 0.8913 0.0185
0.6068 0.7621 0.8214
0.4447 0.9218 0.4057
0.6154 0.7382 0.9355
0.7919 0.1763 0.9169
0.4103 0.3529 0.1389
0.8936 0.8132 0.2028
0.0579 0.0099 0.1987
Vedere la pagina 239
1 2 ... 235 236 237 238 239 240 241 242 243 244 245 ... 655 656

Commenti su questo manuale

Nessun commento