Greetings all,
I am trying to create a mop simulation by attaching several soft body ropes [mop bristles] to a movable rigid body [mop handle] (btBvhTriangleMeshShape). The problem is, with only 10 ropes in the scene, the simulation runs extremely slow...this is odd, seeing as the soft body demo with the sticks has more than 10 sticks in the scene, but there's not extreme lag as is the case in my setup. Maybe this is because I am attaching the ropes to a rigid body instead of simply creating them in empty space. I am running the simulation on the CPU. I understand that Bullet allows integration with the GPU (CUDA), but I figured this was more involved than simply calling a function. I say this in part because, when I run the GPU3dDemo, I can't switch from CPU processing to CUDA processing (I hit 'm' and 'u' but the switch doesn't occur - when I search through my code, I see that 'u' will only switch the solver to CUDA if BT_USE_CUDA is 1, which it is not. ...I wonder why this definition is turned off...am I not supposed to turn it back on? And even if I could set it to 1, I'm not sure where I'm supposed to. EDIT: I found the instructions for enabling CUDA in btGpuDemoDynamicsWorld3D.h! I will give this a shot and tell you how it goes.). Also, I'm not sure what the difference is between a "solver" and a "motion integrator". 'u' toggles between solvers, but 'm' toggles between motion integrators.
Would anyone have any ideas as to how to speed things up? By either...
- simplifying the ropes somehow
- running simulations on the GPU
- some other secret setting :3
Thanks!
--Leezer
Speeding up simulation performance (GPU help)
-
Leezer
- Posts: 22
- Joined: Mon Nov 09, 2009 5:06 am
Re: Speeding up simulation performance (GPU help)
Hmm, so I am trying to build the libbulletcuda VS project (to get libbulletcuda_d.lib and libbulletcuda.lib). No dice. I've tried building all of the configurations (Debug, DebugDLL, DebugDoublePrecision, Release, ReleaseDLL, ReleaseDoublePrecision), but there's always a header that can't be found. For example, when building the Debug config:
Even though the VS project settings have ../../src as an include directory. So, I opened up btGpuDemo3dSharedCode.h and changed #include "LinearMath/btMinMax.h" to #include "../../src/LinearMath/btMinMax.h" and compiled again. After doing this, I got 76 errors. Here's just a sampling:
Any ideas from anyone who has built libbulletcuda using VS before?
--Leezer
Code: Select all
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(16) : fatal error C1083: Cannot open include file: 'LinearMath/btMinMax.h': No such file or directoryCode: Select all
../../src/LinearMath/btMinMax.h(21): error: this declaration has no storage class or type specifier
../../src/LinearMath/btMinMax.h(21): error: "SIMD_FORCE_INLINE" is not a function or static data member
../../src/LinearMath/btMinMax.h(21): error: expected a ";"
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(115): warning: parsing restarts here after previous syntax error
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(117): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(139): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(150): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(161): error: expected a declaration
./../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(172): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(183): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(245): warning: parsing restarts here after previous syntax error
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(246): error: expected a declaration
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(249): error: this declaration has no storage class or type specifier
../../Demos/Gpu3dDemo/btGpuDemo3dSharedCode.h(249): error: expected a ";"
(etc)
--Leezer
-
Leezer
- Posts: 22
- Joined: Mon Nov 09, 2009 5:06 am
Re: Speeding up simulation performance (GPU help)
Still no luck with building Extras/CUDA/libbulletcuda.vcproj. ;__;
However, I found that I was calling cleanProxyFromPairs() for all colliding objects in the dynamics world at each time step. Yipes! Once I commented out this line, things ran a lot more smoothly. Now, my maximum number of ropes seems to be 60 instead of 10. An improvement, but I'm sure the GPU could do better...
Anyway, just wanted to make this note just in case someone else ran across a similar problem.
However, I found that I was calling cleanProxyFromPairs() for all colliding objects in the dynamics world at each time step. Yipes! Once I commented out this line, things ran a lot more smoothly. Now, my maximum number of ropes seems to be 60 instead of 10. An improvement, but I'm sure the GPU could do better...
Anyway, just wanted to make this note just in case someone else ran across a similar problem.
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Speeding up simulation performance (GPU help)
Instead of using btBvhTriangleMeshShape, you better use a btCompoundShape with convex child shapes. It provides better performance and it is more robust for moving objects.
See the Bullet/Demos/ConvexDecompositionDemo for an example how to automatically create such compound shape from a concave triangle mesh. You can also manually create those pieces.
Thanks,
Erwin
See the Bullet/Demos/ConvexDecompositionDemo for an example how to automatically create such compound shape from a concave triangle mesh. You can also manually create those pieces.
Thanks,
Erwin
-
Leezer
- Posts: 22
- Joined: Mon Nov 09, 2009 5:06 am
Re: Speeding up simulation performance (GPU help)
I would except I need to be able to deform the vertices of the collision shape. btBvhTriangleMeshShape is the only collision shape that allows for vertex deformation, right? (using refitTree()).
-
mia1978
- Posts: 2
- Joined: Mon Dec 28, 2009 8:34 am
Re: Speeding up simulation performance (GPU help)
Error same (about CUDA) , who solved?
-
OSasuke
- Posts: 47
- Joined: Tue Dec 09, 2008 10:12 am
Re: Speeding up simulation performance (GPU help)
How did you called cleanProxyFromPairs(), I mean in which class it is situated ?
-
mia1978
- Posts: 2
- Joined: Mon Dec 28, 2009 8:34 am
Re: Speeding up simulation performance (GPU help)
Problem solved (change example code(CUDA) and multitread project).
-
Leezer
- Posts: 22
- Joined: Mon Nov 09, 2009 5:06 am
Re: Speeding up simulation performance (GPU help)
Bumping this...
Thanks
-- Leezer
For those of you (mia1978?) who were able to resolve the CUDA example program compilation issues, could you please share how you were able to do so?Problem solved (change example code(CUDA) and multitread project).
Thanks
-- Leezer
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Speeding up simulation performance (GPU help)
We are moving to using OpenCL for Bullet 3.x. The OpenCL work is currently under development, you can preview some of this in the OpenCL branch (http://bullet.googlecode.com/svn/branches/OpenCL)
Thanks,
Erwin
Thanks,
Erwin
-
Leezer
- Posts: 22
- Joined: Mon Nov 09, 2009 5:06 am
Re: Speeding up simulation performance (GPU help)
So there's absolutely no way to "force" CUDA (or the in-development OpenCL) to work with the current Bullet release?
I only ask because I'm trying to speed up the performance of a project that will be reviewed before the next version of Bullet comes out.
Thanks...
I only ask because I'm trying to speed up the performance of a project that will be reviewed before the next version of Bullet comes out.
Thanks...