Cpu farm for processing + processing on multiple cores

edited February 2014 in General Discussion

Good day,

It's probably going to be a series of stupid questions, but I'll ask them anyway:

  1. Does Processing make computations on a single core or does it divide tasks to multiple cores?
  2. If it does work only on a single core, do different processing instances use up different cores, or do they all use the first one and ignore the others?
  3. If it divides tasks to multiple cores, does anyone know if a commercial CPU/GPU farm for Processing scripts exists?

Have a lovely day, Gediminas

Tagged:

Answers

  • edited February 2014
    • Since Processing's framework runs atop of Java, it also features its concept of execution threads.
    • There are at least 2 Processing threads running -> "Animation" & "EDT"; besides Java's own, like the "Garbage Collector".
    • Which cores a thread runs on are mostly decided by the OS itself AFAIK.
    • There are programs which can set the core's affinity of programs and/or threads.
    • We can manually set affinity of running programs under the Windows Task Manager, for example.
  • Thanks,

    That cleared up things!

  • You need to write Java code that intentionally uses more than one core. http://www.oracle.com/technetwork/articles/java/fork-join-422606.html

  • edited February 2014

    You need to write Java code that intentionally uses more than one core.

    Yea, of course. Easiest way is use the hidden function method("") thread("") to invoke a function as a separate Thread. :-h

  • I sometimes use thread("") as well. Is that the same as method("")? If I do this, is it automatically assigned to a different core?

  • edited February 2014

    Oops! My mistake! It's thread("")! Function method("") is just a fancy way to call a function synchronously! :-&
    But both are useful when we got a buncha functions w/ indexed-like names:

    void drawShape1() {}
    void drawShape2() {}
    void drawShape3() {}  
    
    int option = (int) random(1,4);
    
    method("drawShape" + option);
    thread("drawShape" + option);
    
Sign In or Register to comment.