LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can two parallel while loops have the same stop control?

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

 

I may not be perfect, but I'm all I got!
0 Kudos
Message 11 of 23
(2,661 Views)

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. 

0 Kudos
Message 12 of 23
(2,652 Views)

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

I may not be perfect, but I'm all I got!
0 Kudos
Message 13 of 23
(2,642 Views)
Yes. They'll run in parallel.

Do the experiment: run the vi and watch the task manager. Two cpus will be at 100%.
0 Kudos
Message 14 of 23
(2,628 Views)

That actually didnt quite answer my question, but I get what you said!

 

V

I may not be perfect, but I'm all I got!
0 Kudos
Message 15 of 23
(2,622 Views)

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. 

0 Kudos
Message 16 of 23
(2,618 Views)

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

Message Edited by VeeJay on 04-14-2010 01:57 PM
I may not be perfect, but I'm all I got!
0 Kudos
Message 17 of 23
(2,613 Views)

I guess its a matter of language.

 

  1. Several loops (for and while, and timed) can run in parallel if they have no data dependency.
  2. New in 2009, there is the "parallel FOR loop" that can execute several iteration at once on multiple CPUs if the code allows (e.g. if each iteration is independent).
  3. Even a single loop can use multiple CPUs, for example if the loop diagram contains operations that can execute in parallel.
  4. A timed loop can be assigned to a certain CPU if desired.

 

0 Kudos
Message 18 of 23
(2,586 Views)

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

Message Edited by VeeJay on 04-14-2010 02:38 PM
I may not be perfect, but I'm all I got!
0 Kudos
Message 19 of 23
(2,581 Views)

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.) 

0 Kudos
Message 20 of 23
(2,575 Views)