LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why not a parallel control structure?

I often come across the need to run several identical and independent operations at the same time. I almost always end up doing them sequentially instead because I can use a for loop for this. It would be a great asset to parallel programming if there was a "for loop" like structure that ran all iterations at the same time (multithreaded, reentrant support, of course). One could then send a command and wait for a response on several instruments at once (in parallel) without having to spend as much time waiting sequentially for each to complete. The input tunnels could be arrays in which the number of elements determined the number of simultaneous panes running each with its own member of the array. The iteration terminal could output
a sequential number for each logically parallel pane as well. For debug the user could have a way to select which pane to view as all would be running. The output tunnels could also be arrays. Each pane would operate independently from all the others. I think that this is a very useful suggestion and should be incorporated into the product even though it is less intuitive than the other control structures. It provides a capability that currently is hard to attain (though not impossible) but often useful in constructing time efficient hardware control.
0 Kudos
Message 1 of 4
(2,700 Views)
Larry,

You can now file a suggestion via Contact NI. Click on Product Feedback
. Maybe in LabVIEW 8...
0 Kudos
Message 2 of 4
(2,700 Views)
I would like to know if anyone out there has had a similar idea or finds this suggestion useful. If so, would you add anything to it or keep it simple. I have raised this with NI about two years ago thinking that it would not require a huge architectural change but rather a compiler addition only but it has yet to surface in the last three releases. If more people think it would be worthwhile then maybe something could be done. Thanks, for your input.
0 Kudos
Message 3 of 4
(2,700 Views)
> I have raised this with NI about two years ago
> thinking that it would not require a huge architectural change but
> rather a compiler addition only but it has yet to surface in the last
> three releases.

Adding a structure like this would be a decent amount of work. It would
be yet another way of specifying parallel diagrams. I'm not saying that
LV will never add a structure to make something like this easier, but it
is more than ajust a compiler tweak. In the meantime, try something
like the following.

Place your code to do instrument control in a VI.
Make the VI reentrant.
Decide how many parallel tasks you want to carry out. Yes, this is
static, but there are real limits to how many of these that can be
carried out anyway.
So something like two or four is probably a good
start. Four threads is how many threads LV now spins up for the
standard execution system by default in LV7 so that seems like a good
number.
In your For loop, place N of the reentrant subVIs, index out the
elements and pass them to the subVI.
Make sure the subVI tests for a refnum of not a refnum so that you can
handle indexing past the array.

This pattern, especially with a diagram comment, should make it pretty
obvious that you have unrolled the loop and should make it pretty easy
to change the unrolling number.

Greg McKaskle
0 Kudos
Message 4 of 4
(2,700 Views)