MATLAB PARALLEL COMPUTING TOOLBOX - S Guide de l'utilisateur Page 167

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 656
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 166
Apply Callbacks to MJS Jobs and Tasks
6-27
Create and save a callback function clientTaskCompleted.m on the path of the
MATLAB client, with the following content. (If you created this function for the previous
example, you can use that.)
function clientTaskCompleted(task,eventdata)
disp(['Finished task: ' num2str(task.ID)])
Create objects for the cluster, job, and task. Then submit the job. All the callback
properties are set from the profile when the objects are created.
c = parcluster('MyMJS');
j = createJob(c,'Name','Job_52a');
createTask(j,@rand,1,{2,4});
submit(j)
Job_52a now queued
Job_52a now running
Finished task: 1
Job_52a now finished
Tips
You should avoid running code in your callback functions that might cause conflicts.
For example, if every task in a job has a callback that plots its results, there is no
Vue de la page 166
1 2 ... 162 163 164 165 166 167 168 169 170 171 172 ... 655 656

Commentaires sur ces manuels

Pas de commentaire