Ogre::Cuda Released !

A place to show off your latest screenshots and for people to comment on them. Only start a new thread here if you have some nice images to show off!
Post Reply
User avatar
dddExperiments
Gnoblar
Posts: 21
Joined: Sun Mar 21, 2010 4:27 pm
Location: Bordeaux, France
x 1
Contact:

Ogre::Cuda Released !

Post by dddExperiments »

I just like to present you my latest release : Ogre::Cuda.



The purpose of this libray is to abstract DirectX & OpenGL interop with Cuda.
It’s means that you can use Ogre::Texture and Ogre::HardwareVertexBuffer with Cuda without having to bother which Ogre::RenderSystem is active (DX9, DX10 or GL).

The Ogre::Cuda libray is available under MIT license.
Binary demo : OgreCudaDemo1.zip
Source code : svn on google code

You can get more information on my blog : http://www.visual-experiments.com/2010/ ... th-ogre3d/

I still need some help to complete this library :
  • I don't know how to extract deviceId from Ogre OpenGL context, see this topic.
  • Ogre D3D10HardwareVertexBuffer is not exported (_OgreD3D10Export decorator missing), thus HardwareVertexBuffer is broken for DX10.
Thanks
User avatar
xadhoom
Minaton
Posts: 973
Joined: Fri Dec 28, 2007 4:35 pm
Location: Germany
x 1

Re: Ogre::Cuda Released !

Post by xadhoom »

Wow, very nice work. Could be a push forward for an official future integration into Ogre. :D

Unfortunately I don´t have cuda support on my machine yet to test it. :(
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Ogre::Cuda Released !

Post by al2950 »

Very cool!!

How easy would it be to create abtraction layer so you could use it for CUDA and OpenCL??
User avatar
dddExperiments
Gnoblar
Posts: 21
Joined: Sun Mar 21, 2010 4:27 pm
Location: Bordeaux, France
x 1
Contact:

Re: Ogre::Cuda Released !

Post by dddExperiments »

Thanks !

@al2950 : Indeed the same kind of libray could be created for OpenCL. But I never really played with OpenCL ... so far :wink:.

As far as I know, the main difference between OpenCL and Cuda is that OpenCL kernel are compiled JIT.
(could be done with Cuda using driver API, but I'm only using the runtime API)
I think that OpenCL kernels (*.cl files) could be handle in Ogre3D using a custom Ogre::RessourceManager.
Then, the same mechanism could be used : register/unregister, map/unmap and getPointer.

I really like to have some feedback from people having multiple GPU (even Nvida + AMD) and people using WinXP : just to know what's working.
BTW I got lower performance under OpenGL (DX9 : 630fps, GL : 410fps)
Same demo with only HardwareVertexBuffer (DX9 : 700fps, GL : 630fps)
Same demo with only Texture2D (DX9 : 710fps, GL : 620fps)
User avatar
Kyle_Katarn
Halfling
Posts: 92
Joined: Tue Jul 21, 2009 7:51 am
Location: Australia

Re: Ogre::Cuda Released !

Post by Kyle_Katarn »

I'm not really that knowledgable in the CUDA stuff, all I really know is that thanks to it, graphics cards are handling data calculations for things such as AI and Physics (I think (I need to find an "Idiots guide to CUDA" =P)).

So can I assume that the actual warping plane used to be done via the CPU and not the GPU, or am I completely off the mark here?

Great job none-the-less, I hope this will go along the lines of native intergration. Keep it up.
User avatar
dddExperiments
Gnoblar
Posts: 21
Joined: Sun Mar 21, 2010 4:27 pm
Location: Bordeaux, France
x 1
Contact:

Re: Ogre::Cuda Released !

Post by dddExperiments »

@Kyle_Katarn : you are right, the warping plane and the fancy texture are computed on the GPU.

BTW, I have managed to replicate the HardwareVertexBuffer demo using OpenCL :D !
screenshot.jpg
If I have enough time I'll try to polish my hacky OpenCL demo to create Ogre::OpenCL library...
But it's way more complicated for OpenCL as there are "particularities" for :
  • OpenGL : Mac / Linux / Windows
  • DirectX : Nvidia / AMD
I have managed to implement OpenGL/Win and DirectX9/Nvidia for HardwareVertexBuffer only.
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: Ogre::Cuda Released !

Post by al2950 »

:shock: Fast work!

Yeah OpenCL is a little more complicated but the implementation should be the same for all platforms as that is the point of OpenCL! However i must admit i have only started using it on Windows on NVIDA cards, but i assumed!
User avatar
Lee04
Minaton
Posts: 945
Joined: Mon Jul 05, 2004 4:06 pm
Location: Sweden
x 1

Re: Ogre::Cuda Released !

Post by Lee04 »

About time... :-)

Cool I have some prototypes for massive crowd AI in DirectX and openGL I can port now to Ogre...with supporting instanced HOQ's

Lee
Ph.D. student in game development
User avatar
dddExperiments
Gnoblar
Posts: 21
Joined: Sun Mar 21, 2010 4:27 pm
Location: Bordeaux, France
x 1
Contact:

Re: Ogre::Cuda Released !

Post by dddExperiments »

@al2950 : you're right, the goal of OpenCL is to have the same kernel running on all platform. But the initialization/registration/mapping of ressources is platform dependant... And this is the part I'm trying to include in Ogre3D with Ogre::OpenCL.

@Lee04 : I'd love to see something more useful than a warping plane running with Ogre::Cuda or Ogre::OpenCL. But I'm trying to have GPU acceleration (Cuda or OpenCL) on the same GPU used by Ogre3D in order to share object created by Ogre3D with Cuda or OpenCL. And I'm not sure you need this to run pure AI. It can still be used to hide specific initilization for each Graphic API (DX9, GL).

BTW, you can checkout an early version of Ogre::OpenCL on my google code.
It's still very experimental, with this version you get :
  • OpenGL support (cross-platform ?)
  • Dx9 support for Nvidia card only
  • HardwareVertexBuffer only (no texture yet)
User avatar
Lee04
Minaton
Posts: 945
Joined: Mon Jul 05, 2004 4:06 pm
Location: Sweden
x 1

Re: Ogre::Cuda Released !

Post by Lee04 »

Yeh it mixes graphics and AI on the GPU for instanced massive crowds in many passes.
Flocking
Animation
Skinning
Physics
Drawing
HOQ
It's a project I done with some strudents each doing one of the passes
The animation GPU engine was not acctually completed. It uses teh CPU for that right know.


It was done sevral years ago on Dx9 hardware using GPGPU not Cuda.
And Ogre couldn't do GPGPU that I required.

About now Ogre can but then again we know want to use Cuda or OpenCL right?
Ph.D. student in game development
User avatar
dddExperiments
Gnoblar
Posts: 21
Joined: Sun Mar 21, 2010 4:27 pm
Location: Bordeaux, France
x 1
Contact:

Re: Ogre::Cuda Released !

Post by dddExperiments »

@Lee04 : Good to see that It can help you. In fact I first started to use Ogre3D for GPGPU purposed and then I tryed Cuda. And I was wondering if I could create another lib to help GPGPU utilisation in Ogre3D.

GPGPU utilisation in Ogre3D is not that easy, you have to :
  • create RenderTarget texture
  • desactivate auto update on the render target
  • add a viewport with a camera
  • add a compositor to the viewport
  • add a listener to the compositor (optional)
  • manualy call update() to do the computation
I have used this technique to implement partially Surf using GPGPU, but I think a tiny lib can help a little bit to hide this complexity... :wink:
Post Reply