04-14-2010 12:24 PM
hi guys,
This question may be trivial or stupid, but I can't get it out of my head.
Can we call two separate while loops doing separate things yet communicating with each other "Parallel Loops"?.
What is the difference between having a duo core processor in running parallel loops and running two separate while loops on a single core processor? I was reading this tutorial on ni.com "Improving Performance with Parallel For Loops" and this sparked this doubt in my mind. From reading this article, what I get is that parallel loops is basically running a single loop by sub dividing it into more loops using the duo core advantage. Is my assumption right here?
Thanks!
V
04-14-2010 12:41 PM
Two different questions:
Communicating with parallel loops: there are lots of methods, and this question gets asked all the time. It was asked just recently, in fact. Just do a search and you'll find many suggestions, including global variables, queues, notifiers, etc., depending on what you're trying to accomplish.
Regarding parallel loops and multiple cores: what is your doubt? The article is fairly self-explanatory. If you have multiple cores then you parallelize a loop so that work can occur on more than one core at the same time. Prior to 2009 you'd have to manually create parallel for loops. The LabVIEW compiler would be smart enough to run each one on a separate core, if your computer had more than one core.
04-14-2010 01:07 PM
Ok! to simplify the question, Can the loops in the image shown be called Parallel loops? Would they run simultaneously? Or is Parallel loops a whole another thing related to cores of the processor?
V
04-14-2010 01:30 PM
04-14-2010 01:40 PM
That actually didnt quite answer my question, but I get what you said!
V
04-14-2010 01:44 PM
VeeJay wrote:That actually didnt quite answer my question,
Why not? Seems perfectly clear to me, and this is even documented, so I don't understand what kind of answer you're looking for.
04-14-2010 01:51 PM - edited 04-14-2010 01:57 PM
The concept parallel loops; Is it that a SINGLE loop can be run faster using different cores of the machine? (as in parallelizing)
as opposed to
the diagram that I showed before: Running two loops on a single core processor.
(One Loop, two cores or two loops, one core or two loops, two cores )
V------J
04-14-2010 02:32 PM
I guess its a matter of language.
04-14-2010 02:38 PM - edited 04-14-2010 02:38 PM
Thank you! That clarified a lot!!
_________________________________________________________________________________________
quote "Several loops (for and while, and timed) can run in parallel if they have no data dependency. "
_____________________________________________________________________________________
What if they do communicate with each other (having data dependency) in terms of one loop sending the command to another and the other sending its feedback?
Thanks! 🙂
VJ
04-14-2010 02:46 PM
Any "wireless" data dependency is fine. Of course things will not be synchronous.
(The details can be more complicated. For example if you use queues, the consumer loop may need to wait until the produce loopr places something into the queue, etc.)
(I was talking about a flow dependency, for example if a wire goes from one loop to the other. The second loop can only start if all inputs have data, which only occurs once the first loop has completed.)