Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

dual core vs. single core?

Hello
 
Im currently using LabView (and imaq) to acquire images and extract blob information. On my Athlon 64 3000+ processor the program is just able to run the required 40Hz (which is how fast my experiments are going). I would like to be able to run data analysis in Matlab as well as internet explorer and other small programs at the same time. Is it possible to use a Dual Core processor and assign one core exclusively to LabView, so that no matter what other processes are being run, cpu power will not be taken away from LabView?
Would one core of a dual processor cpu run as fast as a single core processor at same clock speed (eg. Athlon 64 2.2GHz single core and an X2 with two 2.2GHz cores)?
 
Thanks,
 
Simon
0 Kudos
Message 1 of 18
(5,727 Views)
Hi Simon,
 
The IMAQ Vision VI's and DLL's are optimized to take advantage of multiple processor computers. I am not entirely sure, if it would be possible to dedicate a single CPU for LabVIEW, but you can programmatically set the priority of your LabVIEW program in Windows. It is also possible to programmatically set the program to use only a specific CPU. This way you may be able to achieve a similar result.
 
To do this, you have to make some DLL calls in your code. You can find more information on this on these pages:
 
The attached example shows how to set the priority of a VI. I hope this is useful to you. Please let me know, if I can be of further assistance.
 
Regards,
Peter
AE Denmark
Peter Porsman | Applications Engineer | National Instruments
Message 2 of 18
(5,686 Views)

Hi Peter

Thank you for your reply.

It seems to me that since LabView has no problems running on multiple processors my program will no doubt be running faster on a dualcore cpu - even if i dont mess around with priorities.

However I would like to give the important part of my program a high prority, so that other applications will be on hold. If I set the priority to "high" is there a chance that the computer will crash? Usually the important part of the program will be running for something like a minute at a time - but at other times it needs to run for up to 10 minutes.

I have attached my program and one of the subvi's. It is in the second frame that the important things goes on - image grabbing and analysis. The while loop has to run at 40 Hz so I wondered if it is possible to set the priority high in this frame only and then reduce the priority at other times - thereby giving cpu time to other applications to run?

Best regards,

Simon Viftrup

 

Download All
0 Kudos
Message 3 of 18
(5,676 Views)

Hi again

After looking into priority and trying to change it in the task bar I guess setting the program for high priority at all times will be fine (since it only matters when the program actually needs the cpu). My program really only needs computation time during the image analysis.

I tried extracting the set priority call from your vi, is it enough if i just add this small code (see attached vi) to my program?

Best regards,

Simon Viftrup

0 Kudos
Message 4 of 18
(5,670 Views)

Hi Simon,

You're right. It should be fine just setting the priority high at all times. Your attached code should work fine. You can always check in Windows Task Manager. Jut right click your process and see status under Set Priority. This also enables you to control execution priority, but you would have to set it each time it is run. Actually, it is also possible to set the affinity, when right clickin the process.

With a dual CPU system, your code should be able to run faster. Not twice as fast, but maybe something like 30-50% faster.

Best regards,

Peter

Peter Porsman | Applications Engineer | National Instruments
0 Kudos
Message 5 of 18
(5,663 Views)
Hi Peter
 
Setting the Priority in task manager works fine, i can see that other programs just have to wait or use whatever is leftover from the labview program.
 
Is it possibel to change the priority in my program so that i dont have to enter task manager everytime labview is started?
 
I tried the code attached - it didnt work, sometimes it did change the priority but only to low!
 
Regards,
 
Simon
0 Kudos
Message 6 of 18
(5,660 Views)
Hi Simon,
 
You have to change Format & Precision for your constant to Hexadecimal. Remember to type in "80" again. Then it should work, and it is not necessary to use Task manager.
 
Regards,
Peter
Peter Porsman | Applications Engineer | National Instruments
0 Kudos
Message 7 of 18
(5,657 Views)

Thanks Peter

It works perfectly!

0 Kudos
Message 8 of 18
(5,654 Views)
Hi Simon,
 
No problem. Please let me know, if I can be of any further assistance.
 
Best regards,
Peter
AE Denmark
Peter Porsman | Applications Engineer | National Instruments
0 Kudos
Message 9 of 18
(5,661 Views)

Well there is one more thing.

I took out the central part of the program. It basiclly grabs an image, and does a blob center analysis. The issue is that our equiptment is able to run at 40Hz, but this program can only run at about 38Hz! So either I need to somehow make it run faster or i need to upgrade my pc. Its running on a AMD 64 3000+ cpu with nforce4 motherboard, and 2*512 DDR memory in DUAL. Will the obtainable repetition rate be proportional to the cpu clock rate (on an AMD 64 cpu)? Will this vi be able to efficiantly use a dual cpu?

The cost of a dual amd cpu is very low and we need a new computer anyway so upgrading is not a problem.

Best regards,

Simon

0 Kudos
Message 10 of 18
(5,660 Views)