PhysX 3.2 API Windows: Looking for "Best Practises" to initialize GPU context

I’m moving from 2.x to 3.x of the API and for the life of me have not been able to get GPU acceleration working in my app.

Per the SDK User Guid:Tasks there is a note about no context without an nVidia assigned appGUID ?
There are suggestions in the readme’s that GPU acceleration is only applied to particle and cloth libraries.

Hopefully GPU acceleration applies to the entire library. I’ve yet to see how it is initialized though. From the 3.2 samples, in PhysXSample.cpp we have:

if(mCreateCudaCtxManager)
{

#ifdef PX_WINDOWS
pxtask::CudaContextManagerDesc cudaContextManagerDesc;
mCudaContextManager = pxtask::createCudaContextManager(*mFoundation, cudaContextManagerDesc, mProfileZoneManager);
if( mCudaContextManager )
{
if( !mCudaContextManager->contextIsValid() )
{
mCudaContextManager->release();
mCudaContextManager = NULL;
}
}
#endif
}

While debugging the sample app (under VS2012) and choosing the particle sample the variable mCreateCudaCtxManager is false yet the code flow continues as if true so there are debugger issues. Several lines down it turns true /shrug. The code block creates a context and all is well.

The same code in my app returns NULL from creating a context and all is not well. This is the same for my older laptop with 8800M and a newer machine with a GTX570 and driver 310.90. The app works fine with the CPU dispatcher, I’m just looking to enable any GPU acceleration.

So, I’m looking for advice on the minimal best practice to initialize the GPU. I’ve read the manual, tried working it out with the VS2012 debugger but have yet to find the true mechanism. I’m guessing there is another configuration flag or some such but am not seeing it.

Thank you nVidia for sharing your SDK !

Hopefully GPU acceleration applies to the entire library
Nope, only to cloth and particles

Thanks for the heads up on particles and cloth.

Any advice for getting a GPU context ? The above compiles but returns NULL when ran. Stepping through the samples I can see the source flow but nothing makes sense with false vars flowing true etc. I’m considering trying a MinGW or trying to find an alternate debugger to track how this context is successfully created.

I appreciate nVidia sharing the library but the one criticism I have for sample code (a trend many have) is they have a framework which is great for them but the purpose can be lost of helping others understand their SDK’s value by these massive code abstractions.

Hi,

I suspect that this could be a problem with VS2012. There have been reports of failure of the CUDA context when code is compiled with VS2012. I’ll ask an expert to look into this.

Thanks,
Mike

Hi,

Do you see any error messages on stdout? And does createCudaContextManager() return NULL or does contextIsValid() return false?

Thanks,
Christian

Nothing on stdout but following the process in the debugger shows a return of NULL.

As a note, I am not using VS2012 libs, only the VS2012 IDE. The project is using Win7.1 SDK.

Honestly, at this stage, finding out there is no GPU rigid body simulation I just want to go back 2.8 or Bullet now is showing some good OpenCL acceleration. PhysX 3.x is just…limited.

A little feedback from dealing with the new library. I support nVidia by purchasing their products, building machines with their products for others, develop for their products so just feeling a bit let down here:

My projects have the big three running as DLL plugin support for comparison and the new PhysX is just starting to be too much hassle for the lack of performance. Frankly I’m a bit confused with nVidia as such a strong a company with a powerful product mix to let this slide. I expect performance kings to be PhysX, Havok then Bullet in that order but it is looking the other way around. When is PhysX going to re-implement rigid body acceleration ? Real acceleration and not the slow motion stuff we see in demos ?

Don’t get me wrong, I sincerely appreciate nVidia sharing the PhysX library. It was great and can be again!