LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace Array Subset in FGV slow

Solved!
Go to solution

@Quiztus2 wrote:

Do you also have a good idea on the pixel extraction along all images?

Since the difference their is still big.


The reason it is large is because you are reshaping the array then extracting. Your FGV is complicated, you have multiple array inputs and outputs. I would suggest simplifying it.

 

To increase your pixel extraction rate you need to operate on your 1d array in your DVR. You can do something like below, make sure you specify the correct pixel, I am not sure I did,

 

mcduff_0-1711461969347.png

That reduced the pixel extraction time by a factor of at least 10, still more than the DVR though. Parallelizing the loop did not make any difference.

0 Kudos
Message 21 of 25
(106 Views)

For the sake of completeness, here my latest results comparing 3D,1D and DVR based approach.

 

Quiztus2_0-1711549333817.png

test.png

 

0 Kudos
Message 22 of 25
(82 Views)

@Quiztus2 wrote:

For the sake of completeness, here my latest results comparing 3D,1D and DVR based approach.


So this is just guessing here why the value based approach is slow. The compiler "does not know" what is on the wire, so data copies are made; you don't have that issue with the DVR.

 

When I do these types of FGVs I try to never branch or break the wire. If I try that with your code, the VI is broken because the compiler does not know what is on the wire. See below. I modified the "Write" part so the wire never breaks, but now the VI is broken. Lastly just do your read off the shift register, no need to branch another wire. It makes no difference here, but IMO it's cleaner to read off the shift register then have another wire branch in the diagram.

 

mcduff_0-1711553933840.png

 

Message 23 of 25
(73 Views)

Lastly just do your read off the shift register, no need to branch another wire. It makes no difference here, but IMO it's cleaner to read off the shift register then have another wire branch in the diagram.


Quiztus2_0-1711558109923.png

Reading directly the shift register makes a huge difference for the 3D case. The Replace and Read times are now the same for 1D and 3D. Very interesting. Actually the difference in manipulating a 1D vs 3D really didn't make sense for me before.

The remaining huge difference between 3D and 1D single extraction is not justifiable from my perspective.

 

0 Kudos
Message 24 of 25
(65 Views)

Surprised it made that much of a difference; I did not test but the memory address for the wires was the same so I assumed no difference.

 

For me, never breaking the wire usually helps with memory copies, that is why I use the reshape array on the original wire when possible, that way the buffer can be reused. Branches can also result in copies as you have seen.

0 Kudos
Message 25 of 25
(52 Views)