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)
which bullet settings are needed for async-physics ?
- AnyOldName3
- Posts: 2678
- Joined: 26 Nov 2015, 03:25
Re: which bullet settings are needed for async-physics ?
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.
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.
- 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 ?
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.
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.
Re: which bullet settings are needed for async-physics ?
Yep, the compiler part was incorrect guesswork.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.
Thank you for the clear answers, AnyOldName3 and psi29a .
Working on a PKGBUILD for multithreaded bullet with double precision for personal use now.
Re: which bullet settings are needed for async-physics ?
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
Re: which bullet settings are needed for async-physics ?
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
@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
Re: which bullet settings are needed for async-physics ?
with latest master at least, it looks like you just need to change:
https://gitlab.com/OpenMW/openmw/-/blob ... s.txt#L112
to:
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
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)
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