OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Find statistics (min, max, mean, stddev) using NPP or alternative of RTT/FBO


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute]
View previous topic :: View next topic  
Author Message
creature (Ethan Fahy)
Appreciator


Joined: 07 Sep 2011
Posts: 142

PostPosted: Fri Apr 05, 2013 4:21 pm    Post subject:
Find statistics (min, max, mean, stddev) using NPP or alternative of RTT/FBO
Reply with quote

I have a setup very similar to osgRTTDemo. In order for my CUDA kernel to do any work, I must first gather some basic statistics about the floating point values in the FBO. I need, min, max, mean, stddev, and eventually a histogram. These are all parallel reduction problems and the standard CUDA examples has a whitepaper on optimized parallel reduction algorithms. However, I would prefer to use the built-in NPP functions that are able to gather those statistics for me.

Since the values in the FBO are changing every frame I need to recalculate the statistics on a per-frame basis. In osgRTTDemo, the launch() function within TexFilter is where the CUDA kernel is called on a per-frame calculation. Is this where I should try to also implement an NPP statistics call?

I found this thread:
http://stackoverflow.com/questions/12480821/how-to-use-cuda-nppnvidia-performance-primitives-on-opengl-textures

that says that NPP needs a cuda device pointer in order to get those statistics; am I able to retrieve the cuda device pointer from a osgCuda::Texture2d object?

I think I may have jumped in too deep with this CUDA stuff and may just need to go back and teach myself CUDA from the beginning, but any advice is appreciated as I slog my way through this problem. Thanks.
Back to top
View user's profile Send private message
jens.svt
User


Joined: 16 Mar 2009
Posts: 30

PostPosted: Tue Jun 04, 2013 5:49 pm    Post subject:
Reply with quote

Hi creature,

yes, the launch function is exactly where you should call those npp-functions.

You get the device pointer by calling myBuffer->map(osgCompute::MAP_DEVICE).

If you want to get access to the internal texture memory, call myBuffer->map(osgCompute::MAP_DEVICE_ARRAY) and cast the "void*" pointer to a "cudaArray*" pointer.

Regards,
Jens
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> osgCompute [osgCompute] All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts CMake: 3rdPartyPackages - extended to... robertosfield Submission 1 Wed Dec 21, 2016 5:10 pm View latest post
No new posts CMake: 3rdPartyPackages - extended to... zonk Submission 0 Sat Oct 22, 2016 3:20 pm View latest post
No new posts Could not find plugin to read objects... robertosfield Plugins [osgPlugins] 2 Sat Jul 02, 2016 1:45 pm View latest post
No new posts Alternative to PBO crashing on Intel ... kornerr General 1 Sun May 31, 2015 3:33 pm View latest post
No new posts Find out if a node is "dirty" szellmann General 7 Sun Mar 01, 2015 10:01 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP