LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

interpolate 1d slow on 8 core machine

Solved!
Go to solution

Hello.

I have got a very simple question, which perhaps is very simple to be solved (by experts). Basically, I have got an array 1024x1024 and I have to perform interpolation along each line. Unfortunately it's very slow even if I have got a 8 core PC. It looks like the Labview uses only 13% of the CPU, so only one core (13x8~=100). I split the array in 4 256x1024 array, hoping that the others processors will do some work. The CPU consumption is still low ~16%. Do I miss something? Could you give me some suggestions how to speed my processing up?

Thanks in advance

Adrian 

0 Kudos
Message 1 of 25
(5,561 Views)

Hi Adrian,

if you split your array, then you should use four loops. If you use timed loops then you can select the core on which the loop shall run.

 

Hope it helps.

Mike

Message 2 of 25
(5,534 Views)

Do I need to run timed loops? Attached, the way I am implementing my vi (2 loops here). Highly ineficient.

Thanks 

 

Adrian

0 Kudos
Message 3 of 25
(5,526 Views)

Hi Adrian,

I think I may see the issue.  I think you have misunderstood how this subVI needs to be used.  I would suggest look at an example program using this.  You can find this by launching the example finder (Help>>Find Examples).  If you then search for 1D interpolate there is an example program demonstrating this subVI.  You will notice it does not need to be withing a loop, you can just pass the complete arrays to it and it will take care of any required looping for you.  What this means is that the program that you posted infact does the whole interpolation but then does it 1024 times! (2x512 loops)  Removing these loops should greatly increase the effeciency of your program.

 

Also I think you have misunderstood how some of the array indexing works but I apologies if I am wrong.  It appears that you are trying to split the array by passing it to 2 for loops and forcing the iterations to be half of the size.  This unfortunately will not work.  There is infact a tool in LabVIEW for doing this already.  It is called split 1D array.vi and is available in the arrays pallette in LabVIEW.

 

I hope this helps.  Let me know if this improves the effeciency of your code or whether you would like any more advice on this.

Regards,

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 4 of 25
(5,467 Views)

Thank you James for your message. In fact, what I am trying to achieve is the following:

 

1. Acquire an image (I'm using a NI1428) 

2. Convert image to array (using the IMAQ Image2Array function); the array size is 1024x1024

3. Perform 1D Interpolate along each line of the array

 

The acquisition is done continuously, so all these 3 steps have to be performed really fast. Unfortunately step 3 is very slow due to the interpolation.

Have you got any idea about speeding up these processes?  Any tricks?

 

Thanks a lot.

Adrian 

 

 

0 Kudos
Message 5 of 25
(5,448 Views)

Hi Adrian,

 

you code is incorrect. But is correct to testing multithreading.

 

Reason why you 7 cores don't working is that VI "Interpolate 1D" and all its subVIs are not reentrant. When you change properties of all there VIs then it will run parallel.

 

 

0 Kudos
Message 6 of 25
(5,437 Views)
P.S: why do you need interpolation?
0 Kudos
Message 7 of 25
(5,425 Views)

The interpolation has to be done. This is the way to construct an image in Optical Coherence Tomography ... you have to take the FFT of each line, but before the FFT the linearization of the wave-number is compulsory ....

  

Adrian 

0 Kudos
Message 8 of 25
(5,422 Views)

Uhhh this is to high matematic for me.

 

If you create working sample code fo one core and if you will need parallel procesing I could help you.

0 Kudos
Message 9 of 25
(5,414 Views)

Did you try changing the number crunching VI to "re-entrant" ?

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 10 of 25
(5,405 Views)