which bullet settings are needed for async-physics ?

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
LoneWolf
Posts: 51
Joined: 26 Sep 2017, 19:13

which bullet settings are needed for async-physics ?

Post by LoneWolf » 15 Oct 2020, 22:44

I noticed that https://gitlab.com/OpenMW/openmw/-/comm ... 91edbd2790 allows physics to run in separate threads when bullet is built with multithreading support .

I checked bullet 3.06 https://github.com/bulletphysics/bullet ... eLists.txt .
There appear to be 3 options for multithreading support in bullet that each require specific compiler support

OpenMP llvm/clang
Intel TBB gcc
Microsoft Parallel Patterns Library - msvc

Which of those can be used with openmw async physics ?
(hopefully all of them)

User avatar
AnyOldName3
Posts: 1939
Joined: 26 Nov 2015, 03:25

Re: which bullet settings are needed for async-physics ?

Post by AnyOldName3 » 16 Oct 2020, 02:56

It should be enough just to enable the BULLET2_MULTITHREADING option and let CMake pick the implementation. If you particularly want to use OpenMP, TBB or the Microsoft thing, you can, but otherwise it'll use normal features like pthreads.

By the way, I think you've got your compiler support wrong. I see handling for OpenMP with MSVC, too, and nothing compiler-specific with TBB, just that you need to provide a path to the library.
AnyOldName3, Master of Shadows

User avatar
psi29a
Posts: 4917
Joined: 29 Sep 2011, 10:13
Location: Belgium
Gitlab profile: https://gitlab.com/psi29a/
Contact:

Re: which bullet settings are needed for async-physics ?

Post by psi29a » 16 Oct 2020, 09:42

Just so that everyone is on the same thread, that multi-threaded bullet isn't necessary to make use of async physics so long as the value is 0 (normal behaviour) or 1 (runs in another thread). It is only when you set it to 2 or above that you'll need a multi-threaded bullet.

OpenMW just relies on Bullet, so the underlying bits on how Bullet achieves this is not our problem. We leave that to the Bullet experts. ;)

LoneWolf
Posts: 51
Joined: 26 Sep 2017, 19:13

Re: which bullet settings are needed for async-physics ?

Post by LoneWolf » 17 Oct 2020, 00:26

AnyOldName3 wrote:By the way, I think you've got your compiler support wrong. I see handling for OpenMP with MSVC, too, and nothing compiler-specific with TBB, just that you need to provide a path to the library.
Yep, the compiler part was incorrect guesswork.


Thank you for the clear answers, AnyOldName3 and psi29a .


Working on a PKGBUILD for multithreaded bullet with double precision for personal use now.

fredzio
Posts: 6
Joined: 12 Apr 2019, 05:56

Re: which bullet settings are needed for async-physics ?

Post by fredzio » 17 Oct 2020, 09:57

LoneWolf wrote:
15 Oct 2020, 22:44
There appear to be 3 options for multithreading support in bullet that each require specific compiler support

OpenMP llvm/clang
Intel TBB gcc
Microsoft Parallel Patterns Library - msvc
These options control which thread pool implementation Bullet's solver uses. Openmw doesn't use the Bullet solver so they are a no-op.

To get bullet with the subset of multithreading support which openmw uses, Bullet needs options
BULLET2_USE_THREAD_LOCKS for 2.87
BULLET2_MULTITHREADING for 2.88+

As for config:
1 thread works always
1 thread with multithreaded bullet will be faster than single threaded: for most part main thread and physics thread can run concurrently
2 and more needs multithreaded bullet, and might be faster if there is enough workload and hardware to lift it

LoneWolf
Posts: 51
Joined: 26 Sep 2017, 19:13

Re: which bullet settings are needed for async-physics ?

Post by LoneWolf » 20 Oct 2020, 13:14

Thanks for the clarification.


@openmw-git users of Archlinux, Manjaro and other aur supporting distros :

I created and uploaded a bullet package with multithreaded support.
install https://aur.archlinux.org/pkgbase/bullet-multithreaded/ and rebuild openmw-git against it

Post Reply