MATLAB PARALLEL COMPUTING TOOLBOX - S Uživatelská příručka Strana 81

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 656
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 80
Execute Simultaneously on Multiple Data Sets
3-3
Define an spmd Statement
The general form of an spmd statement is:
spmd
<statements>
end
Note If a parallel pool is not running, spmd creates a pool using your default cluster
profile, if your parallel preferences are set accordingly.
The block of code represented by <statements> executes in parallel simultaneously
on all workers in the parallel pool. If you want to limit the execution to only a portion of
these workers, specify exactly how many workers to run on:
spmd (n)
<statements>
end
This statement requires that n workers run the spmd code. n must be less than or equal
to the number of workers in the open parallel pool. If the pool is large enough, but n
workers are not available, the statement waits until enough workers are available. If n
is 0, the spmd statement uses no workers, and runs locally on the client, the same as if
there were not a pool currently running.
You can specify a range for the number of workers:
spmd (m,n)
<statements>
end
In this case, the spmd statement requires a minimum of m workers, and it uses a
maximum of n workers.
If it is important to control the number of workers that execute your spmd statement, set
the exact number in the cluster profile or with the spmd statement, rather than using a
range.
For example, create a random matrix on three workers:
spmd (3)
Zobrazit stránku 80
1 2 ... 76 77 78 79 80 81 82 83 84 85 86 ... 655 656

Komentáře k této Příručce

Žádné komentáře