Re: CPU multithreading is working!
Posted: Tue Aug 22, 2017 5:44 pm
A few quick clarifications:
This only arguably counts, but I did make sure everything worked with the SequentialTaskScheduler prior to writing my own scheduler. I can confirm everything works fine with it. But...it's not multi-threaded. That said, these issues appear to be race conditions. I'll probably try OpenMP for testing purposes, but I don't consider that to be a long term solution for my project.
Wrapping around would make sense, however I was observing issues on the first or second call to StepSimulation. Assuming it's only incrementing once on thread creation and starts at zero (which I believe is what I saw), then not enough threads are being created prior to the error for that to occur. I could debug further.
I am aware that the BvhTriangleMeshShape can't collide with itself (That was one of the first things I tried doing with bullet years ago). The collisions are boxes and spheres with most being convex hulls. All of the bodies are RigidBodies. When those collisions occur, infinite loop. As I said above, the loop doesn't occur with the SequentialTaskScheduler.
Edit:
I've debugged further and found that I was focusing in on the wrong counter. In the "getNext()" method on the ThreadSafeCounter class you perform a check to see if it has exceeded the maximum supported number of threads and assert if it has. That was the error I was hitting.
This only arguably counts, but I did make sure everything worked with the SequentialTaskScheduler prior to writing my own scheduler. I can confirm everything works fine with it. But...it's not multi-threaded. That said, these issues appear to be race conditions. I'll probably try OpenMP for testing purposes, but I don't consider that to be a long term solution for my project.
Wrapping around would make sense, however I was observing issues on the first or second call to StepSimulation. Assuming it's only incrementing once on thread creation and starts at zero (which I believe is what I saw), then not enough threads are being created prior to the error for that to occur. I could debug further.
I am aware that the BvhTriangleMeshShape can't collide with itself (That was one of the first things I tried doing with bullet years ago). The collisions are boxes and spheres with most being convex hulls. All of the bodies are RigidBodies. When those collisions occur, infinite loop. As I said above, the loop doesn't occur with the SequentialTaskScheduler.
Edit:
I've debugged further and found that I was focusing in on the wrong counter. In the "getNext()" method on the ThreadSafeCounter class you perform a check to see if it has exceeded the maximum supported number of threads and assert if it has. That was the error I was hitting.