02-12-2009 04:38 AM
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
Solved! Go to Solution.
02-12-2009 06:38 AM
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
02-12-2009 06:55 AM
Do I need to run timed loops? Attached, the way I am implementing my vi (2 loops here). Highly ineficient.
Thanks
Adrian
02-13-2009 08:12 AM
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,
02-16-2009 03:33 AM
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
02-16-2009 06:44 AM
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.
02-16-2009 07:49 AM
02-16-2009 07:56 AM
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
02-16-2009 08:27 AM
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.
02-16-2009 09:21 AM
Did you try changing the number crunching VI to "re-entrant" ?
Ben