Loading...
You are not logged-in Login/Register





  • Posts   Search Threads
  • _loeiz_May 28, 2009 9:23 AM PDT   
    Multiple worlds instance in a multithreaded environment

    Hi everybody !

    I'm trying to perfom two independant simulation using havok. To do so, I do instanciate two hkpWorld, and use them separately.

    However, I do only one call to hkBaseSystem::init(...) function, that seem reasonable. Then, I use , still independently the two worlds a two different threads that do not communicate.

    The thing is that sometimes (and I can't figue out why) after a random time of execution, the application crashes, while the two threads were executing Havok's code. I was wondering if the two worlds share some data ?

    Is it reasonable to use it like that, or should I make two call to the init function, to have two separate memory pool for the threads ?

    The other problem is when I make two calls to hkBaseSystem::init(), the first corresponding hkBaseSystem::quit() makes the application crash, while only one init and one quit call works well.

     

    Thank you in advance for your help !



    havokjasongJune 1, 2009 5:05 PM PDT
    Rate
     
    Re: Multiple worlds instance in a multithreaded environment

    hi _loeiz_,

    Havok is intentionally not thread safe for performance reasons.  What you are proposing is very doable though.  You can multithread Havok by specifying a multithreaded world type, among other things.  There is considerable documentation on how to do so.  I would recommend reading both "Common Havok Components/Multithreading" and "Havok Physics/Multithreading Issues".

    The memory managers are thread safe, but you will introduce a performance bottleneck unless you use seperate memory pools. Look at "Common Havok Components/Havok Base Library/Memory Management/Multithreaded Memory".

    Let me know if these help you with what you are tring to accomplish.

    cheers,
    jason


    Jason Gorski
    Developer Support Engineer
    Havok™
    2008 Emmy Award Winner
    \"Turning Creative Aspirations into Technical Realities™\"
    www.havok.com

    havokchrisJune 6, 2009 1:25 AM PDT
    Rate
     
    Re: Multiple worlds instance in a multithreaded environment

    Hi Loeiz,
    In addition to what Jason said above:

    You should call hkBaseSystem::init in your main thread. You also need to call hkBaseSystem::initThread in each other thread that uses Havok - this sets up a thread-local instance of hkThreadMemory.

    If that still doesn't work, can you provide some of the information (e.g. callstacks, assert messages) described here:

    http://software.intel.com/en-us/forums/showthread.php?t=62766

    Thanks!

    -Chris


    abraxaxMarch 14, 2010 3:04 PM PDT
    Rate
     
    Re: Multiple worlds instance in a multithreaded environment

    Resources like the one you mentioned here will be very useful to me! I will post a link to this page on my blog. I am sure my visitors will find that very useful


    lace wedding dresses|blue topaz earrings

Forum jump:  

Intel Software Network Forums Statistics

17,025 users have contributed to 48,317 threads and 172,754 posts to date.

In the past 24 hours, we have 9 new thread(s) 56 new posts(s), and 52 new user(s).

In the past 3 days, the most popular thread for everyone has been How to manage rounding by IVF ?? The most posts were made to Most likely, the issue is that The post with the most views is Optimalization of sine function\'s taylor expansion

Please welcome our newest member redfruit83


For more complete information about compiler optimizations, see our Optimization Notice.