LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequence or Parallel

Hi,

I have been programming LabVIEW using much of the G language ability to
describe and operate parallel processes. The "Sequence" structure is a
particular feature of G regarding synchronisation. Actually many
"non-expert" programmers use it not to specify sequential processes but
rather to store code in a smaller area of the diagram screen...

A "Parallel" structure, or a "Sequence / Parallel" mode switch on the
sequence frame, would make more clear the synchronisation semantic. Why
hasn't NI implemented that yet ?

ozimmer@isn.in2p3.fr
0 Kudos
Message 1 of 6
(3,636 Views)
Personally, I prefer to use dataflow instead of the sequence structure and I know that anything not connected by dataflow is inherantly parallel. I do agree that many new users forget (or don't understand) the parallel nature of LabVIEW programming but I'm not sure I want something else on the diagram that I have to click through to see all the code especially since the parallel design exists already.
0 Kudos
Message 2 of 6
(3,636 Views)
I indeed share your preference for dataflow synchronisation.

As a matter of fact, parallel frame would be a redundant notation to
disconected processing blocks. But what about maintaining a set of many
parallel processes that occur inside three combined loops for example ?
As the superstructure trespasses the screen boundary, it becomes much
harder to aprehend and to maintain. In that case, using a parallel frame
option would just make very clear that "what we have here is n parallel
processes inside three loops". No matter what n is equal too !

Maybe the reason why NI has not integrated more alternate programming
concepts (such as GOOP) to its G language IDE lies more into the
strategic choice of keeping LabVIEW a non-specialist progra
mming tool.

Enhanced paralelism handling features in G have been mentioned and
suported before, though. I very instructive the following study from NI
(check out paragraphs about cyclostatic dataflow scheduling /
overlapping execution) :

http://home.austin.rr.com/andradesauder/documents/swsynthg.pdf

wired ! - oz

Note: As a (very) short bibliography on paralelism control in other
programming language a found that a "PAR BEGIN process1, process2,
process3 END" control structure existed in Algol 68. Nowadays, the trend
is more to handle parallel features through dedicated libraries (C, C++,
Java... see OpenMP...)... ...


Dennis Knutson a écrit:

>Personally, I prefer to use dataflow instead of the sequence structure
>and I know that anything not connected by dataflow is inherantly
>parallel. I do agree that many new users forget (or don't understand)
>the parallel nature of LabVIEW programming but I'm not sure I want
>something else on the diagram that I have to click through
to see all
>the code especially since the parallel design exists already.
>
>
0 Kudos
Message 3 of 6
(3,636 Views)
....
> option would just make very clear that "what we have here is n parallel
> processes inside three loops". No matter what n is equal too !
>

A new structure could be added, but one already exists -- the subVI.
The subVI has an inner diagram, and it is semantically equivalent to a
single frame sequence or a single iteration loop. The big differences
are that the subVI trades the icon for the actual implementation, so
when you want to save space, this sounds like a good fit. And of course
the subVI can be reused, which encourages modular design and programming.

As for whether NI wants to add more structures, one was added in 6.1 --
events -- and a couple more might be on the way -- I don't know, maybe
in a beta or something. But
, if they don't add enough to the language,
then are they really needed. At some point language features are a bit
like kitchen gadgets or gauges on a dashboard. More isn't always better.

Greg McKaskle
0 Kudos
Message 4 of 6
(3,636 Views)
> A new structure could be added, but one already exists -- the subVI.
> The subVI has an inner diagram, and it is semantically equivalent to a
> single frame sequence or a single iteration loop. The big differences
> are that the subVI trades the icon for the actual implementation, so
> when you want to save space, this sounds like a good fit. And of
> course the subVI can be reused, which encourages modular design and
> programming.


What if, as it happened to me, the code was put together as a *huge*
diagram where disconnected processes rely on the same front panel
terminals ? Before version 6i there was no simple way to pack up "front
panel sharing" code into separate sub-vi without having to go through a
revised
data model design. And even now, it seems that "remote" front
panel access using references just cuts down data access speed.

> At some point language features are a bit like kitchen gadgets or
> gauges on a dashboard. More isn't always better.
> Greg McKaskle

.... I concur though !

oz
0 Kudos
Message 5 of 6
(3,636 Views)
>
> What if, as it happened to me, the code was put together as a *huge*
> diagram where disconnected processes rely on the same front panel
> terminals ? Before version 6i there was no simple way to pack up "front
> panel sharing" code into separate sub-vi without having to go through a
> revised data model design. And even now, it seems that "remote" front
> panel access using references just cuts down data access speed.
>

It is true that property nodes are slower than terminals and locals, but
when used for UI purposes, it doesn't matter much. That is what they
are for. The bad things that people do to VIs, where they use UI
elements to pass data cannot be undone easily, well it usually isn't
that hard, but it
is tedious. Hiding ugly code in parallel single frame
structures or in a single parallel structure doesn't make it any
prettier or any easier to maintain.

It is something close to work, but I still believe that getting your
head around individual groups of code and giving them an appropriatly
named subVI, then moving to the next piece, is the best approach. Soon
you will likely find that the huge amount of code actually starts
shrinking as previously duplicated code is now shared via subVIs.
Initially leave all of the UI on the top level, and when you see items
that are repetitive, they can often be put in a loop or in a subVI and
use control references in a very good way.

I know that I'm preaching to the choir, but this is, in my opinion, the
only true way to clean up code. Plus it involves reading it to discover
what it does, and adding comments, which is actually the most important
thing to do before changing code.

Greg McKaskle
0 Kudos
Message 6 of 6
(3,636 Views)