Re: [osg-users] Suggestion for Cuda + OSG, smooth particle hydrodynamic

2011-10-25 Thread J.P. Delport

Hi,

On 23/10/2011 04:25, brian tse wrote:

Hi,

I am very new to CUDA and OSG, please accept my apologies if this is
a stupid questions. I am trying to build SPH algorithm using Cuda to
calculate the particle forces and update its position. I would like
to ask is there a way in Cuda to pass the position array to OSG
without doing a  cudaMemcpyDeviceToHost operation on every loop?

Is there some special function in OSG that directly integrated into
CUDA?
I'm quite sure there is no such function in plain OSG. You can have a 
look at osgPPU or osgCompute node kits that allows one to pass data 
between OSG/CUDA. I've only used the texture passing functions, but you 
should look for code that passes VBOs between CUDA/OSG. Consult the CUDA 
docs on the sections about OpenGL interop.




I have a CPU loop for CUDA kernel, and I have another CPU loop for
OSG. When the OSG need the graphics update, it send a flag to CUDA
reqesting for new position array. Is this the right way to do it?
You should be able to avoid copy to host. Let CUDA update the VBO that 
OSG then uses. The synchronisation might be an issue, that's why it 
might be better to use cuda inside the scene graph.


cheers
jp



Thank you very much in advance. I really appreciate your effort.

Cheers, Brian

-- Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43510#43510





___ osg-users mailing
list osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. 
The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.


This message has been scanned for viruses and dangerous content by MailScanner, 
and is believed to be clean.


___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Suggestion for Cuda + OSG, smooth particle hydrodynamic

2011-10-25 Thread brian tse
Hi,

Thank you very very much for your reply. I will post the algorithm up once I 
got it up and running. From your suggestion, at least now I have a better 
direction to search for the solution.

I can't really do the CUDA inside the osg loop, mainly because i need the cuda 
to run as fast as maximum possible for robotic control application. They has to 
be separated.

Thank you very much for your help! Appreciate all your effort.

Cheers,
brian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43549#43549





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Suggestion for Cuda + OSG, smooth particle hydrodynamic

2011-10-23 Thread brian tse
Hi,

I am very new to CUDA and OSG, please accept my apologies if this is a stupid 
questions. I am trying to build SPH algorithm using Cuda to calculate the 
particle forces and update its position. I would like to ask is there a way in 
Cuda to pass the position array to OSG without doing a  
cudaMemcpyDeviceToHost operation on every loop? 

Is there some special function in OSG that directly integrated into CUDA?

I have a CPU loop for CUDA kernel, and I have another CPU loop for OSG. When 
the OSG need the graphics update, it send a flag to CUDA reqesting for new 
position array. Is this the right way to do it?

Thank you very much in advance. I really appreciate your effort.

Cheers,
Brian

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=43510#43510





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org