How to use GPU?

Hi folks, anyone knows how to use the GPU in a sketch? I tried in P3D and OpenGL modes with several MacBook and Pc, integrated and Nvidia GTX 980 graphic card, but frame rate and overall performances are the same on every machine.

Tagged:

Answers

  • yes, I'm with you too, would use the computer on its real capacity...

  • Same problem here too.
    The frameRate is always well below 60fps even with moderately intensive sketches run on the best machines I have access too (including one with a GeForce GTX 1070 graphics card and i5 6400 (not mine, a friend's)). It seems that the sketch fails to make use of the graphics cards properly, only making the shader programs run on it (try using glsl shaders in your sketch, a huge performance boost will be seen if done properly).

  • I've been having the same issues, i'm running an Nvidia M4000 on one machine, the other has an M2000 & an M4000, I see know difference in performance on either machine. One of my instructors at school is running an older mac and I get better performance on his machine with less GPU. I know the mac has integrated java into their framework, but still confused on how to leverage the gpu to gain performance. Hopefully bumping this thread can lead someone to referencing some learning material on this subject.

  • Even P2D, P3D and FX2D offer no improvement in performance.

  • @Lord_of_the_Galaxy , @waltercorneli :

    Often, just using P2D or P3D will not directly increase the performance of a sketch. The problem is, that your code is written for the CPU and not de GPU, so to have really a speed improvement, you have to write shaders (fragment, vertex asf.), for specific tasks, which then run on the GPU.

    Could you show me a sketch which runs very slow, even with P2D / P3D?

    Because if you calculate the position of 200 objects in a scene (for example for flocking), you usually use the CPU, which is very slow, because the problem is O(n²). With a texture vertex shader you could run this calculation parallel on the GPU.

    Here is an example which does it for flocking (but WebGL, not processing): https://github.com/parsaiej/GPGPU_Flocking

    But that is just an example, how to outsource task onto the GPU.

  • Optimising code that hasn't been posted is, at best, guesswork.

  • @cansik

    With a texture vertex shader you could run this calculation parallel on the GPU.

    Indeed. But doing so in Processing is a pain. So I was right, P2D/P3D in themselves do not increase the performance. But they provide the advantage of using shaders.

    Perhaps you're right, my sketches tended to be mostly using the CPU. Nonetheless, irrespective of the sketch, P2D and P3D always run slower than JAVA2D and FX2D for me.

Sign In or Register to comment.