Hi.
Now, I’m developing a simulation program, and there are a lot of rigid bodies in the scene.
So I need a lot of time to simulate, then I try to accelerate the program to use GPU.
I found the method to simulate rigid bodies using CUDA on PhysX, however I couldn’t.
Is there a method to simulate rigid bodies using CUDA on PhysX?
And if there are no method, I need to write CUDA by myself?
Hi,
As far as I know, you just have to give your physX simulation a GPU dispatcher.
That’s done this way on our side:
PxCudaContextManager* cudaContaxtManager = initCudaContextManager(this);
if(cudaContaxtManager)
{
if(!sceneDesc.gpuDispatcher)
{
sceneDesc.gpuDispatcher = cudaContaxtManager->getGpuDispatcher();
TRACE_INFO(getPhysicsLog_PhysX(), "GPU acceleration activated on device: "<<cudaContaxtManager->getDeviceName()<<
"\nDriver version: "<<cudaContaxtManager->getDriverVersion()<<
"\nMemory: "<<cudaContaxtManager->getDeviceTotalMemBytes()<<
"\nSM unit count: "<<cudaContaxtManager->getMultiprocessorCount()<<
"\nSM clock frequency: "<<cudaContaxtManager->getClockRate());
}
}
else
{
finishCudaContextManager(this);
TRACE_ERROR(getPhysicsLog_PhysX(), "Could not use GPU acceleration. Fall back on CPU.");
}
And then use the scene description as usual to initialize your physX simulation.
Thank you for your quick reply, grandYann:)
I tried your method, and I could give PhysX a GPU dispatcher.
However, my simulation program didn’t use GPU to simulate.
My simulation program uses only rigid bodies.
Can I use CUDA acceleration about rigid bodies?
Or is PhysX only support CUDA about cloth and particle?
Thank you for your quick reply, grandYann:)
I tried your method, and I could give PhysX a GPU dispatcher.
However, my simulation program didn’t use GPU to simulate.
My simulation program uses only rigid bodies.
Can I use CUDA acceleration about rigid bodies?
Or is PhysX only support CUDA about cloth and particle?
I’ve come to know since I answered that only particles and cloth are simulated on GPU, rigid bodies will always stay on CPU with this physX version ;)
Have you done any in-depth profiling to figure out where time is being spent or are you just assuming that its slow because you have a lot of rigid bodies and GPU simulation will be help. There is a lot of reason why the simulation could be slow ( again don’t know what metric is being used to measure this…and please don’t say frames per second ). How many rigid bodies is alot ? Are the rigid body using shared shapes, if not, can they be configured as such? Are you doing a lot of scene readback ? …and the list goes on.
Hello busta78,
sorry for the late reply.
I make a building on the scene.
There are about 8,000 rigid bodies, and each rigid bodies are connected by fixed joint.(The total of joint is 15,000)
And I want to enlarge the scale of simulation.
I don’t use sharing shapes, and that’s news to me.
I’ll try to check it.
Thank you.