Thanks for the responses, spmd looks like what I'll need. I'll implement it tomorrow and let you know how it goes.
How can I run two code blocks in parallel?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a few lines of code that I need to run at 200hz (publishing data). I have other code that currently only runs at <100hz, and I doubt I can optimise it far enough to run at 200hz. The data published in the first block of code is generated by the second, but so long as it is publishing at 200hz it won't matter if it is only actually sending new data on every second publish.
I tried parfor, but this doesn't seem like the right solution - as far as I can gather, it runs iterations of the same parfor loop in parallel, whereas I want to run two different blocks of code in parallel (publishing and calculating).
I have access to all toolboxes (academic licence).
Appreciate any help :)
Antworten (2)
Edric Ellis
am 24 Sep. 2013
An alternative to BATCH might be SPMD. You could do something like this:
spmd(2)
if labindex == 1
% do first thing
else
% do the other thing
end
end
Inside an SPMD block you can also use the labSend family of functions to exchange data if necessary.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Loops and Conditional Statements finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!