Hi Art, I have used of even read detailed docs on CUDA yet, but my inclination would be to map CUDA to a graphics context rather than have a singleton, or if a single CUDA context can map to multiple contexts then for it to be assigned to the GraphicsContext that you want to associate it with, but his would require that CUDA context to be thread safe. Now if a single CUDA context can work with multiple context, on multiple GPU's and work multi-thread then perhaps a Singleton might be justified.
Robert. On Sun, Nov 23, 2008 at 2:51 PM, Art Tevs <[EMAIL PROTECTED]> wrote: > Hi folks, > > currently I need cuda functionality in my application. Because cuda is just > another type of shader (how I like to say, not seriously :) ), I would like > to include it into osgPPU. So that we could use cuda and normal shaders > inside of osgPPU and hence inside of osg. > > My question is: Does somebody ever tried to use cuda with osg? I am > interested in the way how to initialize/release the stuff and to build > successfull cuda-osg-compiler pipeline, because cuda kernels has to be > compiled externally, I think. > > My thoughts were: > > 1) Some kind of singleton class describing one cuda device. Whenever there is > a first access to cuda the singleton class and hence the real cuda device are > initialized. Here the question, if cuda device can be initialized after the > OpenGL context is already created or does it have to be before it? If second > is valid, then some intervention into the osg code is required, to be able to > init the device before opengl. > > 2) On every init or assignment of a texture to a osgPPU's cuda unit, there > will be a mapping of the texture to the cuda environment. This shouldnt' be a > big deal, I hope. > > 3) The output of a unit is also assigned to the cuda environment. as in step > 2. Hence we could achieve a smooth run of cuda kernels on unit's textures and > hence on osg's rtt cameras. My colleague working at nVidia means that this > shouldn't be a big deal, since mapping and unmapping of textures to cuda > arrays is just like a copy of a texture inside the video memory. This > approach is fast enough to be included into realtime applications and even > the games. But, of corse the hope, that cuda developers enables direct access > to OpenGl textures through cuda, is there ;) > > Any comments or suggestions?! > > Best regards, > art > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

