Page 1 of 1

Bullet3 using MT

Posted: Thu Jul 09, 2020 6:35 am
by asif_bahrainwala
I am trying to use the default threaded scheduler,

cout<<"btCreateDefaultTaskScheduler:"<<btCreateDefaultTaskScheduler()<<endl;
cout<<"btGetOpenMPTaskScheduler:"<<btGetOpenMPTaskScheduler()<<endl;

both cases return NULL.
Is there some flag to be set to while building bullet3 to get this work.

My simulation running the default sequential solver works fine, using btDiscreteDynamicsWorldMt crashes randomly:

pCollisionConfiguration = make_shared<btDefaultCollisionConfiguration>();
pBroadphase = make_shared<btDbvtBroadphase>();


btSetTaskScheduler(btCreateDefaultTaskScheduler());

psolver = make_shared<btSequentialImpulseConstraintSolverMt>();
pDispatcher =make_shared<btCollisionDispatcherMt>(b.pCollisionConfiguration.get());

pSolverPool = make_shared<btConstraintSolverPoolMt>(BT_MAX_THREAD_COUNT);
pWorld = make_shared<btDiscreteDynamicsWorldMt>(pDispatcher.get(), pBroadphase.get(), pSolverPool.get(), psolver.get(), b.pCollisionConfiguration.get());

Re: Bullet3 using MT

Posted: Thu Jul 09, 2020 2:14 pm
by asif_bahrainwala
using VS017, I select all projects and add BT_THREADSAFE as a preprocessor to all of them.
The simulation runs fine on window, I need something similar on Linux

Re: Bullet3 using MT

Posted: Thu Jul 09, 2020 7:51 pm
by asif_bahrainwala
cat build_cmake_pybullet_double.sh
cmake -DBT_THREADSAFE=1 -DBUILD_PYBULLET=ON -DBUILD_PYBULLET_NUMPY=ON -DUSE_DOUBLE_PRECISION=ON -DBT_USE_EGL=ON -DCMAKE_BUILD_TYPE=Debug .. || exit 1

I added BT_THREADSAFE=1 , with this, btCreateDefaultTaskScheduler() gives me a non-null object

adding this to cmake -DBULLET2_MULTITHREADING=ON -DBULLET2_USE_OPEN_MP_MULTITHREADING=ON does the trick