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: 138
Joined: 26 Sep 2017, 19:13

which bullet settings are needed for async-physics ?

Post by LoneWolf »

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: 2678
Joined: 26 Nov 2015, 03:25

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

Post by AnyOldName3 »

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.
User avatar
psi29a
Posts: 5362
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 »

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: 138
Joined: 26 Sep 2017, 19:13

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

Post by LoneWolf »

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: 9
Joined: 12 Apr 2019, 05:56

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

Post by fredzio »

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: 138
Joined: 26 Sep 2017, 19:13

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

Post by LoneWolf »

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
nif
Posts: 14
Joined: 14 Apr 2015, 03:11

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

Post by nif »

with latest master at least, it looks like you just need to change:

https://gitlab.com/OpenMW/openmw/-/blob ... s.txt#L112

to:

Code: Select all

option(OPENMW_USE_SYSTEM_BULLET "Use system provided bullet physics library" OFF)
and then this block catches, which downloads Bullet3

https://gitlab.com/OpenMW/openmw/-/blob ... ts.txt#L18

which in turn I believe has multithreading on by default - and so it should work.

At least for mine when I set a high thread count the log doesn't output an err as per the link below which I assumes means its async-physics is doing its thing:

https://openmw.readthedocs.io/en/latest ... ysics.html

not sure if there is an in-game / debugging way to double confirm. Anyway, C++ dependency management is crazy
Post Reply