CUDA on JME

Hi, I recently discovered CUDA (http://www.nvidia.com/object/cuda_what_is.html).



I'm pretty sure JME would be benefited by taking advantage of it. Maybe processing the scenegraph as it is at least a quadtree and is parallelizable, managing particles systems and some others N-body's interaction can also benefit from CUDA like physics. Maybe allowing for crazy particles effects, like the examples applications in the that page with the smoke.



I have no idea how much improvement you can get while still running a complex 3d game and asking the GPU for other operations, but I believe we should at least check it out.



I have searched for CUDA wrappings in Java, there's Jacuda at sourceforge and JCublas which is a BLAS implementation using CUDA from java found at: http://javagl.de/jcuda/jcublas/JCublas.html that may be useful for some algebra.



I hope we can start a project to include CUDA support within JME since it would make a big difference and widen the gap between JME and everything else… :D. Maybe we should first work on an independent CUDA implementation with JNI and later including it inside JME.



Off course people can only take advantage of this using Nvidia 8000 series forward but I think that would still be a high percentage of people.



Well, just think about it!

CUDA is nice and all but like you mentioned it has limited support within video cards. Besides this I think CUDA is mostly for speeding up various computations that require parallel processing, e.g video decoding. I don't think CUDA would be useful for anything except physics in jME. The devs are better off working on more important things than this, IMO.

Ok, sounds fair, you are probably right, there's a lot more important stuff work on.



But I insist :P.



And what about AI? Wouldn't it be interesting  to have like a swarm of… entities(?) where each one has a "mind" of it's own showing a more complex result instead of a swarm as one entity behaviour. Imagine a strategy games where the units are smarter and have to make more choices, you could have epic battles with hundreds of independent units instead of a just bunch. Wouldn't also help with neural networks? since it's just a bunch of graphs which are represented as matrix and operation could be highly improved using BLAS on CUDA.



Wouldn't it help also on server side applications? I'm guessing servers have a lot to process for many clients at the same time ;). What about databases? maybe CUDA can help there too since search and sort algorithms can greatly benefit.



And are you sure the scengraph managing can't be improved with it? Off course graphics by themselves are already managed by the GPU and sound should be better taken care of by the sound cards. But I insist, don't you people think some cool thing could be achieved with this new emerging technology? Multiple cores are becoming more common and CPUs will probably increase their number of cores so the engine has to worry about parallel processing to improve it's performance as stated in "StandardGame, GameStates, and Multithreading (A New Way of Thinking) - A paradigm shift by darkfrog". So, how hard would it be to add the option of pushing tasks to the GPU instead of the CPU? As time passes more and more people will have access tu multiple processors, I don't believe it would be a waste of time.



I'm am not an expert and I haven't (yet) helped JME, all of you are better judges than myself on where should the efforts be placed. I just found something interesting and I'm trying to think about what could be achieved with it.



I invite more people to say what they think or suggest what other things would benefit from CUDA or just say that it's a waste of time or that I went bananas… (get it? :P).



Bye!

I see what you mean, I agree that CUDA is a very powerful platform that should definetly be used. However, right now it's at R&D phase and there's not much widespread support, perhaps when it becomes more mainstream, regular applications and libraries could make good use of it.

On another note, there's nothing stopping you from using CUDA yourself; at this point jME doesn't have an AI functionality so you would have to implement AI yourself, in that case, you have the choice of using CUDA for your AI algorithms. The Java bindings are available and if you're willing to accept the requirement for a high-end machine then you're all set for CUDA.

A guy in my Lab is working on some numerical simulations using this… I'll ask him a bit more about it so I can post a reasonable comment, but since I am quite unreasonable sometimes anyway, I will post some half-ass thought comment now:



IMHO CUDA is for applications that require a lot of floating point arithmetic but no 3D graphics… Otherwise, it will take strength our of the graphics to devote it to some other calculations… but this is exactly what the CPU would be doing in a game (or game engine for that matter). calculating all the game logic, AI, physics, etc. so that the GPU can concentrate on as coll graphics as possible.

Got another topic on this subject and I have been trying to develop, if they can have a look there, thank you.



http://www.jmonkeyengine.com/forum/index.php?topic=12614.0