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

  • 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 99
4 Interactive Parallel Computation with pmode
4-6
8
Until this point in the example, the variant arrays are independent, other than
having the same name. Use the codistributed.build function to aggregate the
array segments into a coherent array, distributed among the workers.
P>> codist = codistributor1d(2, [2 2 2 2], [3 8])
P>> whole = codistributed.build(segment, codist)
This combines four separate 3-by-2 arrays into one 3-by-8 codistributed array. The
codistributor1d object indicates that the array is distributed along its second
dimension (columns), with 2 columns on each of the four workers. On each worker,
segment provided the data for the local portion of the whole array.
9
Now, when you operate on the codistributed array whole, each worker handles the
calculations on only its portion, or segment, of the array, not the whole array.
P>> whole = whole + 1000
10
Although the codistributed array allows for operations on its entirety, you can use
the getLocalPart function to access the portion of a codistributed array on a
particular worker.
P>> section = getLocalPart(whole)
Thus, section is now a variant array because it is different on each worker.
11
If you need the entire array in one workspace, use the gather function.
Vue de la page 99
1 2 ... 95 96 97 98 99 100 101 102 103 104 105 ... 655 656

Commentaires sur ces manuels

Pas de commentaire