Specify a function to invoke after all parallel.Futures complete
automatically evaluates outputFuture
= afterAll(futures
,funtocall
,nout
)funtocall
on the output arguments of
all the futures in futures
when they are all complete, and
returns outputFuture
to hold the result.
afterAll
evaluates funtocall
on the
vertical concatenation of the output arguments of all futures. If the number of
output arguments of the elements in futures differ, afterAll
uses the minimum and disregards the ending output arguments.
afterAll
invokes funtocall
with
nout
output arguments.
A useful application for afterAll
is to update user
interfaces such as plots and apps during parallel computations using parfeval
. For example, you can
send several computations to workers using parfeval
and update your user
interface when all of them finish using afterAll
.
behaves the same if outputFuture
= afterAll(futures
,funtocall
,nout
,'PassFuture',passFuture
)passFuture
is false
. If
passFuture
is true
,
afterAll
invokes funtocall
on the
array of futures futures
and not on their output arguments.
This happens even if elements of futures
encountered
errors.
Use afterAll
on any of the futures returned from
parfeval
, parfevalOnAll
, afterEach
, afterAll
, or an array containing
a combination of them. For example, use afterAll
to
automatically invoke more functions on the results of another afterEach
or afterAll
. You can invoke
afterAll
on futures before and after they
finish.
Use cancel
on a future returned
from afterAll
to cancel its execution. If you invoke
afterAll
on a canceled future, this results in the same
behavior as if the future encountered an error.