From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Mean PtbyPt in a loop with parallelism

Solved!
Go to solution

Hello,

 

Can anyone explain to me why this does not work as expected? (10.5 and 0.5 values)

I get 5.5 and 5.5.

 

I checked the MeanPtbyPt.vi, all is clonable, the vi itself is set to preallocate clones. I also tried to set it to Inline, does not help. Tried C of 1 and 2, no luck. If I open Mean ptbypt while operating, I see that the SR holding the array of data is interleaved with 10.5 and 0.5 values, as if both clones use the same memoty space, but on the input I always see only ~0.5 coming in. What gives? I thought parallelism will create two clones, no?

-fomine
_________________________________
You can do greater things with LabVIEW!
0 Kudos
Message 1 of 7
(3,683 Views)

Yes, all the Pt by Pt functions are set to pre-allocate clones.  You have exactly 1 instance of MeanPtbyPt.vi so you get 1 dataspace shared across all parallel iterations (Guess what, The loop iterations are not really in parallel since the MeanPtbyPt.vi will block)

 

This snipetteshows the difference between one and two instances of MeanPtbyPt.vi

!00.png

 

Note: Those clones WILL run in parallel

 

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(3,667 Views)

Clonable means you have two different instances on the block diagram, each with its own memory space.

 

You only have a single instance of that VI.  Parallelsim doesn't make clones.

0 Kudos
Message 3 of 7
(3,662 Views)

Hello guys,

 

Thank you for your answers!

 

The problem with putting 2 ptbypts on the block diagram is that I have an array of N independent measurements, where N is large and variable.

 

Why doesn't a loop with parallelism create clones? It greatly diminishes its value then! I would have to re-write NI math libraries then 😞

-fomine
_________________________________
You can do greater things with LabVIEW!
0 Kudos
Message 4 of 7
(3,650 Views)

A parallel loop that will iterate N times isn't going to be N parallel loops.  It may only be a few.  A N=100 loop may have 4 parallel instances that run 25 times each.  Or maybe not even that perfectly balanced.

 

I think you are trying to force the wrong tool to do what you want.

0 Kudos
Message 5 of 7
(3,628 Views)
Solution
Accepted by topic author fomine

@fomine wrote:

Hello guys,

 

Thank you for your answers!

 

The problem with putting 2 ptbypts on the block diagram is that I have an array of N independent measurements, where N is large and variable.

 

Why doesn't a loop with parallelism create clones? It greatly diminishes its value then! I would have to re-write NI math libraries then 😞


Actually,  a loop with parallelism (or without) CAN create clones.  But you have to know the trick.

 

Here is an example of what you "Really Want"

NNumberPtbyPt.png


"Should be" isn't "Is" -Jay
Message 6 of 7
(3,623 Views)

Hi Jeff,

 

Yes, I went this route too. I just hoped for a simpler way and slightly cleaner BD 🙂

I saw a post there a poster suggested to do Loop with Parallelism for a very similar task the OP was facing. Decided to test it and found out that it did not work.

 

Thanks a lot guys for your reply.

-fomine
_________________________________
You can do greater things with LabVIEW!
0 Kudos
Message 7 of 7
(3,618 Views)