LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

interpolate 1d slow on 8 core machine

Solved!
Go to solution

Hi Adrian,

 

When you say this is a continuous process could you snap the next shot while processing previous or must the processing be complete before the next image.  If you can do the next processing then you could use something like a produce/consumer architecture.  This means you would have two loops.  One would take the image and pass the array to the other loop.  This is then not effected by the time taken to process the image and can continue with snapping the next image.  The second loop could then deal with the processing in its own time and any extra images ready for processing would be queued until this loop was ready.  Obviously this will only be suitable if your system would be happy with the images queuing up whilst the processing is done.

 

If this is not an option then I would agree with the others.  Use the split VI I mentioned to split accross multiple loops and make the 1D interpolation re-entrant so that the two loops can run simultaneously.


Regards,

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

Yes, I did. The CPU usage is now around 18-19%; 2 cores seem to be involved in doing the job, but overall, the whole process is very very slow (still due to the interpolate 1d function ...).

 

Adrian 

0 Kudos
Message 12 of 25
(3,683 Views)

Adrian,

 

Have you tried this with 8 cycles instead of 2?

How many CPU power will need attached VI on your machine? 

 

Andrey.

Message Edited by Andrey Dmitriev on 02-16-2009 06:38 PM
0 Kudos
Message 13 of 25
(3,677 Views)

All VIs and all their subVIs must be reentrant. This is from LabVIEW Help:

 

Reentrant execution—Enables a VI to be called by more than one caller. Normally, a VI can only be called by one caller at a time. However, if you want two callers to be able to call the same VI simultaneously, place a checkmark in the Reentrant execution checkbox.

 

Try my examples.

0 Kudos
Message 14 of 25
(3,647 Views)

Dear Andrey & JCC,

 

Unfortunately I'm using Labview 8.0, so I cannot take advantage of your code ....

 

Adrian

0 Kudos
Message 15 of 25
(3,639 Views)

No problem.

 

Downsaved with version 8.0.  I hope you will be able to open (I haven't LV8.0 on my PC). Here no Interpolate 1D.vi used - just Threshold 1D Array primitive. I guess this VI should take 100% CPU.(or, may be 50% CPU - I don't remember which are default settings for multithreading - may be only 4 threads. Also not sure that multithreading option will take effect in your case or not. Otherwise I don't believe that you have 8 real CPUs. I guess you have 4 physical CPUs with HyperThreading. May be I'm wrong).

Allso attached simple tester where you can see which VIs Reentrant and which not. As far as I can understand, not only Interpolate 1D.vi, but all VIs in hierarchy should be reentrant, and they are mostly reentrant, but not all.

 

Andrey.

Message Edited by Andrey Dmitriev on 02-17-2009 11:20 AM
Download All
0 Kudos
Message 16 of 25
(3,633 Views)

Thanks Andrey,

 

I managed to open interp8.vi. It's true, this vi takes 50% CPU.

Unfortunately I could not open the other example. Could you please downsave it with 8.0?

Thanks again

 

Adrian

0 Kudos
Message 17 of 25
(3,629 Views)

This VI already saved in 8.0, but something happend by conversion (probably because Table indicator was used). Anyway screenshot attached:

 

 

Andrey.

Message Edited by Andrey Dmitriev on 02-17-2009 11:43 AM
0 Kudos
Message 18 of 25
(3,624 Views)
reentrance example version 8.0
0 Kudos
Message 19 of 25
(3,610 Views)

Adrian Bradu wrote:

 

I managed to open interp8.vi. It's true, this vi takes 50% CPU.

 


Adrian,

 

Now its a time to add a little bit "steroids". It seems to be that LabVIEW by default have reserved 4 execution threads.

 

Please try to do following:

- close LabVIEW 

- save backup copy of your LabVIEW.ini file (located in the same directory where LabVIEW.exe)

- add two following lines to LabVIEW.ini in [LabVIEW] section (for example, at the beginning, directly after [LabVIEW]):

ESys.StdNParallel=-1
ESys.Normal=8
The first line will tells LabVIEW to start with a custom set of threading parameters as defined by ESys.

The second line will set 8 threads for default execution system witn normal priority.

- start LabVIEW

- open attached VI and run MAIN.vi

If you have done steps above, and LabVIEW not limited by 4 threads, then you should get 100% CPU load (and twice shorter execution time)

 

best rehgards,

Andrey.

PS

Another way is using threadconfig utility, located in <Program Files>\National Instruments\LabVIEW 8.0\vi.lib\Utility\sysinfo.llb\threadconfig.vi, but direct editing of ini file should work. (This utility have some troubles with LabVIEW 8.6)

 

Message Edited by Andrey Dmitriev on 02-17-2009 01:02 PM
0 Kudos
Message 20 of 25
(3,601 Views)