T = 10
N = 100 % number of tasks
parfor i = 1:N
% initialize "t" for each "i"
t(i) = 2;
% keep track of t(i) for each "i"
while t(i) < T
x(i) = i*2;
t(i) = t(i) + 1e-2;
end
end
In conjunction, I needed a way to detect if any `x(i)` changed for any `i` inside the while loop.
If so, then, want to perform a computation on all of `x(i)` ... would this require collecting all the terms in a common memory location?
Finally, I also needed to store `x, t` for each `i`, i.e., the above represents N-copies running in parallel ... with ref to the paragraph above, I need to collect all the `x(i)`'s to perform a computation when any one of the N `x(i)` gets updated.
0 Answer(s)