User`s guide
for
11-99
for
for-loop over distributed range
Syntax
for variable = drange(colonop)
statement
...
statement
end
Description
The general format is
for variable = drange(colonop)
statement
...
statement
end
The colonop is an expression of the form start:increment:finish or
start:finish. The default value of increment is 1. The colonop is partitioned by
codistributed.colon into numlabs contiguous segments of nearly equal length. Each
segment becomes the iterator for a conventional for-loop on an individual worker.
The most important property of the loop body is that each iteration must be independent
of the other iterations. Logically, the iterations can be done in any order. No
communication with other workers is allowed within the loop body. The functions that
perform communication are gop, gcat, gplus, codistributor, codistributed,
gather, and redistribute.
It is possible to access portions of codistributed arrays that are local to each worker, but
it is not possible to access other portions of codistributed arrays.
The break statement can be used to terminate the loop prematurely.