Manages memory, thread locks, and task scheduling for a CUDA context. More...
#include <PxCudaContextManager.h>
Public Member Functions | |
virtual void | acquireContext ()=0 |
Acquire the CUDA context for the current thread. More... | |
virtual void | releaseContext ()=0 |
Release the CUDA context from the current thread. More... | |
virtual PxCudaMemoryManager * | getMemoryManager ()=0 |
Return the PxCudaMemoryManager instance associated with this CUDA context. More... | |
virtual class PxGpuDispatcher * | getGpuDispatcher ()=0 |
Return the PxGpuDispatcher instance associated with this CUDA context. More... | |
virtual bool | contextIsValid () const =0 |
Context manager has a valid CUDA context. More... | |
virtual bool | supportsArchSM10 () const =0 |
G80. More... | |
virtual bool | supportsArchSM11 () const =0 |
G92. More... | |
virtual bool | supportsArchSM12 () const =0 |
GT200. More... | |
virtual bool | supportsArchSM13 () const =0 |
GT260. More... | |
virtual bool | supportsArchSM20 () const =0 |
GF100. More... | |
virtual bool | supportsArchSM30 () const =0 |
GK100. More... | |
virtual bool | supportsArchSM35 () const =0 |
GK110. More... | |
virtual bool | supportsArchSM50 () const =0 |
GM100. More... | |
virtual bool | supportsArchSM52 () const =0 |
GM200. More... | |
virtual bool | isIntegrated () const =0 |
true if GPU is an integrated (MCP) part More... | |
virtual bool | canMapHostMemory () const =0 |
true if GPU map host memory to GPU (0-copy) More... | |
virtual int | getDriverVersion () const =0 |
returns cached value of cuGetDriverVersion() More... | |
virtual size_t | getDeviceTotalMemBytes () const =0 |
returns cached value of device memory size More... | |
virtual int | getMultiprocessorCount () const =0 |
returns cache value of SM unit count More... | |
virtual unsigned int | getClockRate () const =0 |
returns cached value of SM clock frequency More... | |
virtual int | getSharedMemPerBlock () const =0 |
returns total amount of shared memory available per block in bytes More... | |
virtual unsigned int | getMaxThreadsPerBlock () const =0 |
returns the maximum number of threads per block More... | |
virtual const char * | getDeviceName () const =0 |
returns device name retrieved from driver More... | |
virtual PxCudaInteropMode::Enum | getInteropMode () const =0 |
interop mode the context was created with More... | |
virtual void | setUsingConcurrentStreams (bool)=0 |
turn on/off using concurrent streams for GPU work More... | |
virtual bool | getUsingConcurrentStreams () const =0 |
true if GPU work can run in concurrent streams More... | |
virtual bool | registerResourceInCudaGL (CUgraphicsResource &resource, PxU32 buffer)=0 |
Register a rendering resource with CUDA. More... | |
virtual bool | registerResourceInCudaD3D (CUgraphicsResource &resource, void *resourcePointer)=0 |
Register a rendering resource with CUDA. More... | |
virtual bool | unregisterResourceInCuda (CUgraphicsResource resource)=0 |
Unregister a rendering resource with CUDA. More... | |
virtual int | usingDedicatedPhysXGPU () const =0 |
Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel. More... | |
virtual void | release ()=0 |
Release the PxCudaContextManager. More... | |
Protected Member Functions | |
virtual | ~PxCudaContextManager () |
protected destructor, use release() method More... | |
Manages memory, thread locks, and task scheduling for a CUDA context.
A PxCudaContextManager manages access to a single CUDA context, allowing it to be shared between multiple scenes. Memory allocations are dynamic: starting with an initial heap size and growing on demand by a configurable page size. The context must be acquired from the manager before using any CUDA APIs.
The PxCudaContextManager is based on the CUDA driver API and explictly does not support the the CUDA runtime API (aka, CUDART).
To enable CUDA use by an APEX scene, a PxCudaContextManager must be created (supplying your own CUDA context, or allowing a new context to be allocated for you), the PxGpuDispatcher for that context is retrieved via the getGpuDispatcher() method, and this is assigned to the TaskManager that is given to the scene via its NxApexSceneDesc.
|
inlineprotectedvirtual |
protected destructor, use release() method
|
pure virtual |
Acquire the CUDA context for the current thread.
Acquisitions are allowed to be recursive within a single thread. You can acquire the context multiple times so long as you release it the same count.
The context must be acquired before using most CUDA functions.
It is not necessary to acquire the CUDA context inside GpuTask launch functions, because the PxGpuDispatcher will have already acquired the context for its worker thread. However it is not harmfull to (re)acquire the context in code that is shared between GpuTasks and non-task functions.
|
pure virtual |
true if GPU map host memory to GPU (0-copy)
|
pure virtual |
Context manager has a valid CUDA context.
This method should be called after creating a PxCudaContextManager, especially if the manager was responsible for allocating its own CUDA context (desc.ctx == NULL). If it returns false, there is no point in assigning this manager's PxGpuDispatcher to a TaskManager as it will be unable to execute GpuTasks.
|
pure virtual |
returns cached value of SM clock frequency
|
pure virtual |
returns device name retrieved from driver
|
pure virtual |
returns cached value of device memory size
|
pure virtual |
returns cached value of cuGetDriverVersion()
|
pure virtual |
Return the PxGpuDispatcher instance associated with this CUDA context.
|
pure virtual |
interop mode the context was created with
|
pure virtual |
returns the maximum number of threads per block
|
pure virtual |
Return the PxCudaMemoryManager instance associated with this CUDA context.
|
pure virtual |
returns cache value of SM unit count
|
pure virtual |
returns total amount of shared memory available per block in bytes
|
pure virtual |
true if GPU work can run in concurrent streams
|
pure virtual |
true if GPU is an integrated (MCP) part
|
pure virtual |
Register a rendering resource with CUDA.
This function is called to register render resources (allocated from Direct3D) with CUDA so that the memory may be shared between the two systems. This is only required for render resources that are designed for interop use. In APEX, each render resource descriptor that could support interop has a 'registerInCUDA' boolean variable.
The function must be called again any time your graphics device is reset, to re-register the resource.
Returns true if the registration succeeded. A registered resource must be unregistered before it can be released.
resource | [OUT] the handle to the resource that can be used with CUDA |
resourcePointer | [IN] A pointer to either IDirect3DResource9, or ID3D10Device, or ID3D11Resource to be registered. |
|
pure virtual |
Register a rendering resource with CUDA.
This function is called to register render resources (allocated from OpenGL) with CUDA so that the memory may be shared between the two systems. This is only required for render resources that are designed for interop use. In APEX, each render resource descriptor that could support interop has a 'registerInCUDA' boolean variable.
The function must be called again any time your graphics device is reset, to re-register the resource.
Returns true if the registration succeeded. A registered resource must be unregistered before it can be released.
resource | [OUT] the handle to the resource that can be used with CUDA |
buffer | [IN] GLuint buffer index to be mapped to cuda |
|
pure virtual |
Release the PxCudaContextManager.
When the manager instance is released, it also releases its PxGpuDispatcher instance and PxCudaMemoryManager. Before the memory manager is released, it frees all allocated memory pages. If the PxCudaContextManager created the CUDA context it was responsible for, it also frees that context.
Do not release the PxCudaContextManager if there are any scenes using its PxGpuDispatcher. Those scenes must be released first since there is no safe way to remove a PxGpuDispatcher from a TaskManager once the TaskManager has been given to a scene.
|
pure virtual |
Release the CUDA context from the current thread.
The CUDA context should be released as soon as practically possible, to allow other CPU threads (including the PxGpuDispatcher) to work efficiently.
|
pure virtual |
turn on/off using concurrent streams for GPU work
|
pure virtual |
G80.
|
pure virtual |
G92.
|
pure virtual |
GT200.
|
pure virtual |
GT260.
|
pure virtual |
GF100.
|
pure virtual |
GK100.
|
pure virtual |
GK110.
|
pure virtual |
GM100.
|
pure virtual |
GM200.
|
pure virtual |
Unregister a rendering resource with CUDA.
If a render resource was successfully registered with CUDA using the registerResourceInCuda***() methods, this function must be called to unregister the resource before the it can be released.
|
pure virtual |
Determine if the user has configured a dedicated PhysX GPU in the NV Control Panel.