CPU vs. GPU problems

Hi,



I'm not sure if anyone can help me on this, but any suggestions would be greatly appreciated. Basically, I just inherited a project that someone else had been working on that uses an AVS (Assisted Visualization System) to visualize various algorithms written in Java. The problem that we've run into that we've determined through various tests (I won't go into details) that the program is running on the CPU and not the GPU, and the program is supposed to have thousands of individual agents running around simultaneously, so running this all on the CPU really slows down the performance. I can tell that the code is using JME, so my question is that is there any way to tell JME to run on the GPU vs. the CPU? The code also uses DiscoveryFrames and AWT and is basically a big undocumented mess, so I understand that the problem is most likely nothing I can fix through JME, but I thought that I'd ask. Thanks for your help.

jME always runs "on the GPU". Of course it also uses the CPU (like any program), but there's only support for OpenGL at the moment. So if you have the proper drivers installed for OpenGL, it'll run on the GPU. If you don't, it likely won't run at all. (unless you're using some kind of custom Linux/MESA setup perhaps).

You could try to enable V-Sync, that limits the render loop to 60 Hz or less.

The you need to check if the Game Loop is implemented as 'run as fast as possible' which it is probably.

In StandardGame for example you can set a maximum frame rate, you could implement something similar.


VisualVM is part of Java 1.6.

Start this: "Program Files/Java/jdk1.6xxx/bin/jvisualvm.exe"



Then start your Java application. The application will show up in the VisualVM.

When you enable CPU-profiling you get informations which functions consume most of the execution time.

You framerate will go down for a few seconds when you enable the profiler, but it will normalize.

primitive limiting can be done by simply adding a Thread.sleep(33) in the render function, not perfect, but should help a bit and works on every machine

Using FixedFramerateGame is also an easy solution, that can be used for more than testing.