Processing performance issues on a Xeon server

TSHTSH
edited June 2014 in How To...

Hi guys,

So I have been having performance issues with processing running on an Ubuntu GPU server. I'm losing frames. we're talking hundreds of frames on a 2mn sketch with the sketch set to run at 60fps.

The weird thing here is the CPU usage never goes past 20% nor the GPU for that matter. Thinking the entire sketch is only using one core instead of the 8 available.

  1. Am I right in my assumption that only one core is being used?
  2. Any way to have processing use more than one core while running?
  3. Any advice on how to improve performance?

Thanks!

Answers

    1. Probably. To my knowledge, a Java program is mono-thread, unless explicitly coded to manage several threads. At best, some other threads are spawned, for the AWT drawing thread, for the main loop of Processing, perhaps for GC.
    2. Code your sketch to be multi-thread. There are several caveats with that...
    3. It depends. It can be hard if your sketch is well coded, easy if you have fallen in some common mistakes, like loading images in each frame, etc.

    A potential cause of slow down is writing the frames to disk. Perhaps a virtual disk can help there, or using a SSD or similar. The fact you use not so much CPU can be a hint toward this I/O issue.

  • edited June 2014
    1. If you haven't neither called a function via thread("") nor instantiated a new Thread class,
      your whole ".pde" code runs within the so-called "Animation Thread" that Processing's framework starts!
      Of course there are other threads like GC & AWT event dispatches running along ours.
    2. As @PhiLho said above, use threads!
      Even so, there are no guarantees whether a Thread is chosen to be run in a separate core!
    3. Take a look at this recent discussion:
      http://forum.processing.org/two/discussion/5886/multithreading-madness
  • Thanks guys, using thread() is not as straightforward as I hoped as it didn't improve much doing so. Will keep exploring solutions.

Sign In or Register to comment.