We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › dual processors
Page Index Toggle Pages: 1
dual processors (Read 1071 times)
dual processors
Jun 17th, 2005, 6:29pm
 
hi there
I´m working on a real time motion tracking project.  i´m using p90. My question is: does Processing support dual processors.  I am going to put a new pc together wich should have as much performance as possible.
Is there any tricks to speed up performance in general.
thanx in advance
fabs
Re: dual processors
Reply #1 - Oct 13th, 2005, 4:13pm
 
No it doesnt as far as I know. Hyperthreading, which is pretending to be 2 CPUs, has the effect that you can just use 50% of the CPU (you can turn that off in the Bios though). I expect the same from Dual PCs since Processsing runs in a single thread.

Re: dual processors
Reply #2 - Oct 13th, 2005, 6:48pm
 
The short answer: yes, but not without some work.  Java supports multiple threads (and thus multiple processors), however, the structure of Processing is purely single-threaded (you wouldn't want two different threads drawing to the same screen at the same time without careful coordination).

In the case of a motion tracking project, you could run multiple threads for image analysis (i.e. send frame 1 to thread 1, frame 2 to thread 2, frame 3 to thread 1, etc.), but this would require a bit of coordination and design on your part (it's no magic bullet).  If you are unfamiliar with threads, read the Java tutorial on Threads, but don't expect to be able to get things working on Processing without some serious practice.

Marcello
Re: dual processors
Reply #3 - Oct 14th, 2005, 9:46am
 
Threads in P were for me a too big hassle to be considered Cheesy But then on the other hand, I am just a n00b.
Speaking of motiontracking, I assume you would not do that in Processing, but in a program thats more ready to do that? I can recommend you EyesWeb, for pure motiontracking you will have that set up in a day with communication to Processing. This could then run on a dual machine...I assume.
Re: dual processors
Reply #4 - Nov 13th, 2005, 4:17pm
 
Cello: Or have just one free running thread on one CPU to do all the motion tracking into buffers and let the processing thread run on the other CPU and do all drawing to screen from the buffers as fast as it can. This way you'd be able to tweak the hyperthreading balance according to the thread loads and hopefully get a steady output framerate, which is what you usually want if you do real time stuff. And also you dont have to get into a complicated thread handler that makes sure to properly balance the threads so that not one CPU gets too much load and thereby resulting in unstable choppy output.


Re: dual processors
Reply #5 - Nov 13th, 2005, 8:02pm
 
That would work, although I'm guessing any kind of advanced motion tracking will take a considerably higher amount of CPU than drawing to the screen, and you probably want the motion tracking and drawing to be in sync (you might not want the screen to update more than once for each motion track update), in which case the gain will be much smaller than dividing up the motion tracking work.

Also, you don't need a complicated thread handler so much (after all, Java has a rather streamlined and easy to use thread system), you just need to think in parallel and approach the problem as simultaneous processes.
Page Index Toggle Pages: 1