LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to tell which commands will run in parallel?

Hello

 

This is a follow up on a previous discussion.  

Is there a way to know when Labview will run a set of commands together or in parallel?  Is there any kind of post-compile tool that can report this?  

 

I was trying to read from two Ocean Optics USB Spectrometers at the same time.  My originall code (illustrated below) ran one command at a time in series.

3.PNG

Once I separated each command into two different while loops (illustrated below), they ran in parallel.

4.PNG

 

To me it seems both should run in parallel.  Is there a way to check how labview will build a block diagram and remove the guesswork?

 

**I have chosen not to include a VI since it is a general question.

0 Kudos
Message 1 of 22
(4,237 Views)

LabVIEW is a Data Flow language.  If there is no "dependency" between two pieces of code, LabVIEW will try to run them independently of each other.  Both your original illustration with two "getSpectrum" calls, and your lower illustration with the two calls in parallel loops should run in parallel, unless (of course) the "getSpectrum" function is a single thing that only exists in one place and runs at one time.  [That's a bit vague, isn't it?  The analogy is you and I are in a restaurant and each order a hamburger from different waitresses.  They (in parallel) to go the cook and say "Make a hamburger", but there's only one cook, and his grill is too small to make more than one hamburger at a time, so he is forced to "serialize" the two parallel requests.

 

I can tell you that with LabVIEW, I am able to acquire images from 24 video cameras running at 30fps in parallel (though I'm not saving all of them to disk ...).

 

Bob Schor

0 Kudos
Message 2 of 22
(4,218 Views)

How do you determine whether they are executing in parallel or not?

0 Kudos
Message 3 of 22
(4,213 Views)

@Gregory wrote:

How do you determine whether they are executing in parallel or not?


They read from hardware that spits out feedback signals which I can view on an oscilloscope.  

0 Kudos
Message 4 of 22
(4,198 Views)

@fsTAS wrote:

 Is there a way to check how labview will build a block diagram and remove the guesswork?

 


You are building the block diagram and the compiler will compile it. Yes both loops will run in parallel as much as the hardware allows. Of course there could be issues of reentrancy with the .net stuff and LabVIEW has no control over that.

 

Of course just looking at your code, the blatant overuse of value property nodes and greedy loops tells me that you are a brand new LabVIEW user. Maybe you should familiarize yourself with the simple stuff first before trying to tackle advanced tasks. Have you ever looked at the CPU use when the program is doing nothing but waiting for the next buttons???

0 Kudos
Message 5 of 22
(4,194 Views)

 


but there's only one cook, and his grill is too small to make more than one hamburger at a time

That's a small grill haha.  

I like Labview a lot, just like any good tool, it's good at what it does.  I'm really not sure where the source of the problem with the first illustration comes from, whether it's the way the driver (wrapper?) was written, or the way the driver and labvew communicate.  

 

For now I can use the oscilloscope for verify my code, I was just wondering if there was an easeir way I was unaware of.  

0 Kudos
Message 6 of 22
(4,189 Views)

Can you show us the entire code of the upper picture without the truncation on the left and right

0 Kudos
Message 7 of 22
(4,183 Views)

Of course just looking at your code, the blatant overuse of value property nodes and greedy loops tells me that you are a brand new LabVIEW user. 

 

haha new user yes.  I made that as a quick illustration and is not code I'm running.  My actual code is more complicated and I use Wait until next ms multiple commands in my wait loops.

 

On the value property nodes I have no idea what overuse would be.  If you can take a look at my real code and let me know if there is any, I would appreciate it.


 

0 Kudos
Message 8 of 22
(4,179 Views)

@altenbach wrote:

Can you show us the entire code of the upper picture without the truncation on the left and right


I can but... I re-wrote it already, so I'll have to make a copy and put it back to how it was.  I don't think it'll take too long and will post when I finish.   

0 Kudos
Message 9 of 22
(4,175 Views)

Perhaps you have two .NET refs in the lower one, but only one in the upper one?  So in the top one, the cook has only one burner but in the bottom he has two?

 

edit:

sorry you posted before I did, so it looks like I was working with stale data.  😄

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 22
(4,173 Views)