01-13-2017 01:29 PM
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.
Once I separated each command into two different while loops (illustrated below), they ran in parallel.
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.
01-13-2017 01:48 PM
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
01-13-2017 01:58 PM
How do you determine whether they are executing in parallel or not?
01-13-2017 02:16 PM
@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.
01-13-2017 02:18 PM - edited 01-13-2017 02:20 PM
@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???
01-13-2017 02:24 PM
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.
01-13-2017 02:29 PM
Can you show us the entire code of the upper picture without the truncation on the left and right
01-13-2017 02:30 PM
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.
01-13-2017 02:32 PM
@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.
01-13-2017 02:33 PM - edited 01-13-2017 02:35 PM
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. 😄